51 lines
669 B
C++
51 lines
669 B
C++
|
|
#pragma once
|
|
|
|
template <int P, bool v>
|
|
struct Checker {
|
|
static constexpr bool value = v;
|
|
};
|
|
|
|
namespace entry {
|
|
|
|
enum Type : uint8_t {
|
|
stop = 0,
|
|
config = 1,
|
|
set = 2,
|
|
set_ts = 3,
|
|
clear = 4,
|
|
clear_ts = 5,
|
|
};
|
|
|
|
enum NextType {
|
|
nt_none,
|
|
nt_tone,
|
|
};
|
|
|
|
struct Tone {
|
|
uint8_t index;
|
|
uint8_t amplitude;
|
|
uint16_t frequency;
|
|
uint8_t mode;
|
|
};
|
|
|
|
inline size_t get_size(Type type) {
|
|
switch(type) {
|
|
case Type::stop:
|
|
default:
|
|
return 1;
|
|
case Type::config:
|
|
return 8;
|
|
case Type::set:
|
|
return 3;
|
|
case Type::set_ts:
|
|
return 5;
|
|
case Type::clear:
|
|
return 1;
|
|
case Type::clear_ts:
|
|
return 3;
|
|
}
|
|
}
|
|
};
|
|
|