Browse Source

v1

hardware_test_b
zhaohe 1 year ago
parent
commit
0e8ebd1486
  1. 13
      app/src/acid_dispenser_ble_slave_main.c
  2. 4
      app/src/app_basic_service/device_version_info_mgr.c
  3. 2
      app/src/app_service/light_ctrl.c
  4. 57
      app/src/aproject_config/config.h
  5. 6
      app/src/ble_data_processer_utils.c
  6. 2
      libznordic
  7. 2
      protocol

13
app/src/acid_dispenser_ble_slave_main.c

@ -116,6 +116,19 @@ void one_conduction_process_rx_packet(uint8_t* rx, int len) {
else if (kproto_cmd_reset == cmd) {
NVIC_SystemReset();
}
else if (kproto_cmd_read_power == cmd) {
txheader->data.read_power.power = 100;
send_success_receipt(txheader);
}
else if (kproto_cmd_read_version == cmd) {
txheader->data.read_version.firmware_version = FIRMWARE_VERSION;
txheader->data.read_version.blestack_version = BLESTACK_VERSION;
txheader->data.read_version.bootloader_version = BOOTLOADER_VERSION;
txheader->data.read_version.hardware_version = HARDWARE_VERSION;
send_success_receipt(txheader);
}
}
/***********************************************************************************************************************

4
app/src/app_basic_service/device_version_info_mgr.c

@ -54,9 +54,9 @@ void device_info_read_sn(sn_t *sn) {
uint32_t id = NRF_UICR->CUSTOMER[1];
static char sn_str[15];
if ((lot == 0 && id == 0) || lot == 0xffffffff || id == 0xffffffff) {
sprintf(sn_str, "AciDisp%02d%03d", 0, 0);
sprintf(sn_str, "%s%02d%03d", CATEGORY, 0, 0);
} else {
sprintf(sn_str, "AciDisp%02d%03d", lot, id);
sprintf(sn_str, "%s%02d%03d", CATEGORY, lot, id);
}
memcpy(sn->sn, sn_str, sizeof(sn->sn));
}

2
app/src/app_service/light_ctrl.c

@ -3,6 +3,7 @@
#include "aproject_config/config.h"
#include "nrf_gpio.h"
#include "znordic.h"
#if 0
#define BLINK_PERIOD_MS (100)
#define QUICK_BLINK_PERIOD_MS (100)
@ -110,3 +111,4 @@ void light_ctrl_green_block_flash(int times, int periodms){
}
}
#endif

57
app/src/aproject_config/config.h

@ -1,62 +1,15 @@
#pragma once
/***********************************************************************************************************************
* *
* *
***********************************************************************************************************************/
#define CATEGORY "M1003" // 单导联
#define CATEGORY "AciDisp" //
#define MANUFACTURER_NAME "iflytop"
#define FIRMWARE_VERSION (6)
#define BLESTACK_VERSION 1
#define BOOTLOADER_VERSION 1
#define FIRMWARE_VERSION (1)
#define BLESTACK_VERSION (1)
#define BOOTLOADER_VERSION (1)
#define HARDWARE_VERSION (2)
#define APP_COMPANY_IDENTIFIER 0xFFFF
/*******************************************************************************
* BEEP *
*******************************************************************************/
#define BEEP_PIN 1
#define BEEP_PWM_INSTANCE 0
#define BATTERY_ADC_PIN NRF_SAADC_INPUT_AIN3
#define BATTERY_ADC_CHANNEL 1 // 不重复即可
#define BATTERY_CHARGE_DETECT_PIN 6
/**
* @brief
*/
#define MAX_STORAGE_TIMEOUT_S (60 * 10) // 最长存储时间
#define MAX_STORAGE_SIZE (MAX_STORAGE_TIMEOUT_S * 400) // 存储最大限制为 (256-8)kbyte
#define MAX_FILE_NUM 10 // 最多存储条目数
#define SAMPLE_RATE 500 // 采样率
#define SAMPLE_PRECISION 32 // 采样精度
#define AUTOMATIC_SLEEP_TIME 30000 // 开机后自动休眠时间
#define SAMPLE_MIN_TIME_S (30.0) // 采样最小时间
#define LITTLE_DATA_BLOCK_FRAME_NUM 50 // 每次多少帧上报一次
#define KEEP_STILL_OVERTIME_MS_1P5 1500 // 保持静止超时时间的1/6
#define LED_GREEN_PIN 9
#define LED_BLUE_PIN 10
#define LED_RED_PIN 39
#define HEART_WAVE_SAMPLE_TMR_INSTANCE 3
#define LIGHT_PWM_INSTANCE 1
// #define APP_BATTERY_PROTECT_LEVEL 2 //
// #define APP_AUTO_STANDY_BATTERY_LEVEL 5 // ,
// #define APP_WORK_BATTERY_LEVEL 10 // Main初始化时候和从standy切换到work的时候
#define APP_LOW_BATTERY_WARNING_LIMIT 20 //
#define LOW_BATTERY_REMINDER_DELAY_MS 3000
#define BLE_UNCONNECTED_OVERTIME_S 300
/***********************************************************************************************************************
* ADS1291_IF *
***********************************************************************************************************************/
#define ADS1291_SPI_INSTANCE 2

6
app/src/ble_data_processer_utils.c

@ -27,6 +27,12 @@ void send_success_receipt(hand_acid_ble_proto_t* rxpacket) {
txheader->frame_index = rxpacket->frame_index;
txheader->frame_type = kproto_cmd_receipt;
if (txheader->cmd == kproto_cmd_read_power) {
sendlen = HAND_ACID_BLE_BASE_SIZE + sizeof(txheader->data.read_power);
} else if (txheader->cmd == kproto_cmd_read_version) {
sendlen = HAND_ACID_BLE_BASE_SIZE + sizeof(txheader->data.read_version);
}
zdatachannel_data_send2(_bletxbuf, sendlen);
}

2
libznordic

@ -1 +1 @@
Subproject commit 817961a6ee6a75c2eb9ae6e02a166df822de0f45
Subproject commit 580f3fa2c782904ac2e26dfa73db6f7134fd8eb3

2
protocol

@ -1 +1 @@
Subproject commit f2646b051b0d2661fb354dd442e82f9c303512d1
Subproject commit 36ac082e16852c6b5e3ecc7bb36899286191a0e8
Loading…
Cancel
Save