2024-02-06 22:11:58 +01:00
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
|
|
|
|
2024-02-09 12:20:30 +01:00
|
|
|
#include "pico/flash.h"
|
2024-02-06 22:11:58 +01:00
|
|
|
|
2024-02-07 11:25:38 +01:00
|
|
|
const uint16_t MAGIC_NUMBER = 2;
|
|
|
|
|
2024-02-07 11:15:41 +01:00
|
|
|
enum class Mode : uint8_t
|
2024-02-06 22:11:58 +01:00
|
|
|
{
|
2024-02-07 11:15:41 +01:00
|
|
|
IAMBIC_A = 0,
|
2024-02-06 22:11:58 +01:00
|
|
|
IAMBIC_B,
|
|
|
|
// ULTIMATE
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Settings
|
|
|
|
{
|
2024-02-07 11:35:30 +01:00
|
|
|
uint16_t magic_number{MAGIC_NUMBER}; // Bytes: 2
|
2024-02-07 11:25:38 +01:00
|
|
|
Mode mode{Mode::IAMBIC_B}; // Bytes: 1
|
2024-02-12 14:10:04 +01:00
|
|
|
uint8_t wpm{18}; // Bytes: 1
|
2024-02-07 11:25:38 +01:00
|
|
|
uint8_t dummy[FLASH_PAGE_SIZE - 4]{0}; // Sum : 4
|
2024-02-06 22:11:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void store_settings(Settings &settings);
|
2024-02-07 09:32:11 +01:00
|
|
|
Settings read_settings();
|
2024-02-06 22:11:58 +01:00
|
|
|
|
|
|
|
#endif
|