Skip to content

Commit

Permalink
Replace some functions with macros in hopes of reducing the compiled …
Browse files Browse the repository at this point in the history
…size.

Currently getting these linker errors in Travis:
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: bootloader.elf section `.data' will not fit in region `flash'
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `flash' overflowed by 60 bytes
  • Loading branch information
emosenkis committed Nov 16, 2019
1 parent 6854814 commit ef8caad
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions targets/stm32l432/src/sense.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,15 @@ PB5 ------> Channel 2 (electrode 2)
PB6 ------> Channel 3 (sampling capacitor)
PB7 ------> Channel 4 (unused)
*/
inline int get_sampling_cap_io(void)
{
return TSC_GROUP2_IO3;
}

inline int get_sampling_cap_pin(void)
{
return LL_GPIO_PIN_6;
}

inline int get_first_electrode_io(void)
{
return TSC_GROUP2_IO1;
}

inline int get_first_electrode_pin(void)
{
return LL_GPIO_PIN_4;
}

inline int get_second_electrode_io(void)
{
return TSC_GROUP2_IO2;
}

inline int get_second_electrode_pin(void)
{
return LL_GPIO_PIN_5;
}

int unsigned get_tsc_threshold(void)
{
// Threshold for USB A nano is 45
// Threshold for USB C touch is not yet calibrated so this is a dummy value
return has_10nF_sampling_cap() ? 59 : 45;
}
#define get_sampling_cap_io() TSC_GROUP2_IO3
#define get_sampling_cap_pin() LL_GPIO_PIN_6
#define get_first_electrode_io() TSC_GROUP2_IO1
#define get_first_electrode_pin() LL_GPIO_PIN_4
#define get_second_electrode_io() TSC_GROUP2_IO2
#define get_second_electrode_pin() LL_GPIO_PIN_5
// Threshold for USB A nano is 45
// Threshold for USB C touch is not yet calibrated so this is a dummy value
#define get_tsc_threshold() (has_10nF_sampling_cap() ? 59 : 45)

void tsc_init(void)
{
Expand Down

0 comments on commit ef8caad

Please sign in to comment.