Browse Source

update

master
zhaohe 2 years ago
parent
commit
7ca2731d3e
  1. 12
      components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.cpp
  2. 14
      components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.hpp
  3. 1
      components/subcanmodule/zcancmder_subboard_initer.cpp
  4. 7
      components/subcanmodule/zcancmder_subboard_initer.hpp
  5. 2
      components/zprotocols/zcancmder_v2

12
components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.cpp

@ -48,7 +48,7 @@ int32_t M24LR64E_I2CEEPROM::stop_monitor_status() {
};
int32_t M24LR64E_I2CEEPROM::module_read_raw(int32_t index, uint8_t* data, int32_t* len) {
zlock_guard guard(m_mutex);
int32_t sector_size = 128;
int32_t sector_size = SECTOR_SIZE;
if (sector_size > *len) return err::kbuffer_not_enough;
@ -77,21 +77,11 @@ bool M24LR64E_I2CEEPROM::isonline() {
}
return true;
}
int32_t M24LR64E_I2CEEPROM::module_set_reg(int32_t param_id, int32_t param_value) { return module_xxx_reg(param_id, false, param_value); }
int32_t M24LR64E_I2CEEPROM::module_get_reg(int32_t param_id, int32_t* param_value) { return module_xxx_reg(param_id, true, *param_value); }
int32_t M24LR64E_I2CEEPROM::module_xxx_reg(int32_t param_id, bool read, int32_t& val) {
switch (param_id) {
PROCESS_REG(kreg_module_version, /* */ val = 0x0001, ACTION_NONE);
PROCESS_REG(kreg_module_type, /* */ val = 0, ACTION_NONE);
PROCESS_REG(kreg_module_status, /* */ val = read_status(), ACTION_NONE);
PROCESS_REG(kreg_module_errorcode, /* */ val = 0, ACTION_NONE);
PROCESS_REG(kreg_module_initflag, /* */ val = module_get_inited_flag(), module_set_inited_flag(val));
PROCESS_REG(kreg_module_enableflag, /* */ val = 1, ACTION_NONE);
PROCESS_REG(kreg_module_last_cmd_exec_status, val = 0, ACTION_NONE);
PROCESS_REG(kreg_module_raw_sector_size, /* */ val = SECTOR_SIZE, ACTION_NONE);
PROCESS_REG(kreg_module_raw_sector_num, /* */ val = SECTOR_NUM, ACTION_NONE);
PROCESS_REG(kreg_module_is_online, /* */ val = isonline(), ACTION_NONE);
default:
return err::kmodule_not_find_config_index;
break;

14
components/sensors/i2ceeprom/m24lr64e_i2c_eeprom.hpp

@ -25,21 +25,19 @@ class M24LR64E_I2CEEPROM : public ZIModule {
int32_t code_scaner_read_scaner_result(int32_t startadd, uint8_t* data, int32_t* len);
public:
virtual int32_t module_ping() { return 0; };
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);
virtual int32_t module_get_status(int32_t* status) {
*status = 1;
return 0;
}
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();
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& param_value) override;
int32_t read_status();
private:
bool isonline();

1
components/subcanmodule/zcancmder_subboard_initer.cpp

@ -57,6 +57,7 @@ void ZCancmderSubboardIniter::init(cfg_t* cfg) {
zModuleDeviceManager.initialize(nullptr);
zModuleDeviceScriptCmderPaser.initialize(&cmder, &zModuleDeviceManager);
}
eventBusSender.initialize(&zcanCmder);
initmodule();
}

7
components/subcanmodule/zcancmder_subboard_initer.hpp

@ -6,6 +6,7 @@
#include "sdk\components\zprotocol_helper\micro_computer_module_device_script_cmder_paser.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\protocol_parser.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_manager.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\protocol_event_bus_sender.hpp"
namespace iflytop {
class ZCancmderSubboardIniter {
@ -21,9 +22,9 @@ class ZCancmderSubboardIniter {
ZIProtocolParser ziProtocolParser;
ZModuleDeviceManager zModuleDeviceManager;
MicroComputerModuleDeviceScriptCmderPaser zModuleDeviceScriptCmderPaser;
ProtocolEventBusSender eventBusSender;
CmdSchedulerV2 cmder;
cfg_t m_cfg;
cfg_t m_cfg;
public:
void init(cfg_t* cfg);
@ -32,6 +33,8 @@ class ZCancmderSubboardIniter {
//
void loop();
ZIEventBusSender* get_event_bus_sender() { return &eventBusSender; }
private:
int32_t getDeviceId();
void initmodule();

2
components/zprotocols/zcancmder_v2

@ -1 +1 @@
Subproject commit 57636804cb7e8bd84466ce009d57c372cc20b9ea
Subproject commit 198a9d9fc086911073cee24dafd4b82a6120da46
Loading…
Cancel
Save