raspikeyer/src/settings.h

19 lines
566 B
C
Raw Normal View History

2024-02-16 21:05:25 +01:00
#pragma once
2024-02-06 22:11:58 +01:00
2024-02-09 12:20:30 +01:00
#include "pico/flash.h"
2024-02-06 22:11:58 +01:00
2024-02-21 10:43:50 +01:00
const uint16_t MAGIC_NUMBER = 3;
2024-02-07 11:25:38 +01:00
2024-02-20 15:24:51 +01:00
enum class Mode : uint8_t { IambicA = 0, IambicB, Straight };
2024-02-06 22:11:58 +01:00
2024-02-16 20:56:03 +01:00
struct Settings {
2024-02-19 12:10:42 +01:00
uint16_t magic_number {MAGIC_NUMBER}; // Bytes: 2
2024-02-20 15:24:51 +01:00
Mode mode {Mode::IambicB}; // Bytes: 1
2024-02-21 10:43:50 +01:00
uint8_t wpm {0}; // Bytes: 1
uint8_t wpmPotiMin {5}; // Bytes: 1
uint8_t wpmPotiMax {55}; // Bytes: 1
uint8_t dummy[FLASH_PAGE_SIZE - 6] {0}; // Sum : 6
2024-02-06 22:11:58 +01:00
};
void store_settings(Settings &settings);
2024-02-16 21:05:25 +01:00
Settings read_settings();