2024-08-19 22:43:24 +10:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-08-25 13:55:43 +10:00
|
|
|
template <int P, bool v>
|
|
|
|
struct Checker {
|
|
|
|
static constexpr bool value = v;
|
|
|
|
};
|
|
|
|
|
2024-08-19 22:43:24 +10:00
|
|
|
namespace entry {
|
|
|
|
|
2024-08-25 13:55:43 +10:00
|
|
|
enum Type : uint8_t {
|
2024-10-03 02:27:58 +10:00
|
|
|
stop = 0,
|
|
|
|
config = 1,
|
|
|
|
set = 2,
|
|
|
|
set_ts = 3,
|
|
|
|
clear = 4,
|
|
|
|
clear_ts = 5,
|
2024-08-25 13:55:43 +10:00
|
|
|
};
|
|
|
|
|
2024-09-30 23:25:16 +10:00
|
|
|
enum NextType {
|
|
|
|
nt_none,
|
|
|
|
nt_tone,
|
2024-08-19 22:43:24 +10:00
|
|
|
};
|
2024-09-30 23:25:16 +10:00
|
|
|
|
|
|
|
struct Tone {
|
2024-08-19 22:43:24 +10:00
|
|
|
uint8_t index;
|
2024-09-30 23:25:16 +10:00
|
|
|
uint8_t amplitude;
|
2024-08-19 22:43:24 +10:00
|
|
|
uint16_t frequency;
|
2024-10-03 02:27:58 +10:00
|
|
|
uint8_t mode;
|
2024-08-19 22:43:24 +10:00
|
|
|
};
|
2024-08-25 13:55:43 +10:00
|
|
|
|
|
|
|
inline size_t get_size(Type type) {
|
|
|
|
switch(type) {
|
2024-10-03 22:42:51 +10:00
|
|
|
case Type::stop:
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
case Type::config:
|
|
|
|
return 8;
|
2024-08-25 13:55:43 +10:00
|
|
|
case Type::set:
|
|
|
|
return 3;
|
|
|
|
case Type::set_ts:
|
|
|
|
return 5;
|
2024-10-03 22:42:51 +10:00
|
|
|
case Type::clear:
|
2024-08-25 13:55:43 +10:00
|
|
|
return 1;
|
2024-10-03 22:42:51 +10:00
|
|
|
case Type::clear_ts:
|
|
|
|
return 3;
|
2024-08-25 13:55:43 +10:00
|
|
|
}
|
|
|
|
}
|
2024-08-19 22:43:24 +10:00
|
|
|
};
|
|
|
|
|