36#ifndef _FREERTOS_DRIVER_TI_TIVAEEPROMBITSET_HXX_
37#define _FREERTOS_DRIVER_TI_TIVAEEPROMBITSET_HXX_
39#include "driverlib/rom.h"
40#include "driverlib/rom_map.h"
42#include "driverlib/eeprom.h"
43#include "driverlib/sysctl.h"
47template <
unsigned USER_BIT_COUNT,
unsigned BITS_PER_CELL = 27>
57 HASSERT((block_start % block_count) == 0);
58 MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
61 auto r = MAP_EEPROMInit();
62 if (r == EEPROM_INIT_OK)
64 MAP_SysCtlDelay(100000);
66 auto num_blocks = MAP_EEPROMBlockCountGet();
67 HASSERT(block_start + block_count < num_blocks);
68 uint32_t total_size = MAP_EEPROMSizeGet();
71 HASSERT(total_size / num_blocks == 64);
80 static constexpr unsigned virtual_cell_count()
85 unsigned physical_cell_count()
90 void write_cell(
unsigned cell_offset, eeprom_t value)
92 MAP_EEPROMProgram(&value,
get_address(cell_offset), 4);
95 eeprom_t read_cell(
unsigned cell_offset)
108 address = EEPROMAddrFromBlock(address);
109 address += (cell_offset << 2);
Template of how the HW class should look like.
uint32_t get_address(unsigned cell_offset)
static constexpr unsigned bits_per_cell()
uint8_t blockStart_
Number of the first block for our data.
TivaEEPROMHwDefs(uint8_t block_start, uint8_t block_count)
For the Tiva 123 use block_count as multiple of 2, for Tiva 129 use multiple of 8.
uint8_t blockCount_
Number of the blocks of 16 words each to use for our data.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.