Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d56bd0a926 | |||
| 84a8a75563 | |||
| 916476c468 | |||
| c347e44536 | |||
| af836b02e4 | |||
| 1c53cc09ec | |||
| 99f4ef2a5b | |||
| 81536688aa |
+4
-5
@@ -27,14 +27,14 @@ static void SendCaliValue(uint8_t CaliNumber){
|
||||
|
||||
// ch = 2 * (CaliNumber % 4);
|
||||
// uint8_t gain_level = CaliNumber / 4; // 0:gain, 1:offset
|
||||
uint8_t channel_number = 8, index = 1;
|
||||
uint8_t channel_number = 8, index = 2;
|
||||
uint8_t gain_level = 0;
|
||||
|
||||
if(CaliNumber < 4){
|
||||
gain_level = CaliNumber;
|
||||
}
|
||||
|
||||
cali_buf[0] = CHIP_ID;
|
||||
cali_buf[1] = CHIP_ID;
|
||||
for(int i=0 ; i<channel_number ; i++){
|
||||
cali_buf[index++] = (uint8_t) (CaliTable.Ch[i].Gain[gain_level] >> 8) & 0xFF;
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ch[i].Gain[gain_level] & 0x00FF;
|
||||
@@ -42,9 +42,8 @@ static void SendCaliValue(uint8_t CaliNumber){
|
||||
cali_buf[index++] = (uint8_t) CaliTable.Ch[i].Offset[gain_level] & 0x00FF;
|
||||
}
|
||||
|
||||
// for(int i=1 ; i<BLE_CDR_BUFF_SIZE ; i++){
|
||||
// cali_buf[i] = i;
|
||||
// }
|
||||
cali_buf[0] = index;
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, index, cali_buf);
|
||||
}
|
||||
|
||||
|
||||
+37
-19
@@ -319,15 +319,15 @@ static void headstage_init() {
|
||||
headstage_led_open();
|
||||
headstage_pwm_open();
|
||||
headstage_led_color(COLOR_GREEN); // color green
|
||||
headstage_pwm_start(headstage_system_pwm_handle);
|
||||
headstage_pwm_start(headstage_poly_r_pwm_handle);
|
||||
headstage_pin_output(PIN_RESET, 1);
|
||||
// headstage_pwm_start(headstage_system_pwm_handle);
|
||||
// headstage_pwm_start(headstage_poly_r_pwm_handle);
|
||||
// headstage_pin_output(PIN_RESET, 1);
|
||||
headstage_pin_output(PIN_DC_DC, 1);
|
||||
headstage_cpu_delay_ms(1);
|
||||
headstage_pin_output(PIN_RESET, 0);
|
||||
// headstage_pin_output(PIN_RESET, 0);
|
||||
headstage_cpu_delay_ms(1);
|
||||
headstage_pin_output(PIN_EN_ADC_SPI_CLK, 1);
|
||||
headstage_pin_output(PIN_RESET, 1);
|
||||
// headstage_pin_output(PIN_EN_ADC_SPI_CLK, 1);
|
||||
// headstage_pin_output(PIN_RESET, 1);
|
||||
|
||||
// turn off neulive if battery too low
|
||||
#define THREE_POINT_THREE_VOLT 845
|
||||
@@ -691,7 +691,7 @@ static void headstage_update_vis_instruction(uint8_t vis_oper) {
|
||||
|
||||
case VIS_EN_ADC_CLK:{
|
||||
adc_spi_en_switch ^= 1;
|
||||
headstage_pin_output(PIN_EN_ADC_SPI_CLK, adc_spi_en_switch);
|
||||
// headstage_pin_output(PIN_EN_ADC_SPI_CLK, adc_spi_en_switch);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -820,6 +820,10 @@ static void headstage_update_cis_instruction(uint8_t cis_oper) {
|
||||
switch (cis_oper) {
|
||||
case CIS_NOP: {
|
||||
// nothing
|
||||
for(int i=0 ; i<BLE_CDR_SAMLL_SIZE ; i++ ){
|
||||
cdr_buf[i] = 0;
|
||||
}
|
||||
|
||||
cdr_buf[0] = _B_4b4b(CIS_NOP, CHIP_ID);
|
||||
cdr_buf[1] = _B_4b4b(CDR_SUCCESS, 0);
|
||||
|
||||
@@ -828,9 +832,14 @@ static void headstage_update_cis_instruction(uint8_t cis_oper) {
|
||||
}
|
||||
//#ifdef HEADSTAGE_CIS_VOLT_H
|
||||
case CIS_VOLT: {
|
||||
cdr_buf[0] = CIS_VOLT | CHIP_ID;
|
||||
cdr_buf[1] = headstage_battery_volt1();
|
||||
cdr_buf[2] = headstage_battery_volt2();
|
||||
for(int i=0 ; i<BLE_CDR_SAMLL_SIZE ; i++ ){
|
||||
cdr_buf[i] = 0;
|
||||
}
|
||||
|
||||
cdr_buf[0] = BLE_CDR_SAMLL_SIZE; // data length
|
||||
cdr_buf[1] = CIS_VOLT | CHIP_ID;
|
||||
cdr_buf[2] = headstage_battery_volt1();
|
||||
cdr_buf[3] = headstage_battery_volt2();
|
||||
|
||||
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, BLE_CDR_SAMLL_SIZE, cdr_buf);
|
||||
|
||||
@@ -862,23 +871,28 @@ static void headstage_update_cis_instruction(uint8_t cis_oper) {
|
||||
//#endif
|
||||
|
||||
case CIS_VERSION:{
|
||||
cdr_buf[0] = VERSION_DATE_YEAR;
|
||||
cdr_buf[1] = VERSION_DATE_MONTH;
|
||||
cdr_buf[2] = VERSION_DATE_DAY;
|
||||
cdr_buf[3] = VERSION_DATE_HOUR;
|
||||
cdr_buf[4] = VERSION_DATE_MINUTE;
|
||||
for(int i=0 ; i<BLE_CDR_SAMLL_SIZE ; i++ ){
|
||||
cdr_buf[i] = 0;
|
||||
}
|
||||
|
||||
cdr_buf[0] = BLE_CDR_SAMLL_SIZE;
|
||||
cdr_buf[1] = VERSION_DATE_YEAR;
|
||||
cdr_buf[2] = VERSION_DATE_MONTH;
|
||||
cdr_buf[3] = VERSION_DATE_DAY;
|
||||
cdr_buf[4] = VERSION_DATE_HOUR;
|
||||
cdr_buf[5] = VERSION_DATE_MINUTE;
|
||||
|
||||
uint8_t mac_int[4];
|
||||
if( strncmp(CaliTable.DeviceName, "BOARD_TEST", 25)){
|
||||
// has a specific cali data
|
||||
get_board_name(CaliTable.DeviceName, mac_int, 4);
|
||||
cdr_buf[5] = mac_int[0];
|
||||
cdr_buf[6] = mac_int[1];
|
||||
cdr_buf[6] = mac_int[0];
|
||||
cdr_buf[7] = mac_int[1];
|
||||
}
|
||||
else{
|
||||
// this board use default cali setting
|
||||
cdr_buf[5] = 0xAB;
|
||||
cdr_buf[6] = 0xCD;
|
||||
cdr_buf[6] = 0xAB;
|
||||
cdr_buf[7] = 0xCD;
|
||||
}
|
||||
|
||||
|
||||
@@ -887,6 +901,10 @@ static void headstage_update_cis_instruction(uint8_t cis_oper) {
|
||||
}
|
||||
|
||||
default: {
|
||||
for(int i=0 ; i<BLE_CDR_SAMLL_SIZE ; i++ ){
|
||||
cdr_buf[i] = 0;
|
||||
}
|
||||
|
||||
cdr_buf[0] = _B_4b4b(cis_oper, CHIP_ID);
|
||||
cdr_buf[1] = _B_4b4b(CDR_FAILURE, 0);
|
||||
|
||||
|
||||
+6
-6
@@ -3,15 +3,15 @@
|
||||
#define VERSION_DATE
|
||||
|
||||
#define VERSION_DATE_YEAR 20
|
||||
#define VERSION_DATE_MONTH 7
|
||||
#define VERSION_DATE_DAY 20
|
||||
#define VERSION_DATE_HOUR 17
|
||||
#define VERSION_DATE_MINUTE 48
|
||||
#define VERSION_DATE_MONTH 8
|
||||
#define VERSION_DATE_DAY 25
|
||||
#define VERSION_DATE_HOUR 15
|
||||
#define VERSION_DATE_MINUTE 23
|
||||
|
||||
// this is NOT the version hash !!
|
||||
// it's the last version hash
|
||||
#define VERSION_HASH 81d5d86890d1da5dfb3ccc7e1756261c3ecbf485
|
||||
#define VERSION_GIT_BRANCH Neulive20_developement_linux
|
||||
#define VERSION_HASH 84a8a75563cc1ff8f51493e6e7475532837e5867
|
||||
#define VERSION_GIT_BRANCH neulive20_nordic_testing
|
||||
|
||||
static void get_board_name(char *board_name_ch, uint8 *board_name_int, uint8 name_size){
|
||||
uint8 name_offset = 18;
|
||||
|
||||
+7
-7
@@ -44,9 +44,9 @@
|
||||
/*
|
||||
* SPI0 interface with DBS chip 2.0
|
||||
*/
|
||||
#define Board_SPI0_MISO PIN_SPI_MISO
|
||||
#define Board_SPI0_MOSI PIN_SPI_MOSI
|
||||
#define Board_SPI0_CLK PIN_SPI_CLK
|
||||
#define Board_SPI0_MISO PIN_UNASSIGNED
|
||||
#define Board_SPI0_MOSI PIN_UNASSIGNED
|
||||
#define Board_SPI0_CLK PIN_UNASSIGNED
|
||||
//#define Board_SPI0_CSN PIN_SPI_CS
|
||||
#define Board_SPI0_CSN PIN_UNASSIGNED
|
||||
|
||||
@@ -64,9 +64,9 @@
|
||||
#define Board_MRDY Board_BP_Pin_J1_2
|
||||
|
||||
/* PWM outputs */
|
||||
#define Board_PWMPIN0 PIN_AMP_VCK
|
||||
#define Board_PWMPIN0 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN1 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN2 PIN_SYS_CLK
|
||||
#define Board_PWMPIN2 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN3 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN4 PIN_UNASSIGNED
|
||||
#define Board_PWMPIN5 PIN_UNASSIGNED
|
||||
@@ -74,8 +74,8 @@
|
||||
#define Board_PWMPIN7 PIN_UNASSIGNED
|
||||
|
||||
static PIN_Config headstage_pin_configuration[] = { //
|
||||
PIN_RESET | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_EN_ADC_SPI_CLK | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_RESET | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_EN_ADC_SPI_CLK | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_DC_DC | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_BATT_HALF | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
PIN_STI_CLK | PIN_INPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
|
||||
|
||||
+3
-3
@@ -60,11 +60,11 @@ static void MCUReset(){
|
||||
}
|
||||
|
||||
static void DBSReset(){
|
||||
headstage_pin_output(PIN_RESET, 0);
|
||||
// headstage_pin_output(PIN_RESET, 0);
|
||||
headstage_cpu_delay_ms(10);
|
||||
headstage_pin_output(PIN_DC_DC, 1);
|
||||
headstage_pin_output(PIN_EN_ADC_SPI_CLK, 1);
|
||||
headstage_pin_output(PIN_RESET, 1);
|
||||
// headstage_pin_output(PIN_EN_ADC_SPI_CLK, 1);
|
||||
// headstage_pin_output(PIN_RESET, 1);
|
||||
}
|
||||
|
||||
static void Neu2Reset(){
|
||||
|
||||
@@ -82,7 +82,7 @@ extern "C" {
|
||||
|
||||
// Length of Characteristic 5 in bytes
|
||||
#define SIMPLEPROFILE_CHAR1_LEN 2
|
||||
#define SIMPLEPROFILE_CHAR2_LEN 50
|
||||
#define SIMPLEPROFILE_CHAR2_LEN 34
|
||||
#define SIMPLEPROFILE_CHAR3_LEN 20
|
||||
#define SIMPLEPROFILE_CHAR4_LEN 200
|
||||
//#define SIMPLEPROFILE_CHAR4_LEN 20
|
||||
|
||||
Reference in New Issue
Block a user