Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Go to the source code of this file.
Classes | |
struct | cs_state_data_t |
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9, 2019 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed) More... | |
Enumerations | |
enum class | PersistenceMode : uint8_t { FLASH , RAM , FIRMWARE_DEFAULT , STRATEGY1 , NEITHER_RAM_NOR_FLASH } |
Store values in FLASH or RAM. More... | |
Functions | |
cs_ret_code_t | getDefault (cs_state_data_t &data, const boards_config_t &boardsConfig) |
Gets the default. More... | |
PersistenceModeGet | toPersistenceModeGet (uint8_t mode) |
PersistenceModeSet | toPersistenceModeSet (uint8_t mode) |
PersistenceMode | DefaultLocation (CS_TYPE const &type) |
|
strong |
Store values in FLASH or RAM.
Load values from FIRMWARE_DEFAULT, FLASH or RAM.
NOTE. Suppose we have a new firmware available and we definitely want to use a new FIRMWARE_DEFAULT value. For example, we use more peripherals and need to have a CONFIG_BOOT_DELAY that is higher or else it will be in an infinite reboot loop. Before we upload the new firmware to the Crownstone, we need to explicitly clear the value. Only after we have deleted the FLASH record we can upload the new firmware. Then the new FIRMWARE_DEFAULT is used automatically.
Enumerator | |
---|---|
FLASH | |
RAM | |
FIRMWARE_DEFAULT | |
STRATEGY1 | |
NEITHER_RAM_NOR_FLASH |
PersistenceMode DefaultLocation | ( | CS_TYPE const & | type | ) |
cs_ret_code_t getDefault | ( | cs_state_data_t & | data, |
const boards_config_t & | boardsConfig | ||
) |
Gets the default.
Note that if data.value is not aligned at a word boundary, the result still isn't.
There is no allocation done in this function. It is assumed that data.value points to an array or single variable that needs to be written. The allocation of strings or arrays is limited by TypeSize which in that case can be considered as MaxTypeSize.
This function does not check if data size fits the default value. TODO: check how to check this at compile time.
PersistenceModeGet toPersistenceModeGet | ( | uint8_t | mode | ) |
PersistenceModeSet toPersistenceModeSet | ( | uint8_t | mode | ) |