changed BP to SS for switch state.

This commit is contained in:
Jake Goodwin 2025-02-10 14:38:14 -08:00
parent be2f259118
commit 6b3b564f62
2 changed files with 7 additions and 7 deletions

View File

@ -26,10 +26,10 @@
#define START_PATTERN 0xAA
#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_BP1_ADR 0x1
#define ROM_BP2_ADR 0x2
#define ROM_SS1_ADR 0x1
#define ROM_SS2_ADR 0x2
#define ROM_EP_ADR 0x3
//Debounce check number.

View File

@ -95,12 +95,12 @@ void init_prog(void)
//Checks against a bit pattern we defined to represent the start of data.
if(eeprom_read_byte((uint8_t *)ROM_SP_ADR) == START_PATTERN) {
//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 {
//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_BP1_ADR, 0x0);
eeprom_write_byte((uint8_t *)ROM_SS1_ADR, 0x0);
}
btn1.is_pressed = ((PINB & (1<<btn1.input_pin)) == 0);
@ -110,12 +110,12 @@ void init_prog(void)
/*
if(btn1.is_pressed){
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();
}
if(btn2.is_pressed){
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();
}