Files
balance-board/src/main.c
T

46 lines
1.1 KiB
C

/*
* GML670 Balance Board — CoP Binary Protocol
* Features:
* - 4-channel ADS1256 with averaging filter.
* - Board-side CoP (Center of Pressure) computation.
* - Binary protocol over BLE NUS (17-byte CoP frame, 50 Hz).
* - Downlink: resistance params, spotter mode, heartbeat.
*/
#include "ble_transport.h"
#include "button.h"
#include "sensor.h"
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
/**
* @brief 初始化系统各模块并进入主线程驻留状态。
*
* @retval 0 理论上的正常返回值;当前实现进入永久休眠后不会主动返回。
* @retval -1 按键模块或传感器模块初始化失败。
*/
int main(void) {
k_msleep(2000);
LOG_INF("--- GML670 System (CoP Binary Protocol) ---");
ble_transport_init();
ble_transport_adv_start();
if (button_init()) {
LOG_ERR("Failed to initialize buttons");
return -1;
}
if (sensor_init()) {
LOG_ERR("Failed to initialize sensor");
return -1;
}
k_sleep(K_FOREVER);
return 0;
}