7 changed files with 122 additions and 43 deletions
-
93components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.cpp
-
34components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.hpp
-
13components/zcancmder/zcanreceiver.cpp
-
6components/zcancmder/zcanreceiver.hpp
-
14components/zcancmder/zcanreceiver_master.cpp
-
2components/zcancmder/zcanreceiver_master.hpp
-
3components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp
@ -1,27 +1,47 @@ |
|||
#include "sdk\components\zprotocols\zcancmder\api\i_eeprom.hpp"
|
|||
#include "sdk\components\zprotocols\zcancmder_v2\api\api.hpp"
|
|||
#include "sdk\os\zos.hpp"
|
|||
|
|||
#ifdef HAL_I2C_MODULE_ENABLED
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
class M24LR64E_I2CEEPROM : public I_EEPROMModule { |
|||
class M24LR64E_I2CEEPROM : public ZIModule { |
|||
I2C_HandleTypeDef* m_i2c_handle; |
|||
ZThread m_monitor_thread; |
|||
bool m_is_online_flag = false; |
|||
zmutex m_mutex; |
|||
zmutex m_mutex; |
|||
ZIEventBusSender* m_event_bus_sender; |
|||
|
|||
int32_t id = 0; |
|||
|
|||
public: |
|||
M24LR64E_I2CEEPROM(){}; |
|||
~M24LR64E_I2CEEPROM(){}; |
|||
|
|||
void initialize(I2C_HandleTypeDef* i2c_handle); |
|||
void initialize(int id, I2C_HandleTypeDef* i2c_handle, ZIEventBusSender* event_bus_sender); |
|||
|
|||
public: |
|||
int32_t start_monitor_status(); |
|||
int32_t stop_monitor_status(); |
|||
int32_t code_scaner_read_scaner_result(int32_t startadd, uint8_t* data, int32_t* len); |
|||
|
|||
public: |
|||
virtual int32_t getid(int32_t* id) override { |
|||
*id = this->id; |
|||
return 0; |
|||
} |
|||
|
|||
virtual int32_t module_set_reg(int32_t param_id, int32_t param_value); |
|||
virtual int32_t module_get_reg(int32_t param_id, int32_t* param_value); |
|||
|
|||
int32_t start_monitor_status(function<void(eeprom_status_t& status)> cb) override; |
|||
int32_t stop_monitor_status() override; |
|||
int32_t read(u16 sector_index, u16 sector_size, zcancmder_read_ram_ack_t& ack) override; |
|||
virtual int32_t module_read_raw(int32_t index, uint8_t* data, int32_t* len); |
|||
|
|||
private: |
|||
int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& param_value); |
|||
int32_t read_status(); |
|||
|
|||
private: |
|||
bool isonline(); |
|||
void change_is_online_flag(bool state); |
|||
}; |
|||
} // namespace iflytop
|
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue