OOK transmit is mostly working, bit durations are wrong

Simplified messages carrying data (uses shared_memory instead)
Added SymField widget (bitfield, symbol field...)
Added some space for baseband code
BMP palette loading bugfix
This commit is contained in:
furrtek 2016-08-06 08:49:45 +02:00
parent a9a3bbe96d
commit 38e506a108
30 changed files with 588 additions and 411 deletions

View file

@ -28,6 +28,8 @@
namespace ui {
#define ENC_TYPES_COUNT 13
class EncodersView : public View {
public:
EncodersView(NavigationView& nav);
@ -41,97 +43,179 @@ public:
private:
struct encoder_def_t {
uint8_t bit_states;
uint16_t clk_per_bit;
uint16_t clk_per_symbol;
std::string name;
uint8_t address_bit_states; // Often 0, 1, [f, [4]]
uint8_t data_bit_states; // Often 0, 1
uint16_t clk_per_bit; // Oscillator periods per bit
uint16_t clk_per_symbol; // Oscillator periods per bit fragment
std::vector<std::string> bit_format;
uint8_t word_length;
uint8_t word_length; // Total # of bits
std::string word_def;
std::string word_format;
std::string sync;
uint32_t default_frequency;
std::string sync; // Like bit_format
uint32_t default_frequency; // Default encoder clk frequency
uint8_t repeat_min;
uint32_t pause_symbols;
};
// S = Sync
// 0~9 A~J = Address/data bits
const encoder_def_t encoder_defs[11] = {
// PT2260: Data bits can only be 0 or 1 !
{ 3, 1024, 128,
// 0~9 A~R = Address/data bits
const encoder_def_t encoder_defs[ENC_TYPES_COUNT] = {
// PT2260
{
"xx2260",
3, 2,
1024, 128,
{ "10001000", "11101110", "10001110" },
12, "0123456789ABS", "AAAAAAAAAADD",
"10000000000000000000000000000000",
200000, 1 },
200000, 1,
10 // ?
},
// PT2262
{ 3, 32, 4,
{
"xx2262",
3, 2,
32, 4,
{ "10001000", "11101110", "10001110" },
12, "0123456789ABS", "AAAAAAAAADDD",
12, "0123456789ABS", "AAAAAADDDDDD",
"10000000000000000000000000000000",
30000, 4 },
30000, 4,
10 // ?
},
// 16bit?
{
"16bit?",
2, 2,
32, 8,
{ "1110", "1000" }, // Opposite ?
16, "0123456789ABCDEFS", "AAAAAAAAAAAAAAAA",
"10000000000000000000000000000000",
114000, 50,
10 // ?
},
// RT1527
{
"xx1527",
2, 2,
128, 32,
{ "1000", "1110" },
12, "0123456789ABS", "AAAAAAAADD",
"10000000000000000000000000000000",
100000, 4,
10 // ?
},
// HK526E
{ 2, 24, 8,
{
"xx526 ",
2, 2,
24, 8,
{ "110", "100" },
12, "0123456789AB", "AAAAAAAAAAAA",
12, "0123456789AB", "AAAAAAAADDDD",
"",
20000, 4 },
20000, 4,
10 // ?
},
// HT12E
{ 2, 3, 1,
{
"xx12E ",
2, 2,
3, 1,
{ "011", "001" },
12, "S0123456789AB", "AAAAAAAADDDD",
"0000000000000000000000000000000000001",
3000, 4 },
3000, 4,
10 // ?
},
// VD5026 13 bits ?
{ 4, 128, 8,
{
"xx5026",
4, 4,
128, 8,
{ "1000000010000000", "1111111011111110", "1111111010000000", "1000000011111110" },
12, "S0123456789AB", "AAAAAAAADDDD",
"000000000000000000000000000000000000000000000001", // ?
100000, 4 },
100000, 4,
10 // ?
},
// UM3750
{ 2, 96, 32,
{
"UM3750",
2, 2,
96, 32,
{ "011", "001" },
12, "S0123456789AB", "AAAAAAAAAAAA",
"1",
100000, 4 },
100000, 4,
10 // ?
},
// UM3758
{ 3, 96, 16,
{
"UM3758",
3, 2,
96, 16,
{ "011011", "001001", "011001" },
18, "S0123456789ABCDEFGH", "AAAAAAAAAADDDDDDDD",
"1",
160000, 4 },
160000, 4,
10 // ?
},
// BA5104
{ 2, 3072, 768,
{
"BA5104",
2, 2,
3072, 768,
{ "1000", "1110" },
9, "S012345678", "DDAAAAAAA",
"",
455000, 4 },
455000, 4,
10 // ?
},
// MC145026
{ 3, 16, 1,
{
"145026",
3, 2,
16, 1,
{ "0111111101111111", "0100000001000000", "0111111101000000" },
9, "S012345678", "AAAAADDDD",
"000000000000000000",
455000, 2 },
455000, 2,
10 // ?
},
// HT6xxx
{ 3, 198, 33,
{
"HT6xxx",
3, 2,
198, 33,
{ "011011", "001001", "001011" },
18, "S0123456789ABCDEFGH", "AAAAAAAAAAAADDDDDD",
"0000000000000000000000000000000000001011001011001",
100000, 3 },
100000, 3,
10 // ?
},
// TC9148
{ 2, 48, 12,
{
"TC9148",
2, 2,
48, 12,
{ "1000", "1110", },
12, "0123456789AB", "DDDDDDDDDDDD",
"",
455000, 3 }
455000, 3,
10 // ?
}
};
enum tx_modes {
@ -140,6 +224,7 @@ private:
SCAN
};
Painter * painter_;
uint8_t enc_type = 0;
const encoder_def_t * encoder_def;
tx_modes tx_mode = IDLE;
@ -151,6 +236,7 @@ private:
//rf::Frequency f;
uint8_t repeat_index;
void draw_waveform();
void on_bitfield();
void on_type_change(size_t index);
void generate_frame();
@ -158,17 +244,6 @@ private:
void start_tx(const bool scan);
void on_txdone(int n);
radio::Configuration ook_radio_config = {
0,
2280000,
2500000, // ?
rf::Direction::Transmit,
true,
0,
0,
1,
};
const Style style_val {
.font = font::fixed_8x16,
.background = Color::green(),
@ -191,7 +266,11 @@ private:
.foreground = Color::blue(),
};
std::array<NumberField, 18> bitfields;
SymField bitfield {
{ 16 + 8, 80 },
12,
{ 0, 1 }
};
Text text_enctype {
{ 2 * 8, 3 * 8, 8 * 8, 16 },
@ -199,19 +278,8 @@ private:
};
OptionsField options_enctype {
{ 2 * 8, 5 * 8 },
8,
6,
{
{ "PT2260 ", 0 },
{ "PT2262 ", 1 },
{ "HK526E ", 2 },
{ "HT12E ", 3 },
{ "VD5026 ", 4 },
{ "UM3750 ", 5 },
{ "UM3758 ", 6 },
{ "BA5104 ", 7 },
{ "MC145026", 8 },
{ "HT6xxx ", 9 },
{ "TC9148 ", 10 }
}
};
@ -267,8 +335,8 @@ private:
{ 2 * 8, 8 * 8, 5 * 8, 16 },
"Word:"
};
Text text_format_a;
Text text_format_d;
//Text text_format_a; // DEBUG
//Text text_format_d; // DEBUG
Text text_waveform {
{ 1 * 8, 16 * 8, 9 * 8, 16 },