Open FFBoard
Open source force feedback firmware
Loading...
Searching...
No Matches
flash_helpers.h File Reference

Go to the source code of this file.

Functions

bool Flash_Init ()
 
bool Flash_Write (uint16_t adr, uint16_t dat)
 
bool Flash_Read (uint16_t adr, uint16_t *buf, bool checkempty=true)
 
bool Flash_ReadWriteDefault (uint16_t adr, uint16_t *buf, uint16_t def)
 
void Flash_Dump (std::vector< std::tuple< uint16_t, uint16_t > > *result, bool includeAll=false)
 
bool Flash_Format ()
 
bool OTP_Write (uint16_t adroffset, uint64_t dat)
 
bool OTP_Read (uint16_t adroffset, uint64_t *dat)
 
template<typename TVal>
TVal Flash_ReadDefault (uint16_t adr, TVal def)
 
uint16_t pack (uint8_t hb, uint8_t lb)
 
std::tuple< uint8_t, uint8_t > unpack (uint16_t v)
 
void Flash_Write_Defaults ()
 

Variables

const std::span< const std::pair< uint16_t, uint16_t > > flash_factory_defaults
 

Function Documentation

◆ Flash_Dump()

void Flash_Dump ( std::vector< std::tuple< uint16_t, uint16_t > > * result,
bool includeAll = false )

Definition at line 268 of file flash_helpers.cpp.

◆ Flash_Format()

__weak bool Flash_Format ( )

Erases the whole EEPROM to its default value

Definition at line 220 of file flash_helpers.cpp.

◆ Flash_Init()

__weak bool Flash_Init ( )

Called after startup

Definition at line 241 of file flash_helpers.cpp.

◆ Flash_Read()

bool Flash_Read ( uint16_t adr,
uint16_t * buf,
bool checkempty )

Reads a value and if checkempty is true returns false if the read value is the erased value (0xffff) or not found

Definition at line 213 of file flash_helpers.cpp.

◆ Flash_ReadDefault()

template<typename TVal>
TVal Flash_ReadDefault ( uint16_t adr,
TVal def )
inline

Definition at line 40 of file flash_helpers.h.

◆ Flash_ReadWriteDefault()

__weak bool Flash_ReadWriteDefault ( uint16_t adr,
uint16_t * buf,
uint16_t def )

Definition at line 204 of file flash_helpers.cpp.

◆ Flash_Write()

__weak bool Flash_Write ( uint16_t adr,
uint16_t dat )

Definition at line 201 of file flash_helpers.cpp.

◆ Flash_Write_Defaults()

void Flash_Write_Defaults ( )

Writes factory default values to flash. Does nothing if no defaults are defined

Definition at line 380 of file flash_helpers.cpp.

◆ OTP_Read()

__weak bool OTP_Read ( uint16_t adroffset,
uint64_t * dat )

Definition at line 342 of file flash_helpers.cpp.

◆ OTP_Write()

__weak bool OTP_Write ( uint16_t adroffset,
uint64_t dat )

Definition at line 329 of file flash_helpers.cpp.

◆ pack()

uint16_t pack ( uint8_t hb,
uint8_t lb )
inline

Definition at line 48 of file flash_helpers.h.

◆ unpack()

std::tuple< uint8_t, uint8_t > unpack ( uint16_t v)
inline

Definition at line 52 of file flash_helpers.h.

Variable Documentation

◆ flash_factory_defaults

const std::span<const std::pair<uint16_t,uint16_t> > flash_factory_defaults
extern

Definition at line 374 of file flash_helpers.cpp.