diff --git a/.cproject b/.cproject
index aaee702..9e66595 100644
--- a/.cproject
+++ b/.cproject
@@ -94,7 +94,7 @@
-
+
@@ -115,12 +115,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
diff --git a/.gitmodules b/.gitmodules
index 2f0d391..b8f0f8b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule ".vscode"]
path = .vscode
url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_subboard_vscode_cfg.git
+[submodule "a8000_protocol"]
+ path = a8000_protocol
+ url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_protocol.git
diff --git a/a8000_protocol b/a8000_protocol
new file mode 160000
index 0000000..1743a4b
--- /dev/null
+++ b/a8000_protocol
@@ -0,0 +1 @@
+Subproject commit 1743a4bfa958a6c9ea286edd4c82a129891a5aea
diff --git a/sdk b/sdk
index fd424ae..4fbd2bd 160000
--- a/sdk
+++ b/sdk
@@ -1 +1 @@
-Subproject commit fd424aeed7fd56ee83369b2e1a92ef7f913914f0
+Subproject commit 4fbd2bdf3a29557a93e7d1ae8d9ce6d14c5b970b
diff --git a/usrc/gservice.cpp b/usrc/gservice.cpp
new file mode 100644
index 0000000..b7d4ba9
--- /dev/null
+++ b/usrc/gservice.cpp
@@ -0,0 +1,17 @@
+#include "gservice.hpp"
+
+#include "configs/device_id_mgr.hpp"
+
+using namespace iflytop;
+
+void GService::initialize() { //
+
+ ZCanReceiver::CFG* zcanreceiver_cfg = zcanreceiver.createCFG(zdevice_id_mgr_get_device_id());
+ zcanreceiver.initialize(zcanreceiver_cfg);
+ zcan_protocol_parser.initialize(&zcanreceiver);
+}
+
+GService* GService::inst() {
+ static GService gservice;
+ return &gservice;
+}
diff --git a/usrc/gservice.hpp b/usrc/gservice.hpp
new file mode 100644
index 0000000..36e3d13
--- /dev/null
+++ b/usrc/gservice.hpp
@@ -0,0 +1,23 @@
+#include
+#include
+
+#include "a8000_protocol\zcan_protocol_parser.hpp"
+#include "sdk/chip/chip.hpp"
+#include "sdk/components/zcancmder/zcanreceiver.hpp"
+#include "sdk/os/zos.hpp"
+
+namespace iflytop {
+
+class GService {
+ ZCanReceiver zcanreceiver;
+ ZCanProtocolParser zcan_protocol_parser;
+
+ public:
+ void initialize();
+
+ static GService* inst();
+
+ ZCanReceiver* getZCanReceiver() { return &zcanreceiver; }
+};
+
+} // namespace iflytop
diff --git a/usrc/main.cpp b/usrc/main.cpp
index d7ce88a..27e963a 100644
--- a/usrc/main.cpp
+++ b/usrc/main.cpp
@@ -4,10 +4,10 @@
#include "board.h"
//
#include "configs/device_id_mgr.hpp"
+#include "gservice.hpp"
#include "sdk/chip/chip.hpp"
#include "sdk/os/zos.hpp"
#include "subboards/subboard30_shake_module/subboard30_shake_module.hpp"
-
#define TAG "main"
using namespace std;
using namespace iflytop;
@@ -41,13 +41,23 @@ void umain() {
if (id <= 0) {
chip_set_error();
ZEARLY_LOGE("SYS", "device id is not set");
- } else {
- if (id == 30) {
- Subboard30ShakeModule::ins()->initializeAndRun();
+ while (true) {
+ zos_delay(1);
}
}
+ GService::inst()->initialize();
+ switch (id) {
+ case 30: // Ò¡ÔÈÄ£×é
+ Subboard30ShakeModule::ins()->initialize();
+ break;
+
+ default:
+ break;
+ }
+
while (true) {
+ GService::inst()->getZCanReceiver()->loop();
zos_delay(1);
}
}
diff --git a/usrc/main.cpp.bak b/usrc/main.cpp.bak
deleted file mode 100644
index 3f072ea..0000000
--- a/usrc/main.cpp.bak
+++ /dev/null
@@ -1,105 +0,0 @@
-#include
-#include
-
-#include "board.h"
-#include "sdk\components\subcanmodule\zcancmder_subboard_initer.hpp"
-/*******************************************************************************
- * PROJECT_INCLUDE *
- *******************************************************************************/
-#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
-#include "sdk\components\mini_servo_motor\feite_servo_motor.hpp"
-#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
-#include "sdk\components\sensors\m3078\m3078_code_scaner.hpp"
-#include "sdk\components\tmc\ic\ztmc5130.hpp"
-
-#define TAG "main"
-using namespace iflytop;
-using namespace std;
-
-static ZCancmderSubboardIniter initer;
-
-extern void umain();
-extern "C" {
-void StartDefaultTask(void const* argument) { umain(); }
-}
-/*******************************************************************************
- * GET_DEVICE_ID *
- *******************************************************************************/
-static int32_t getDeviceId() { return BOARD_ID; }
-/*******************************************************************************
- * INIT_SUBMODULE *
- *******************************************************************************/
-void nvs_init_cb() {}
-static void initsubmodule() {
-#if 0
-#define INLET_SPEED 300
-#define OUTET_SPEED 300
-#define TANSLATE_SPEED 500
- /**
- * @brief ÈëÁÏ
- */
- {
- static TMC5130 motor;
- static StepMotorCtrlModule stepMotorCtrlModule;
-
- TMC5130::cfg_t cfg = {
- .spi = &TMC_MOTOR_SPI, //
- .csgpio = MOTOR1_CSN, //
- .ennPin = MOTOR1_ENN, //
- .spi_mode_select = MOTOR1_SPI_MODE_SELECT, //
- };
- motor.initialize(&cfg);
- motor.setMotorShaft(false);
- ZLOGI(TAG, "motor1 initialize 5160:%x ", motor.readICVersion());
-
- static ZGPIO input[2];
- input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
- input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
-
- StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
- StepMotorCtrlModule::create_default_cfg(smcm_cfg);
-
- smcm_cfg.base_param.motor_shift = 0;
- smcm_cfg.base_param.motor_shaft = 0;
- smcm_cfg.base_param.motor_one_circle_pulse = 100;
- smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
- smcm_cfg.base_param.motor_default_velocity = INLET_SPEED;
- smcm_cfg.base_param.motor_default_acc = 300;
- smcm_cfg.base_param.motor_default_dec = 300;
- smcm_cfg.base_param.motor_run_to_zero_max_d = 5000;
- smcm_cfg.base_param.motor_look_zero_edge_max_d = 100;
- smcm_cfg.base_param.motor_run_to_zero_speed = 50;
- smcm_cfg.base_param.motor_run_to_zero_dec = 600;
- smcm_cfg.base_param.motor_look_zero_edge_speed = 100;
- smcm_cfg.base_param.motor_look_zero_edge_dec = 900;
- smcm_cfg.base_param.stepmotor_ihold = 1;
- smcm_cfg.base_param.stepmotor_irun = 24;
- smcm_cfg.base_param.stepmotor_iholddelay = 1000;
-
- stepMotorCtrlModule.initialize(initer.get_module_id(1), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
- initer.register_module(&stepMotorCtrlModule);
- }
-#endif
-}
-
-/*******************************************************************************
- * MAIN *
- *******************************************************************************/
-void umain() {
- ZCancmderSubboardIniter::cfg_t cfg = //
- {
- .deviceId = getDeviceId(),
- .input_gpio =
- {
- {.pin = PD0, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
- {.pin = PD1, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
- {.pin = PD2, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
- {.pin = PD3, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
- {.pin = PD4, .mode = ZGPIO::kMode_nopull, .irqtype = ZGPIO::kIRQ_noIrq, .mirror = true},
- },
- .output_gpio = {},
- };
- initer.init(&cfg);
- initsubmodule();
- initer.loop();
-}
diff --git a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp
index 9cecb9f..03b08bb 100644
--- a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp
+++ b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp
@@ -5,7 +5,7 @@ using namespace iflytop;
Subboard30ShakeModule::Subboard30ShakeModule(/* args */) {}
Subboard30ShakeModule::~Subboard30ShakeModule() {}
-void Subboard30ShakeModule::initializeAndRun() {}
+void Subboard30ShakeModule::initialize() {}
Subboard30ShakeModule* Subboard30ShakeModule::ins() {
static Subboard30ShakeModule instance;
diff --git a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.hpp b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.hpp
index 3582841..5074d89 100644
--- a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.hpp
+++ b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.hpp
@@ -17,7 +17,7 @@ class Subboard30ShakeModule {
static Subboard30ShakeModule* ins();
- void initializeAndRun();
+ void initialize();
};
} // namespace iflytop