diff --git a/Firmware/EmotionalCities/Pluma.cproj b/Firmware/EmotionalCities/Pluma.cproj index eee6e3e..4d03083 100644 --- a/Firmware/EmotionalCities/Pluma.cproj +++ b/Firmware/EmotionalCities/Pluma.cproj @@ -29,19 +29,19 @@ 1 - + - + com.atmel.avrdbg.tool.atmelice - J42700004639 + J42700046659 0x1E9541 PDI @@ -52,7 +52,7 @@ PDI com.atmel.avrdbg.tool.atmelice - J42700004639 + J42700046659 Atmel-ICE 4000000 @@ -69,54 +69,9 @@ Custom Programming Tool + - - - -mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u" - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include - - - Optimize for size (-Os) - True - True - True - - - libATxmega32A4U-1.9.a - _libATxmega32A4U-1.9.a - - - - - G:\My Drive\projects\Emotional Cities\_fw&sw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities - G:\My Drive\projects\Emotional_Cities_to_workkk\_fw&sw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities - G:\My Drive\projects\Emotional_Cities_to_workkk\_fw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities - - - - - %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include - - - - - - -mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u" @@ -129,7 +84,7 @@ True - DEBUG + NDEBUG @@ -138,10 +93,9 @@ %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include - Optimize (-O1) + Optimize for size (-Os) True True - Default (-g2) True @@ -158,23 +112,92 @@ %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include - Default (-Wa,-g) + + + + -mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u" + True + True + True + True + False + True + True + + + DEBUG + + + + + .. + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libATxmega32A4U-1.9.a + + + + + .. + + + + + %24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include + + + Default (-Wa,-g) + + + compile + + compile + compile + + compile + compile + + compile + + + compile + + + compile + + + compile + + + compile + compile + + compile + compile @@ -184,6 +207,15 @@ compile + + compile + + + compile + + + compile + compile @@ -191,5 +223,10 @@ compile + + + compile + + \ No newline at end of file diff --git a/Firmware/EmotionalCities/app.c b/Firmware/EmotionalCities/app.c index 988bb3a..d841443 100644 --- a/Firmware/EmotionalCities/app.c +++ b/Firmware/EmotionalCities/app.c @@ -40,7 +40,7 @@ void hwbp_app_initialize(void) uint8_t hwH = 0; uint8_t hwL = 1; uint8_t fwH = 0; - uint8_t fwL = 4; + uint8_t fwL = 5; uint8_t ass = 0; /* Start core */ @@ -235,14 +235,23 @@ void core_callback_t_1ms(void) { if ((ms_counter % 20) == 0) // 50 Hz { - app_regs.REG_STREAM_ECG = adc_A_read_channel(5); - if (app_regs.REG_STREAM_ECG < 0) - app_regs.REG_STREAM_ECG = 0; + app_regs.REG_STREAM_ECG[0] = adc_A_read_channel(5); + if (app_regs.REG_STREAM_ECG[0] < 0) + app_regs.REG_STREAM_ECG[0] = 0; + + app_regs.REG_STREAM_ECG[1] = adc_A_read_channel(1); + if (app_regs.REG_STREAM_ECG[1] < 0) + app_regs.REG_STREAM_ECG[1] = 0; core_func_send_event(ADD_REG_STREAM_ECG, false); } else { + + app_regs.REG_STREAM_ECG[1] = adc_A_read_channel(1); + if (app_regs.REG_STREAM_ECG[1] < 0) + app_regs.REG_STREAM_ECG[1] = 0; + core_func_send_event(ADD_REG_STREAM_ECG, false); } } diff --git a/Firmware/EmotionalCities/app_funcs.c b/Firmware/EmotionalCities/app_funcs.c index f38bf48..b5108f3 100644 --- a/Firmware/EmotionalCities/app_funcs.c +++ b/Firmware/EmotionalCities/app_funcs.c @@ -91,6 +91,7 @@ bool app_write_REG_STREAM_OXIMETER(void *a) /************************************************************************/ /* REG_STREAM_ECG */ /************************************************************************/ +// This register is an array with 2 positions void app_read_REG_STREAM_ECG(void) { //app_regs.REG_STREAM_ECG = 0; @@ -99,9 +100,9 @@ void app_read_REG_STREAM_ECG(void) bool app_write_REG_STREAM_ECG(void *a) { - uint16_t reg = *((uint16_t*)a); + uint16_t *reg = ((uint16_t*)a); - app_regs.REG_STREAM_ECG = reg; + app_regs.REG_STREAM_ECG[0] = reg[0]; return true; } diff --git a/Firmware/EmotionalCities/app_ios_and_regs.c b/Firmware/EmotionalCities/app_ios_and_regs.c index 1d08130..8c3b963 100644 --- a/Firmware/EmotionalCities/app_ios_and_regs.c +++ b/Firmware/EmotionalCities/app_ios_and_regs.c @@ -9,7 +9,7 @@ void init_ios(void) { /* Configure input pins */ //io_pin2out(&PORTA, 0, PULL_IO_UP, SENSE_IO_LOW_LEVEL); // gets to be ADC 3V3 ref open GPIO - io_pin2out(&PORTA, 1, PULL_IO_UP, SENSE_IO_LOW_LEVEL); // open GPIO + //io_pin2out(&PORTA, 1, PULL_IO_UP, SENSE_IO_LOW_LEVEL); // open GPIO io_pin2out(&PORTA, 2, PULL_IO_DOWN, SENSE_IO_LOW_LEVEL); // open GPIO io_pin2out(&PORTA, 3, PULL_IO_TRISTATE, SENSE_IO_LOW_LEVEL); // Aux_In_1 io_pin2out(&PORTA, 4, PULL_IO_TRISTATE, SENSE_IO_LOW_LEVEL); // Aux_In_2 @@ -96,7 +96,7 @@ uint16_t app_regs_n_elements[] = { 1, 1, 4, - 1, + 2, 1, 1, 1, @@ -108,7 +108,7 @@ uint8_t *app_regs_pointer[] = { (uint8_t*)(&app_regs.REG_STREAM_ENABLE), (uint8_t*)(&app_regs.REG_STREAM_DISABLE), (uint8_t*)(app_regs.REG_STREAM_OXIMETER), - (uint8_t*)(&app_regs.REG_STREAM_ECG), + (uint8_t*)(app_regs.REG_STREAM_ECG), (uint8_t*)(&app_regs.REG_STREAM_GSR), (uint8_t*)(&app_regs.REG_STREAM_MOTION), (uint8_t*)(&app_regs.REG_INPUTS), diff --git a/Firmware/EmotionalCities/app_ios_and_regs.h b/Firmware/EmotionalCities/app_ios_and_regs.h index b2ba31d..d9b6c5d 100644 --- a/Firmware/EmotionalCities/app_ios_and_regs.h +++ b/Firmware/EmotionalCities/app_ios_and_regs.h @@ -51,7 +51,7 @@ typedef struct uint8_t REG_STREAM_ENABLE; uint8_t REG_STREAM_DISABLE; uint8_t REG_STREAM_OXIMETER[4]; - uint16_t REG_STREAM_ECG; + uint16_t REG_STREAM_ECG[2]; uint16_t REG_STREAM_GSR; uint8_t REG_STREAM_MOTION; uint8_t REG_INPUTS; @@ -66,7 +66,7 @@ typedef struct #define ADD_REG_STREAM_ENABLE 32 // U8 Writing 1 to the bitmask starts the correspondent data stream #define ADD_REG_STREAM_DISABLE 33 // U8 Writing 1 to the bitmask stops the correspondent data stream #define ADD_REG_STREAM_OXIMETER 34 // U8 Contains the oximeter sensor data -#define ADD_REG_STREAM_ECG 35 // U16 Contains the Ecg analog data +#define ADD_REG_STREAM_ECG 35 // U16 Contains the Ecg analog data & external Analog_In[0] #define ADD_REG_STREAM_GSR 36 // U16 Contains the GSR analog data #define ADD_REG_STREAM_MOTION 37 // U8 Contains the motion sensor index #define ADD_REG_INPUTS 38 // U8 Contains the state of the digital input @@ -82,7 +82,7 @@ typedef struct /* Memory limits */ #define APP_REGS_ADD_MIN 0x20 #define APP_REGS_ADD_MAX 0x28 -#define APP_NBYTES_OF_REG_BANK 14 +#define APP_NBYTES_OF_REG_BANK 16 /************************************************************************/ /* Registers' bits */ diff --git a/Firmware/EmotionalCities/registers.xls b/Firmware/EmotionalCities/registers.xls index 22b8fe7..fa36d9d 100644 Binary files a/Firmware/EmotionalCities/registers.xls and b/Firmware/EmotionalCities/registers.xls differ