added initial flash wrapper implementation

This commit is contained in:
Lars Wilko Sentse
2024-01-24 14:38:15 +01:00
parent e249963b4b
commit 65155392be
2 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/*
* flash.hpp
*
* Created on: Jan 24, 2024
* Author: Lars Wilko Sentse
*/
#ifndef STA_CORE_FLASH_HPP
#define STA_CORE_FLASH_HPP
#include <limits>
// Only enable module on STM32 platform w/ HAL GPIO module enabled
#include <sta/config.hpp>
#ifdef STA_PLATFORM_STM32
# include <sta/devices/stm32/hal.hpp>
#endif // STA_PLATFORM_STM32
#include <sta/debug/debug.hpp>
namespace sta
{
class Flash{
public:
Flash() = delete;
static uint32_t flash_write_word(uint32_t address, uint32_t data, bool erase_sector);
static uint32_t flash_read_word(uint32_t address);
static uint32_t flash_erase_sectors(uint32_t sector, uint32_t num_sectors);
static uint32_t flash_get_sector(uint32_t address);
};
}//namespace sta
#endif //STA_CORE_FLASH_HPP