mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-07-24 07:20:41 -04:00
Add BLE driver for NRF52
This commit is contained in:
parent
6e8865b2ae
commit
80769f1101
4 changed files with 173 additions and 3 deletions
18
Utilities.h
18
Utilities.h
|
@ -1207,9 +1207,17 @@ void eeprom_update(int mapped_addr, uint8_t byte) {
|
|||
written_bytes = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
|
||||
void eeprom_flush() {
|
||||
// sync file contents to flash
|
||||
file.close();
|
||||
file.open(EEPROM_FILE, FILE_O_WRITE);
|
||||
written_bytes = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void eeprom_write(uint8_t addr, uint8_t byte) {
|
||||
if (!eeprom_info_locked() && addr >= 0 && addr < EEPROM_RESERVED) {
|
||||
eeprom_update(eeprom_addr(addr), byte);
|
||||
|
@ -1344,8 +1352,16 @@ bool eeprom_checksum_valid() {
|
|||
void bt_conf_save(bool is_enabled) {
|
||||
if (is_enabled) {
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_BT), BT_ENABLE_BYTE);
|
||||
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
|
||||
// have to do a flush because we're only writing 1 byte and it syncs after 8
|
||||
eeprom_flush();
|
||||
#endif
|
||||
} else {
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_BT), 0x00);
|
||||
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
|
||||
// have to do a flush because we're only writing 1 byte and it syncs after 8
|
||||
eeprom_flush();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue