feat(UML-1462): Добавлена настройка периода обмена PDO
This commit is contained in:
parent
0ffd4fa0fb
commit
9a96d327f6
@ -45,15 +45,19 @@ void EthEcatPdoFMMU::wait_op() {
|
|||||||
init_sem.post();
|
init_sem.post();
|
||||||
process_sem.pend();
|
process_sem.pend();
|
||||||
|
|
||||||
|
read(0, process_data);
|
||||||
|
|
||||||
for(uint32_t i = 0; i < 250; i++) {
|
for(uint32_t i = 0; i < 250; i++) {
|
||||||
read(0, process_data);
|
read_write(0, 0, process_data);
|
||||||
|
|
||||||
|
//read(0, process_data);
|
||||||
/*
|
/*
|
||||||
for(uint8_t& byte : process_data) {
|
for(uint8_t& byte : process_data) {
|
||||||
DebugP_log("0x%01x", byte);
|
DebugP_log("0x%01x", byte);
|
||||||
}
|
}
|
||||||
DebugP_log("\r\n");
|
DebugP_log("\r\n");
|
||||||
*/
|
*/
|
||||||
write(0, process_data);
|
//write(0, process_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
init_sem.post();
|
init_sem.post();
|
||||||
|
|||||||
@ -18,7 +18,7 @@ EthEcat::EthEcat(Eth& eth)
|
|||||||
, telegram_{eth}
|
, telegram_{eth}
|
||||||
, eeprom_{telegram_} { }
|
, eeprom_{telegram_} { }
|
||||||
|
|
||||||
void EthEcat::Init(TEthMacPorts port_id) {
|
void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) {
|
||||||
port_id_ = port_id;
|
port_id_ = port_id;
|
||||||
telegram_.init(port_id);
|
telegram_.init(port_id);
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ void EthEcat::Init(TEthMacPorts port_id) {
|
|||||||
.clock_src_mux_addr = 0x430081B0u, // sysconfig
|
.clock_src_mux_addr = 0x430081B0u, // sysconfig
|
||||||
.int_num = 152u, // sysconfig
|
.int_num = 152u, // sysconfig
|
||||||
.int_priority = 4, // sysconfig
|
.int_priority = 4, // sysconfig
|
||||||
.period_us = 125 /// microsec
|
.period_us = period_microsec /// microsec
|
||||||
};
|
};
|
||||||
|
|
||||||
ecat_timer_.Init(ecat_tmr_sett);
|
ecat_timer_.Init(ecat_tmr_sett);
|
||||||
|
|||||||
@ -209,7 +209,7 @@ public:
|
|||||||
|
|
||||||
EthEcat(Eth& eth);
|
EthEcat(Eth& eth);
|
||||||
|
|
||||||
void Init(TEthMacPorts port_id);
|
void Init(TEthMacPorts port_id, uint32_t period_microsec);
|
||||||
|
|
||||||
void set_slaves_to_default();
|
void set_slaves_to_default();
|
||||||
uint16_t slaves_detecting();
|
uint16_t slaves_detecting();
|
||||||
|
|||||||
@ -19,10 +19,10 @@ namespace free_rtos {
|
|||||||
* pdo_write(...), pdo_read(...) или pdo_write_async(...), pdo_read_async(...)
|
* pdo_write(...), pdo_read(...) или pdo_write_async(...), pdo_read_async(...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool EthEcatApi::config_init(TEthMacPorts port_id, uint16_t address_base) {
|
bool EthEcatApi::config_init(TEthMacPorts port_id, uint16_t address_base, uint32_t period_microsec = 250) {
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
ecat_.Init(port_id);
|
ecat_.Init(port_id, period_microsec);
|
||||||
|
|
||||||
ecat_.config_init(address_base);
|
ecat_.config_init(address_base);
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public:
|
|||||||
, ecat_sdo_mailbox_{ecat_buffer_sdo_}
|
, ecat_sdo_mailbox_{ecat_buffer_sdo_}
|
||||||
, ecat_pdo_fmmu_{ecat_buffer_pdo_} { }
|
, ecat_pdo_fmmu_{ecat_buffer_pdo_} { }
|
||||||
|
|
||||||
bool config_init(TEthMacPorts port_id, uint16_t address_base);
|
bool config_init(TEthMacPorts port_id, uint16_t address_base, uint32_t period_microsec);
|
||||||
void process(); // Внутри бесконечный цикл. Запускать в отдельном потоке
|
void process(); // Внутри бесконечный цикл. Запускать в отдельном потоке
|
||||||
std::vector<ecat_buffer::PDOMap>& get_ecat_pdo_map();
|
std::vector<ecat_buffer::PDOMap>& get_ecat_pdo_map();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user