diff --git a/components/cmdscheduler/cmd_scheduler_v2.cpp b/components/cmdscheduler/cmd_scheduler_v2.cpp index 590dd8f..4736dd5 100644 --- a/components/cmdscheduler/cmd_scheduler_v2.cpp +++ b/components/cmdscheduler/cmd_scheduler_v2.cpp @@ -55,6 +55,7 @@ void CmdSchedulerV2::initialize(ZUART* receiver) { m_dataisready = true; // on data ,in irq context }); + m_uart->startRxIt(); regbasiccmd(); } // int32_t getAckInt32Val(int index) { diff --git a/components/zcan_module/zcan_basic_order_module.cpp b/components/zcan_module/zcan_basic_order_module.cpp index b631dd8..f554ccb 100644 --- a/components/zcan_module/zcan_basic_order_module.cpp +++ b/components/zcan_module/zcan_basic_order_module.cpp @@ -15,6 +15,14 @@ void ZCanBasicOrderModule::initialize(ZCanReceiver* zcanReceiver) { void ZCanBasicOrderModule::regInputCtl(readfn_t fn) { m_readfn = fn; } void ZCanBasicOrderModule::regOutCtl(writefn_t fn) { m_writefn = fn; } void ZCanBasicOrderModule::regReadAdcVal(readadcval_t fn) { m_readadcval = fn; } +void ZCanBasicOrderModule::write_io(int32_t index, bool state) { + if (m_writefn) m_writefn(index, state); +} +int32_t ZCanBasicOrderModule::read_adc(int32_t index) { + int32_t val = 0; + if (m_readadcval) m_readadcval(index, val); + return val; +} void ZCanBasicOrderModule::onRceivePacket(CanPacketRxBuffer* rxbuf, uint8_t* packet, size_t len) { // diff --git a/components/zcan_module/zcan_basic_order_module.hpp b/components/zcan_module/zcan_basic_order_module.hpp index f1121c4..49d3838 100644 --- a/components/zcan_module/zcan_basic_order_module.hpp +++ b/components/zcan_module/zcan_basic_order_module.hpp @@ -35,6 +35,9 @@ class ZCanBasicOrderModule : public ZCanRceiverListener { void regOutCtl(writefn_t fn); void regReadAdcVal(readadcval_t fn); + void write_io(int32_t index,bool state); + int32_t read_adc(int32_t index); + public: virtual void onRceivePacket(CanPacketRxBuffer* rxbuf, uint8_t* packet, size_t len);