generated from TDD-Templates/cmake_cpputest_template_avr
changed BP to SS for switch state.
This commit is contained in:
parent
be2f259118
commit
6b3b564f62
|
@ -26,10 +26,10 @@
|
||||||
#define START_PATTERN 0xAA
|
#define START_PATTERN 0xAA
|
||||||
#define END_PATTERN 0x55
|
#define END_PATTERN 0x55
|
||||||
|
|
||||||
//Addresses in the eeprom for the two bypasses
|
//Addresses in the eeprom for the two switch states
|
||||||
#define ROM_SP_ADR 0x0
|
#define ROM_SP_ADR 0x0
|
||||||
#define ROM_BP1_ADR 0x1
|
#define ROM_SS1_ADR 0x1
|
||||||
#define ROM_BP2_ADR 0x2
|
#define ROM_SS2_ADR 0x2
|
||||||
#define ROM_EP_ADR 0x3
|
#define ROM_EP_ADR 0x3
|
||||||
|
|
||||||
//Debounce check number.
|
//Debounce check number.
|
||||||
|
|
|
@ -95,12 +95,12 @@ void init_prog(void)
|
||||||
//Checks against a bit pattern we defined to represent the start of data.
|
//Checks against a bit pattern we defined to represent the start of data.
|
||||||
if(eeprom_read_byte((uint8_t *)ROM_SP_ADR) == START_PATTERN) {
|
if(eeprom_read_byte((uint8_t *)ROM_SP_ADR) == START_PATTERN) {
|
||||||
//Reads the two bytes representing the two states.
|
//Reads the two bytes representing the two states.
|
||||||
btn1.is_active = eeprom_read_byte((uint8_t *)ROM_BP1_ADR);
|
btn1.is_active = eeprom_read_byte((uint8_t *)ROM_SS1_ADR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//otherwise we write the init values for the start pattern and states.
|
//otherwise we write the init values for the start pattern and states.
|
||||||
eeprom_write_byte((uint8_t *)ROM_SP_ADR, START_PATTERN);
|
eeprom_write_byte((uint8_t *)ROM_SP_ADR, START_PATTERN);
|
||||||
eeprom_write_byte((uint8_t *)ROM_BP1_ADR, 0x0);
|
eeprom_write_byte((uint8_t *)ROM_SS1_ADR, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
btn1.is_pressed = ((PINB & (1<<btn1.input_pin)) == 0);
|
btn1.is_pressed = ((PINB & (1<<btn1.input_pin)) == 0);
|
||||||
|
@ -110,12 +110,12 @@ void init_prog(void)
|
||||||
/*
|
/*
|
||||||
if(btn1.is_pressed){
|
if(btn1.is_pressed){
|
||||||
btn1.is_active = ! btn1.is_active;
|
btn1.is_active = ! btn1.is_active;
|
||||||
eeprom_write_byte((uint8_t *)ROM_BP1_ADR, btn1.is_active);
|
eeprom_write_byte((uint8_t *)ROM_SS1_ADR, btn1.is_active);
|
||||||
blink_bypass1();
|
blink_bypass1();
|
||||||
}
|
}
|
||||||
if(btn2.is_pressed){
|
if(btn2.is_pressed){
|
||||||
btn2.is_active = ! btn2.is_active;
|
btn2.is_active = ! btn2.is_active;
|
||||||
eeprom_write_byte((uint8_t *)ROM_BP2_ADR, btn2.is_active);
|
eeprom_write_byte((uint8_t *)ROM_SS2_ADR, btn2.is_active);
|
||||||
blink_bypass2();
|
blink_bypass2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue