Skip to content

Commit

Permalink
Merge pull request #12 from emotional-cities/fw-first-release
Browse files Browse the repository at this point in the history
First release of firmware
  • Loading branch information
filcarv authored Apr 25, 2023
2 parents eb270b5 + f2de1c7 commit 802e637
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 66 deletions.
145 changes: 91 additions & 54 deletions Firmware/EmotionalCities/Pluma.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
<eraseonlaunchrule>1</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.47.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.39.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>
<avrtoolserialnumber>J42700004639</avrtoolserialnumber>
<avrtoolserialnumber>J42700046659</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x1E9541</avrdeviceexpectedsignature>
<avrtoolinterface>PDI</avrtoolinterface>
<com_atmel_avrdbg_tool_atmelice>
Expand All @@ -52,7 +52,7 @@
<InterfaceName>PDI</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
<ToolNumber>J42700004639</ToolNumber>
<ToolNumber>J42700046659</ToolNumber>
<ToolName>Atmel-ICE</ToolName>
</com_atmel_avrdbg_tool_atmelice>
<avrtoolinterfaceclock>4000000</avrtoolinterfaceclock>
Expand All @@ -69,54 +69,9 @@
</ToolNumber>
<ToolName>Custom Programming Tool</ToolName>
</custom>
<ExternalProgrammingToolCommand />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libATxmega32A4U-1.9.a</Value>
<Value>_libATxmega32A4U-1.9.a</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.linker.libraries.LibrarySearchPaths>
<ListValues>
<Value>G:\My Drive\projects\Emotional Cities\_fw&amp;sw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities</Value>
<Value>G:\My Drive\projects\Emotional_Cities_to_workkk\_fw&amp;sw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities</Value>
<Value>G:\My Drive\projects\Emotional_Cities_to_workkk\_fw\EmotionalCities_fw ATXMEGA32A4U\EmotionalCities</Value>
</ListValues>
</avrgcc.linker.libraries.LibrarySearchPaths>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u"</avrgcc.common.Device>
Expand All @@ -129,7 +84,7 @@
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
Expand All @@ -138,10 +93,9 @@
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
Expand All @@ -158,23 +112,92 @@
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atxmega32a4u -B "%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega32a4u"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>..</Value>
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libATxmega32A4U-1.9.a</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.linker.libraries.LibrarySearchPaths>
<ListValues>
<Value>..</Value>
</ListValues>
</avrgcc.linker.libraries.LibrarySearchPaths>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\XMEGAA_DFP\1.1.68\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="app.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="app.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="app_funcs.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="app_funcs.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="app_ios_and_regs.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="app_ios_and_regs.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="cpu.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="hwbp_core.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="hwbp_core_regs.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="hwbp_core_types.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c_MotionSens_bno055.c">
<SubType>compile</SubType>
</Compile>
Expand All @@ -184,12 +207,26 @@
<Compile Include="i2c_oximeter_MAX220.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c_oximeter_MAX220.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c_timing.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="i2c_user.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="interrupts.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="desktop.ini">
<SubType>compile</SubType>
</None>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>
17 changes: 13 additions & 4 deletions Firmware/EmotionalCities/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}
}
Expand Down
5 changes: 3 additions & 2 deletions Firmware/EmotionalCities/app_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions Firmware/EmotionalCities/app_ios_and_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -96,7 +96,7 @@ uint16_t app_regs_n_elements[] = {
1,
1,
4,
1,
2,
1,
1,
1,
Expand All @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions Firmware/EmotionalCities/app_ios_and_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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 */
Expand Down
Binary file modified Firmware/EmotionalCities/registers.xls
Binary file not shown.

0 comments on commit 802e637

Please sign in to comment.