mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 16:36:03 +08:00
Change debounce state tables to be defined as constant. (#386)
Currently these state tables are being defined in the data section of RAM. As these tables are unchanged, this change allows them to be placed in the text section instead. As they are function local objects, they also get lazy initialized causing references to the dynamic shared object which are unnecessary.
This commit is contained in:
parent
2b2a542aa1
commit
7212856424
@ -132,7 +132,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets the next state based on the inputs.
|
||||
//*************************************************************************
|
||||
void get_next(bool sample, bool condition_set, bool condition_clear, uint_least8_t state_table[][2])
|
||||
void get_next(bool sample, bool condition_set, bool condition_clear, const uint_least8_t state_table[][2])
|
||||
{
|
||||
int index1 = ((flags & STATE) * 2) + (sample ? 1 : 0);
|
||||
int index2 = (sample ? (condition_set ? 0 : 1) : (condition_clear ? 0 : 1));
|
||||
@ -182,7 +182,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void set_state(bool sample, bool condition_set, bool condition_clear)
|
||||
{
|
||||
static uint_least8_t state_table[4][2] =
|
||||
static ETL_CONSTANT uint_least8_t state_table[4][2] =
|
||||
{
|
||||
/* OFF 0 */{ debounce_base::OFF, debounce_base::OFF },
|
||||
/* OFF 1 */{ debounce_base::ON, debounce_base::OFF },
|
||||
@ -260,7 +260,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void set_state(bool sample, bool condition_set, bool condition_clear)
|
||||
{
|
||||
static uint_least8_t state_table[6][2] =
|
||||
static ETL_CONSTANT uint_least8_t state_table[6][2] =
|
||||
{
|
||||
/* OFF 0 */{ debounce_base::OFF, debounce_base::OFF },
|
||||
/* OFF 1 */{ debounce_base::ON, debounce_base::OFF },
|
||||
@ -347,7 +347,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void set_state(bool sample, bool condition_set, bool condition_clear)
|
||||
{
|
||||
static uint_least8_t state_table[8][2] =
|
||||
static ETL_CONSTANT uint_least8_t state_table[8][2] =
|
||||
{
|
||||
/* OFF 0 */{ debounce_base::OFF, debounce_base::OFF },
|
||||
/* OFF 1 */{ debounce_base::ON, debounce_base::OFF },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user