4 Commits

Author SHA1 Message Date
lmx
627780ea20 11月28日发客户的版本 2025-11-28 18:13:35 +08:00
lmx
ade4b0a1f8 feat: Add rfid feature and .gitignore file 2025-11-28 16:25:35 +08:00
lmx
818e8c3778 chore: Remove tracked build artifacts 2025-11-28 16:24:27 +08:00
lmx
892ed9267b feat: Add rfid feature and .gitignore file 2025-11-28 16:23:06 +08:00
1129 changed files with 346 additions and 278839 deletions

16
.gitignore vendored
View File

@ -1,32 +1,16 @@
# 编译生成的目标文件
*.o
*.a
*.so
*.d
# 编译生成的最终产物
*.elf
*.bin
*.fw
*.ufw
*.map
*.lst
*.bc
# 编译产物目录
# 看起来你所有的编译结果都在 objs/ 目录下,直接忽略整个目录更方便
/objs/
# 工具链和构建产物
# 根据你的路径,这些文件也应该被忽略
/cpu/br28/tools/app.bin
/cpu/br28/tools/data_code.bin
/cpu/br28/tools/download/
/cpu/br28/tools/isd_config.ini
/cpu/br28/tools/sdk.elf*
/cpu/br28/tools/sdk.lst
/cpu/br28/tools/sdk.map
/cpu/br28/sdk_used_list.used
# VSCode 用户个人设置
# 团队协作时,每个人的配置可能不同,通常不建议提交

33
.vscode/settings.json vendored
View File

@ -1,33 +0,0 @@
{
"files.associations": {
"board_config.h": "c",
"board_jl701n_demo_cfg.h": "c",
"colorful_lights.h": "c",
"board_jl701n_anc_cfg.h": "c",
"update_loader_download.h": "c",
"iic_soft.h": "c",
"circle_buffer.h": "c",
"default_event_handler.h": "c",
"ui_manage.h": "c",
"charge.h": "c",
"app_main.h": "c",
"app_config.h": "c",
"app_action.h": "c",
"includes.h": "c",
"key_event_deal.h": "c",
"app_umidigi_chargestore.h": "c",
"hci_lmp.h": "c",
"bluetooth.h": "c",
"SCU722.C": "cpp",
"math.h": "c",
"avctp_user.h": "c",
"string.h": "c",
"dev_manager.h": "c",
"bt_tws.h": "c",
"skiing_tracker.h": "c",
"xtell.h": "c",
"debug.h": "c",
"ano_protocol.h": "c",
"board_jl701n_demo_global_build_cfg.h": "c"
}
}

View File

@ -530,6 +530,7 @@ void JL_rcsp_msg_deal(void *hdl, u8 event, u8 *msg)
case MSG_JL_ENTER_UPDATE_MODE:
rcsp_printf("MSG_JL_ENTER_UPDATE_MODE:%x %x\n", msg[0], msg[1]);
clk_set("sys",96*1000000L);
bt_set_low_latency_mode(0);
if (support_dual_bank_update_en && !tws_api_get_role()) {
u8 status = 0;

View File

@ -81,10 +81,10 @@ const struct task_info task_info_table[] = {
#if AUDIO_ENC_MPT_SELF_ENABLE
{"enc_mpt_self", 3, 0, 512, 128 },
#endif/*AUDIO_ENC_MPT_SELF_ENABLE*/
// {"update", 1, 0, 256, 0 },
// {"tws_ota", 2, 0, 256, 0 },
// {"tws_ota_msg", 2, 0, 256, 128 },
// {"dw_update", 2, 0, 256, 128 },
{"update", 1, 0, 256, 0 },
{"tws_ota", 2, 0, 256, 0 },
{"tws_ota_msg", 2, 0, 256, 128 },
{"dw_update", 2, 0, 256, 128 },
{"rcsp_task", 2, 0, 640, 128 },
// {"aud_capture", 4, 0, 512, 256 },
// {"data_export", 5, 0, 512, 256 },

View File

@ -87,7 +87,7 @@
//*********************************************************************************//
// USB 配置 //
//*********************************************************************************//
#define TCFG_PC_ENABLE 1//DISABLE_THIS_MOUDLE//PC模块使能
#define TCFG_PC_ENABLE 0//DISABLE_THIS_MOUDLE//PC模块使能
#define TCFG_UDISK_ENABLE 0//ENABLE_THIS_MOUDLE//U盘模块使能
#define TCFG_OTG_USB_DEV_EN BIT(0)//USB0 = BIT(0) USB1 = BIT(1)
@ -729,7 +729,7 @@ DAC硬件上的连接方式,可选的配置:
// 充电舱/蓝牙测试盒/ANC测试三者为同级关系,开启任一功能都会初始化PP0通信接口 //
//*********************************************************************************//
#define TCFG_CHARGESTORE_ENABLE DISABLE_THIS_MOUDLE //是否支持智能充电舱
#define TCFG_TEST_BOX_ENABLE ENABLE_THIS_MOUDLE //是否支持蓝牙测试盒 //xtell
#define TCFG_TEST_BOX_ENABLE DISABLE_THIS_MOUDLE//ENABLE_THIS_MOUDLE //是否支持蓝牙测试盒 //xtell
#define TCFG_ANC_BOX_ENABLE CONFIG_ANC_ENABLE //是否支持ANC测试盒
#define TCFG_UMIDIGI_BOX_ENABLE DISABLE_THIS_MOUDLE //是否支持UMIDIGI充电舱 //xtell
#if TCFG_UMIDIGI_BOX_ENABLE
@ -807,7 +807,7 @@ DAC硬件上的连接方式,可选的配置:
// EQ配置 //
//*********************************************************************************//
//EQ配置使用在线EQ时EQ文件和EQ模式无效。有EQ文件时使能TCFG_USE_EQ_FILE,默认不用EQ模式切换功能
#define TCFG_EQ_ENABLE 1 //支持EQ功能,EQ总使能
#define TCFG_EQ_ENABLE 0 //支持EQ功能,EQ总使能
// #if TCFG_EQ_ENABLE
#define TCFG_EQ_ONLINE_ENABLE 0 //支持在线EQ调试,如果使用蓝牙串口调试,需要打开宏 APP_ONLINE_DEBUG否则默认使用uart调试(二选一)
#define TCFG_BT_MUSIC_EQ_ENABLE 1 //支持蓝牙音乐EQ
@ -1010,7 +1010,7 @@ DAC硬件上的连接方式,可选的配置:
//*********************************************************************************//
#define TCFG_USER_TWS_ENABLE 0 //tws功能使能
#define TCFG_USER_BLE_ENABLE 1 //BLE功能使能
#define TCFG_BT_SUPPORT_AAC 1 //AAC格式支持
#define TCFG_BT_SUPPORT_AAC 0 //AAC格式支持
#define TCFG_BT_SUPPORT_LDAC 0 //LDAC格式支持
#if TCFG_BT_SUPPORT_LDAC
@ -1084,7 +1084,7 @@ DAC硬件上的连接方式,可选的配置:
// 编解码格式配置(CodecFormat) //
//*********************************************************************************//
/*解码格式使能*/
#define TCFG_DEC_MP3_ENABLE ENABLE
#define TCFG_DEC_MP3_ENABLE DISABLE
#define TCFG_DEC_WTGV2_ENABLE ENABLE
#define TCFG_DEC_G729_ENABLE DISABLE
#define TCFG_DEC_WMA_ENABLE DISABLE

View File

@ -8,8 +8,8 @@
/* Following Macros Affect Periods Of Both Code Compiling And Post-build */
#define CONFIG_DOUBLE_BANK_ENABLE 0 //单双备份选择(若打开了改宏,FLASH结构变为双备份结构适用于接入第三方协议的OTA PS: JL-OTA同样支持双备份升级, 需要根据实际FLASH大小同时配置CONFIG_FLASH_SIZE)
#define CONFIG_APP_OTA_ENABLE 0 //是否支持RCSP升级(JL-OTA)
#define CONFIG_DOUBLE_BANK_ENABLE 1 //单双备份选择(若打开了改宏,FLASH结构变为双备份结构适用于接入第三方协议的OTA PS: JL-OTA同样支持双备份升级, 需要根据实际FLASH大小同时配置CONFIG_FLASH_SIZE)
#define CONFIG_APP_OTA_ENABLE 1 //是否支持RCSP升级(JL-OTA)
#define CONFIG_UPDATE_JUMP_TO_MASK 0 //配置升级到loader的方式0为直接reset,1为跳转(适用于芯片电源由IO口KEEP住的方案,需要注意检查跳转前是否将使用DMA的硬件模块全部关闭)
@ -33,7 +33,7 @@
/* Following Macros Only For Post Bulid Configuaration */
#define CONFIG_DB_UPDATE_DATA_GENERATE_EN 0 //是否生成db_data.bin(用于第三方协议接入使用)
#define CONFIG_ONLY_GRENERATE_ALIGN_4K_CODE 0 //ufw只生成1份4K对齐的代码
#define CONFIG_ONLY_GRENERATE_ALIGN_4K_CODE 1 //ufw只生成1份4K对齐的代码
//config for supported chip version
#ifdef CONFIG_BR30_C_VERSION

View File

@ -65,8 +65,8 @@
#if CONFIG_APP_OTA_ENABLE
#define RCSP_UPDATE_EN 1 //是否支持rcsp升级
#if CONFIG_DOUBLE_BANK_ENABLE //双备份才能打开同步升级流程
#define OTA_TWS_SAME_TIME_ENABLE 1 //是否支持TWS同步升级
#define OTA_TWS_SAME_TIME_NEW 1 //使用新的tws ota流程
#define OTA_TWS_SAME_TIME_ENABLE 0 //是否支持TWS同步升级
#define OTA_TWS_SAME_TIME_NEW 0 //使用新的tws ota流程
#else
#define OTA_TWS_SAME_TIME_ENABLE 1//0 xtellota //是否支持TWS同步升级
#define OTA_TWS_SAME_TIME_NEW 1//0 //使用新的tws ota流程

View File

@ -531,7 +531,7 @@ void skiing_tracker_update(skiing_tracker_t *tracker, float *acc_g, float *gyr_d
#if 0
#if 1
float linear_acc_device[3];
float linear_acc_world[3];
float tmp_world_acc[3];
@ -547,7 +547,7 @@ void skiing_tracker_update(skiing_tracker_t *tracker, float *acc_g, float *gyr_d
tmp_world_acc[2] * tmp_world_acc[2]);
static int count = 0;
if(count > 10){
if(count > 100){
xlog("===original(g): x %.2f, y %.2f, z %.2f===\n",acc_g[0],acc_g[1],acc_g[2]);
xlog("===world(m/s^2) no g: x %.2f, y %.2f, z %.2f, all %.2f===\n",tmp_world_acc[0],tmp_world_acc[1],tmp_world_acc[2],all_world_mag); //去掉重力加速度
xlog("===gyr(dps) : x %.2f, y %.2f, z %.2f===\n",gyr_dps[0],gyr_dps[1],gyr_dps[2]); //angle

View File

@ -6,6 +6,8 @@
#include "tone_player.h"
#include "ui_manage.h"
#include "gpio.h"
#include <math.h>
#include <string.h>
#include "app_main.h"
#include "asm/charge.h"
#include "update.h"
@ -24,6 +26,9 @@
#include "./sensor/MMC56.h"
#include "./sensor/BMP280.h"
#include "./sensor/AK8963.h"
#include "asm/rtc.h"
#include "system/timer.h"
#include "adv_time_stamp_setting.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
//宏定义
#define ENABLE_XLOG 1
@ -46,13 +51,15 @@
void send_data_to_ble_client(const u8* data, u16 length);
extern void create_process(u16* pid, const char* name, void *priv, void (*func)(void *priv), u32 msec);
extern void close_process(u16* pid,char* name);
void start_collect_fuc(void);
void BLE_send_fuc(void);
//END -- 函数定义
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//START -- 变量定义
static u32 timer_offset_ms = 0;
typedef struct {
// -- 六轴 --
@ -62,8 +69,13 @@ typedef struct {
// -- 速度 --
uint16_t speed_cms;
// -- 气压计 --
int adc_P;
int adc_T;
int16_t temperature;
uint32_t pressure;
// -- 左/右腿 --
uint8_t foot_state; //1左脚2右脚
// -- 时间 --
u32 timestamp_ms;
} BLE_send_data_t;
static int count = 0;
@ -72,9 +84,29 @@ static int count = 0;
static circle_buffer_t BLE_send_buff; // 环形缓冲区管理结构体
BLE_send_data_t BLE_send_data[SENSOR_DATA_BUFFER_SIZE];
// -- 任务id --
u16 SC7U22_calibration_id;
u16 start_collect_fuc_id;
u16 BLE_send_fuc_id;
static u8 stop_ble_send_fuc_id;
//END -- 变量定义
//////////////////////////////////////////////////////////////////////////////////////////////////
// 重置计时器
void reset_ms_timer(void) {
timer_offset_ms = sys_timer_get_ms();
xlog("Timer has been reset.\n");
}
// 获取从上次重置后经过的毫秒数
u32 get_ms_timer(void) {
return sys_timer_get_ms() - timer_offset_ms;
}
// ----------------------------------------------------------------------------------------------------------------
// --------------------------------------------定时器回调函数----------------------------------------------------------
/**
* @brief 六轴静态校准
*
@ -114,7 +146,9 @@ void SC7U22_static_calibration(void){
// snprintf( log_buffer, sizeof(log_buffer),"status:%d\n",status);
// send_data_to_ble_client(&log_buffer,strlen(log_buffer));
xlog("status:%d\n", status);
xlog("RawData:AX=%d,AY=%d,AZ=%d,GX=%d,GY=%d,GZ=%d\r\n",combined_raw_data[0],combined_raw_data[1],combined_raw_data[2],combined_raw_data[3],combined_raw_data[4],combined_raw_data[5]);
xlog("RawData:AX=%d,AY=%d,AZ=%d,GX=%d,GY=%d,GZ=%d\r\n",combined_raw_data[0],combined_raw_data[1],combined_raw_data[2],combined_raw_data[3],combined_raw_data[4],combined_raw_data[5]);
uint8_t send[5] = {0xBB, 0xBE, 0x02, 0x00, 0x12};
send_data_to_ble_client(&send,5); //正在校验中
}
count++;
}
@ -124,8 +158,7 @@ void SC7U22_static_calibration(void){
*
*/
void start_collect_fuc(void){
// xlog("=======sensor_read_data START\n");
// xlog("=======sensor_read_data START\n");
static signed short combined_raw_data[6];
static int initialized = 0;
static int calibration_done = 0;
@ -137,10 +170,14 @@ void start_collect_fuc(void){
float angle[3];
float quaternion_output[3];
float temperature = 0;
float pressure = 0;
// -- 读数据 --
SL_SC7U22_RawData_Read(acc_data_buf,gyr_data_buf);
mmc5603nj_read_origin_data(mmc5603nj_buffer);
bmp280_read_originanl_data(&BLE_send_data_tmp.adc_P, &BLE_send_data_tmp.adc_T);
// bmp280_read_originanl_data(&BLE_send_data_tmp.adc_P, &BLE_send_data_tmp.adc_T);
bmp280_read_data(&temperature, &pressure);
memcpy(&combined_raw_data[0], acc_data_buf, 3 * sizeof(signed short));
memcpy(&combined_raw_data[3], gyr_data_buf, 3 * sizeof(signed short));
@ -157,7 +194,12 @@ void start_collect_fuc(void){
memcpy(&BLE_send_data_tmp.SC7U22_data[0], acc_data_buf, 3 * sizeof(signed short));
memcpy(&BLE_send_data_tmp.SC7U22_data[3], gyr_data_buf, 3 * sizeof(signed short));
memcpy(BLE_send_data_tmp.mmc5603nj_buffer, mmc5603nj_buffer, 9);
BLE_send_data_tmp.temperature = (int16_t)(temperature * 1000.0f);
BLE_send_data_tmp.pressure = (int32_t)(pressure * 1000.0f);
BLE_send_data_tmp.speed_cms = speed;
extern u8 foot_init;
BLE_send_data_tmp.foot_state = foot_init;
BLE_send_data_tmp.timestamp_ms = get_ms_timer();
// -- 放进缓冲区 --
if(circle_buffer_is_full(&BLE_send_buff) == 0){
@ -166,6 +208,7 @@ void start_collect_fuc(void){
// xlog("=======sensor_read_data END\n");
}
/**
@ -236,31 +279,27 @@ void BLE_send_fuc(void){
// --- 封装并发送压力机计数据 ---
{
// 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(8) = 12字节
const uint8_t PT_PACKET_LEN = 12;
const uint8_t PT_PAYLOAD_LEN = 9; // 类型(1) + 数据(8)
// 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(6) = 10字节
const uint8_t PT_PACKET_LEN = 10;
const uint8_t PT_PAYLOAD_LEN = 7; // 类型(1) + 数据(6)
const uint8_t PT_TYPE = 0x03;
uint8_t pt_packet[PT_PACKET_LEN];
// 填充包头
pt_packet[0] = 0xBB;
pt_packet[1] = 0xBE;
pt_packet[2] = PT_PAYLOAD_LEN;
pt_packet[3] = PT_TYPE;
// 直接发送 int16_t 的二进制补码
pt_packet[4] = (uint8_t)(data_to_send.temperature & 0xFF); // 低字节
pt_packet[5] = (uint8_t)((data_to_send.temperature >> 8) & 0xFF); // 高字节
// 打包压力数据 data_to_send.adc_P (占 pt_packet[4] 到 pt_packet[7])
pt_packet[4] = (uint8_t)(data_to_send.adc_P & 0xFF); // 最低字节 (LSB)
pt_packet[5] = (uint8_t)((data_to_send.adc_P >> 8) & 0xFF);
pt_packet[6] = (uint8_t)((data_to_send.adc_P >> 16) & 0xFF);
pt_packet[7] = (uint8_t)((data_to_send.adc_P >> 24) & 0xFF); // 最高字节 (MSB)
// 打包温度数据 data_to_send.adc_T (占 pt_packet[8] 到 pt_packet[11])
pt_packet[8] = (uint8_t)(data_to_send.adc_T & 0xFF); // 最低字节 (LSB)
pt_packet[9] = (uint8_t)((data_to_send.adc_T >> 8) & 0xFF);
pt_packet[10] = (uint8_t)((data_to_send.adc_T >> 16) & 0xFF);
pt_packet[11] = (uint8_t)((data_to_send.adc_T >> 24) & 0xFF); // 最高字节 (MSB)
// 气压 (保持不变)
pt_packet[6] = (uint8_t)(data_to_send.pressure & 0xFF);
pt_packet[7] = (uint8_t)((data_to_send.pressure >> 8) & 0xFF);
pt_packet[8] = (uint8_t)((data_to_send.pressure >> 16) & 0xFF);
pt_packet[9] = (uint8_t)((data_to_send.pressure >> 24) & 0xFF);
send_data_to_ble_client(&pt_packet, PT_PACKET_LEN);
}
@ -288,9 +327,82 @@ void BLE_send_fuc(void){
send_data_to_ble_client(&speed_packet, SPEED_PACKET_LEN);
}
// --- 封装并发送数据 ---
{
// 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(5) = 9字节
const uint8_t OTHER_PACKET_LEN = 9;
const uint8_t OTHER_PAYLOAD_LEN = 6; // 类型(1) + 数据(5)
const uint8_t OTHER_TYPE = 0x05;
uint8_t oher_packet[OTHER_PACKET_LEN];
// 填充包头
oher_packet[0] = 0xBB;
oher_packet[1] = 0xBE;
// 填充长度
oher_packet[2] = OTHER_PAYLOAD_LEN;
// 填充类型
oher_packet[3] = OTHER_TYPE;
// 小端模式
oher_packet[4] = (uint8_t)data_to_send.foot_state; // 数据来源
oher_packet[5] = (uint8_t)((data_to_send.timestamp_ms >> 0) & 0xFF); // LSB
oher_packet[6] = (uint8_t)((data_to_send.timestamp_ms >> 8) & 0xFF);
oher_packet[7] = (uint8_t)((data_to_send.timestamp_ms >> 16) & 0xFF);
oher_packet[8] = (uint8_t)((data_to_send.timestamp_ms >> 24) & 0xFF); // MSB
send_data_to_ble_client(&oher_packet, OTHER_PACKET_LEN);
}
}
static u8 bmp280_test_id = 0;
void stop_BLE_send_fuc(void){
if (circle_buffer_is_empty(&BLE_send_buff)) {
close_process(&BLE_send_fuc_id,"BLE_send_fuc");
close_process(&stop_ble_send_fuc_id,"stop_BLE_send_fuc");
}
}
// ------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------
/**
* @brief 六轴静态校验
*
*/
void start_calibration(void){
create_process(&SC7U22_calibration_id,"SC7U22_calibration",NULL,SC7U22_static_calibration,10);
}
void stop_calibration(void){
close_process(&SC7U22_calibration_id, "SC7U22_calibration");
}
/**
* @brief 开始采集传感器数据并通过ble发送
*
*/
void start_clloct(void){
reset_ms_timer();
create_process(&start_collect_fuc_id,"start_collect",NULL,start_collect_fuc,10);
create_process(&BLE_send_fuc_id,"BLE_send_fuc",NULL,BLE_send_fuc,5);
}
/**
* @brief 停止采集和ble发送
*
*/
void stop_clloct(void){
close_process(&start_collect_fuc_id,"start_collect");
close_process(&BLE_send_fuc_id,"BLE_send_fuc");
// create_process(&stop_ble_send_fuc_id,"stop_BLE_send_fuc",NULL,stop_BLE_send_fuc,500); //等缓冲区内容发送完才停止ble发送任务
}
/**
* @brief 初始化在app_main.c的app_main函数被调用
*
*/
void xtell_task_create(void){
#if TCFG_GSENOR_USER_IIC_TYPE
@ -311,15 +423,8 @@ void xtell_task_create(void){
circle_buffer_init(&BLE_send_buff, BLE_send_data, SENSOR_DATA_BUFFER_SIZE, sizeof(BLE_send_data_t));
bmp280_init();
extern void bmp280_test(void);
xlog("barometer start measeure\n");
// create_process(&bmp280_test_id,"bmp280_test",NULL, bmp280_test, 100);
float Temp = 0;
float Press = 0;
xlog("test_func\n");
bmp280_read_data(&Temp, &Press);
xlog("Temp:%.2f, Press:%.2f\n",Temp,Press);
}
@ -330,4 +435,25 @@ void xtell_task_create(void){
void bmp280_test(void){
}
void gsensor_test(void){
#if 1
if(count >= 5){
xlog("==============time============\n");
u32 current_time = get_ms_timer();
xlog("Time since last reset: %u ms\n", current_time);
// 为了演示,我们在这里调用重置
if (current_time > 5000) { // 比如超过5秒就重置一次
reset_ms_timer();
}
count = 0;
}
count++;
#endif
}

View File

@ -1504,6 +1504,8 @@ unsigned char Q_SL_SC7U22_Angle_Output(unsigned char calibration_en, signed shor
SL_SC7U22_Error_cnt2 = 0;
SL_SC7U22_Error_cnt = 0;
for (sl_i = 0; sl_i < 6; sl_i++) Sum_Avg_Accgyro[sl_i] = Sum_Avg_Accgyro[sl_i] / 50;
Error_Accgyro[0] = 0 - Sum_Avg_Accgyro[0];
Error_Accgyro[1] = 0 - Sum_Avg_Accgyro[1];
#if ACC_RANGE==2
@ -1518,6 +1520,8 @@ unsigned char Q_SL_SC7U22_Angle_Output(unsigned char calibration_en, signed shor
Error_Accgyro[3] = 0 - Sum_Avg_Accgyro[3];
Error_Accgyro[4] = 0 - Sum_Avg_Accgyro[4];
Error_Accgyro[5] = 0 - Sum_Avg_Accgyro[5];
// xlog("AVG_Recode AX:%d,AY:%d,AZ:%d,GX:%d,GY:%d,GZ:%d\r\n", Sum_Avg_Accgyro[0], Sum_Avg_Accgyro[1], Sum_Avg_Accgyro[2], Sum_Avg_Accgyro[3], Sum_Avg_Accgyro[4], Sum_Avg_Accgyro[5]);
// xlog("Error_Recode AX:%d,AY:%d,AZ:%d,GX:%d,GY:%d,GZ:%d\r\n", Error_Accgyro[0], Error_Accgyro[1], Error_Accgyro[2], Error_Accgyro[3], Error_Accgyro[4], Error_Accgyro[5]);
}

View File

@ -90,10 +90,11 @@ static u16 play_poweron_ok_timer_id = 0;
u8 SC7U22_init = 0x10; //六轴是否初始化
u8 MMC5603nj_init = 0x20; //地磁是否初始化
u8 BMP280_init = 0x30; //气压计初始化
u8 foot_init = 0x40; //数据来源初始化左脚0x41 or 右脚0x42
// -- 线程id --
u16 SC7U22_calibration_id;
u16 start_collect_fuc_id;
u16 BLE_send_fuc_id;
u16 gsensor_test_id = 0;
//
///////////////////////////////////////////////////////////////////////////////////////////////////
extern int bt_hci_event_handler(struct bt_event *bt);
@ -102,6 +103,11 @@ extern void create_process(u16* pid, const char* name, void *priv, void (*func)(
extern void close_process(u16* pid,char* name);
extern void start_collect_fuc(void);
extern void BLE_send_fuc(void);
extern void start_calibration(void);
extern void start_clloct(void);
extern void stop_clloct(void);
extern void set_foot_state(u8 state);
extern void stop_calibration(void);
///////////////////////////////////////////////////////////////////////////////////////////////////
/*
* 模式状态机, 通过start_app()控制状态切换
@ -213,6 +219,12 @@ void le_user_app_event_handler(struct sys_event* event){
if (event->u.app.buffer[0] == 0xBE && event->u.app.buffer[1] == 0xBB) {
if(event->u.app.buffer[2] == 0x01){ //后面的数据长度 1
switch (event->u.app.buffer[3]){
case 0x01:
// extern void gsensor_test(void);
// create_process(&gsensor_test_id,"gsensor_test",NULL,gsensor_test,1000);
xlog("ota_test");
cpu_reset();
break;
case 0xff: //测试
u8 device_buff[10];
u8 founds = 0;
@ -230,13 +242,14 @@ void le_user_app_event_handler(struct sys_event* event){
case 0x00: //数据包类型为:指定传感器初始化
u8 send2_0[5] = {0xBB,0xBE,0x02,0x00,0x00};
if(event->u.app.buffer[4] == 0x01){ //六轴
stop_calibration();
if (SL_SC7U22_Config() == 0) {
send2_0[4] = 0x00; //初始化失败
SC7U22_init = 0x10;
send_data_to_ble_client(&send2_0,5);
return;
}
create_process(&SC7U22_calibration_id,"SC7U22_calibration",NULL,SC7U22_static_calibration,10);
start_calibration();
}else if(event->u.app.buffer[4] == 0x02){ //地磁
if(mmc5603nj_init() == 0){
MMC5603nj_init = 0x20;
@ -260,29 +273,37 @@ void le_user_app_event_handler(struct sys_event* event){
send_data_to_ble_client(&send2_0,5);
}
break;
case 0x01: //数据包类型为:获取指定传感器初始化状态
u8 send2_1[5] = {0xBB,0xBE,0x02,0x00,0x00};
if(event->u.app.buffer[4] == 0x01){ //六轴
send2_1[4] = SC7U22_init;
}else if(event->u.app.buffer[4] == 0x02){ //地磁
send2_1[4] = MMC5603nj_init;
}else if(event->u.app.buffer[4] == 0x03){ //气压计
send2_1[4] = BMP280_init;
case 0x01: //设置传感器采集对象左脚or右脚
u8 send2_1[9] = {0xBB,0xBE,0x06,0x05,0x00,0x00,0x00,0x00,0x00};
if(event->u.app.buffer[4] == 0x01){ //设定数据来源是左脚
foot_init = 0x41;
}else if(event->u.app.buffer[4] == 0x02){//设定数据来源是右脚
foot_init = 0x42;
}
send_data_to_ble_client(&send2_1,5);
send2_1[4] = foot_init;
send_data_to_ble_client(&send2_1,9);
break;
case 0x02: //开始/停止滑雪计算
case 0x02: //数据包类型为:获取指定传感器初始化状态
u8 send2_2[5] = {0xBB,0xBE,0x02,0x00,0x00};
if(event->u.app.buffer[4] == 0x01){ //六轴
send2_2[4] = SC7U22_init;
}else if(event->u.app.buffer[4] == 0x02){ //地磁
send2_2[4] = MMC5603nj_init;
}else if(event->u.app.buffer[4] == 0x03){ //气压计
send2_2[4] = BMP280_init;
}
send_data_to_ble_client(&send2_2,5);
break;
case 0x03: //开始/停止滑雪计算
if(event->u.app.buffer[4] == 0x01){ //开始滑雪计算
if(SC7U22_init == 0x10 || MMC5603nj_init == 0x20 || BMP280_init == 0x30){ //传感器未进行初始化
u8 send2_2[5] = {0xBB,0xBE,0x02,0x00,0x00};
send_data_to_ble_client(&send2_2,5);
u8 send2_3[5] = {0xBB,0xBE,0x02,0x00,0x00};
send_data_to_ble_client(&send2_3,5);
return;
}
create_process(&start_collect_fuc_id,"start_collect",NULL,start_collect_fuc,10);
create_process(&BLE_send_fuc_id,"BLE_send_fuc",NULL,BLE_send_fuc,1);
start_clloct();
}else if(event->u.app.buffer[4] == 0x02){ //停止滑雪计算
close_process(&start_collect_fuc_id,"start_collect");
close_process(&BLE_send_fuc_id,"BLE_send_fuc");
stop_clloct();
}
break;
}

View File

@ -253,6 +253,7 @@
_MASK_MEM_BEGIN = ABSOLUTE(0x19fc00);
_MASK_MEM_SIZE = ABSOLUTE(0x1a4);
EXTERN(
_start
@ -274,25 +275,14 @@ cvsd_decoder
pcm_decoder
mp3_decoder
wtgv2_decoder
aac_decoder
cvsd_encoder
msbc_encoder
audio_dac_driver
);
UPDATA_SIZE = 0x80;
@ -428,7 +418,8 @@ SECTIONS
battery_notify_begin = .;
*(.battery_notify)
battery_notify_end = .;
. = ALIGN(4);
. = ALIGN(4);
__VERSION_BEGIN = .;
KEEP(*(.sys.version))
__VERSION_END = .;
@ -518,6 +509,7 @@ SECTIONS
*(.audio_track_data)
*(.audio_adc_data)
. = ALIGN(4);
*(.data*)
@ -726,6 +718,7 @@ SECTIONS
} > ram0
data_code_pc_limit_end = .;
__report_overlay_end = .;
@ -815,6 +808,7 @@ SECTIONS
}
SECTIONS
{
.data : ALIGN(4)
@ -846,6 +840,7 @@ SECTIONS
UPDATE_CODE_TOTAL_SIZE = update_code_end - update_code_start;
}
SECTIONS
{
.data : ALIGN(4)
@ -948,6 +943,7 @@ BTSTACK_LE_HOST_MESH_RAM_TOTAL = BTSTACK_LE_HOST_MESH_DATA_SIZE + BTSTACK_LE_HOS
BTSTACK_LE_HOST_MESH_FLASH_TOTAL = BTSTACK_LE_HOST_MESH_CODE_SIZE;
BTSTACK_CODE_SIZE = (btstack_code_end - btstack_code_start) + (btstack_data_end - btstack_data_start);
SECTIONS
{
.data : ALIGN(4)
@ -1241,6 +1237,7 @@ SECTIONS
*(.os_code)
} > ram0
}
SECTIONS
{
.data : ALIGN(4)
@ -1450,6 +1447,7 @@ SECTIONS
BTCTLER_RAM_TOTAL = (btctler_data_end - btctler_data_start) + (btctler_bss_end - btctler_bss_start);
BTCTLER_CODE_TOTAL = (btctler_code_end - btctler_code_start);
}
SECTIONS
{
.data : ALIGN(4)
@ -1567,7 +1565,8 @@ SECTIONS
*(.timer.text.cache.L1)
*(.gpio.text.cache.L1)
*(.iic_hw.text.cache.L1)
driver_data_code_end = .;
driver_data_code_end = .;
. = ALIGN(4);
} > ram0
@ -1577,6 +1576,7 @@ SECTIONS
DRIVER_DATA_CODE_TOTAL = (driver_data_code_end - driver_data_code_start);
}
SECTIONS
{
.data : ALIGN(4)
@ -2016,6 +2016,7 @@ SECTIONS
} > ram0
}
text_begin = ADDR(.text);
text_size = SIZEOF(.text);
text_end = text_begin + text_size;

View File

@ -33,19 +33,7 @@ cvsd_decoder
pcm_decoder
mp3_decoder
wtgv2_decoder
aac_decoder
cvsd_encoder

View File

Binary file not shown.

Binary file not shown.

View File

@ -14,13 +14,12 @@
[EXTRA_CFG_PARAM]
NEW_FLASH_FS = YES;
BR22_TWS_DB = YES;
FLASH_SIZE = 0x100000;
BR22_TWS_VERSION = 0;
FORCE_4K_ALIGN = YES;
SPECIAL_OPT = 0;
CHIP_NAME = AC701N;
ENTRY = 0x6000100;
PID = AC701N;

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More