|
|
@@ -7,13 +7,13 @@ typedef struct {
|
|
|
} DTMFDolphinTonePos;
|
|
|
|
|
|
typedef struct {
|
|
|
- const char *name;
|
|
|
+ const char* name;
|
|
|
const float frequency_1;
|
|
|
const float frequency_2;
|
|
|
const DTMFDolphinTonePos pos;
|
|
|
- const uint16_t pulses; // for Redbox
|
|
|
- const uint16_t pulse_ms; // for Redbox
|
|
|
- const uint16_t gap_duration; // for Redbox
|
|
|
+ const uint16_t pulses; // for Redbox
|
|
|
+ const uint16_t pulse_ms; // for Redbox
|
|
|
+ const uint16_t gap_duration; // for Redbox
|
|
|
} DTMFDolphinTones;
|
|
|
|
|
|
typedef struct {
|
|
|
@@ -44,52 +44,48 @@ DTMFDolphinSceneData DTMFDolphinSceneDataDialer = {
|
|
|
{"0", 941.0, 1336.0, {3, 1, 1}, 0, 0, 0},
|
|
|
{"#", 941.0, 1477.0, {3, 2, 1}, 0, 0, 0},
|
|
|
{"D", 941.0, 1633.0, {3, 3, 1}, 0, 0, 0},
|
|
|
- }
|
|
|
-};
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinSceneData DTMFDolphinSceneDataBluebox = {
|
|
|
.name = "Bluebox",
|
|
|
.block = DTMF_DOLPHIN_TONE_BLOCK_BLUEBOX,
|
|
|
.tone_count = 13,
|
|
|
.tones = {
|
|
|
- {"1", 700.0, 900.0, {0, 0, 1}, 0, 0, 0},
|
|
|
- {"2", 700.0, 1100.0, {0, 1, 1}, 0, 0, 0},
|
|
|
- {"3", 900.0, 1100.0, {0, 2, 1}, 0, 0, 0},
|
|
|
- {"4", 700.0, 1300.0, {1, 0, 1}, 0, 0, 0},
|
|
|
- {"5", 900.0, 1300.0, {1, 1, 1}, 0, 0, 0},
|
|
|
- {"6", 1100.0, 1300.0, {1, 2, 1}, 0, 0, 0},
|
|
|
- {"7", 700.0, 1500.0, {2, 0, 1}, 0, 0, 0},
|
|
|
- {"8", 900.0, 1500.0, {2, 1, 1}, 0, 0, 0},
|
|
|
- {"9", 1100.0, 1500.0, {2, 2, 1}, 0, 0, 0},
|
|
|
- {"0", 1300.0, 1500.0, {3, 1, 1}, 0, 0, 0},
|
|
|
- {"KP", 1100.0, 1700.0, {0, 3, 2}, 0, 0, 0},
|
|
|
- {"ST", 1500.0, 1700.0, {1, 3, 2}, 0, 0, 0},
|
|
|
- {"2600", 2600.0, 0.0, {3, 2, 3}, 0, 0, 0},
|
|
|
- }
|
|
|
-};
|
|
|
+ {"1", 700.0, 900.0, {0, 0, 1}, 0, 0, 0},
|
|
|
+ {"2", 700.0, 1100.0, {0, 1, 1}, 0, 0, 0},
|
|
|
+ {"3", 900.0, 1100.0, {0, 2, 1}, 0, 0, 0},
|
|
|
+ {"4", 700.0, 1300.0, {1, 0, 1}, 0, 0, 0},
|
|
|
+ {"5", 900.0, 1300.0, {1, 1, 1}, 0, 0, 0},
|
|
|
+ {"6", 1100.0, 1300.0, {1, 2, 1}, 0, 0, 0},
|
|
|
+ {"7", 700.0, 1500.0, {2, 0, 1}, 0, 0, 0},
|
|
|
+ {"8", 900.0, 1500.0, {2, 1, 1}, 0, 0, 0},
|
|
|
+ {"9", 1100.0, 1500.0, {2, 2, 1}, 0, 0, 0},
|
|
|
+ {"0", 1300.0, 1500.0, {3, 1, 1}, 0, 0, 0},
|
|
|
+ {"KP", 1100.0, 1700.0, {0, 3, 2}, 0, 0, 0},
|
|
|
+ {"ST", 1500.0, 1700.0, {1, 3, 2}, 0, 0, 0},
|
|
|
+ {"2600", 2600.0, 0.0, {3, 2, 3}, 0, 0, 0},
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinSceneData DTMFDolphinSceneDataRedboxUS = {
|
|
|
.name = "Redbox (US)",
|
|
|
.block = DTMF_DOLPHIN_TONE_BLOCK_REDBOX_US,
|
|
|
.tone_count = 4,
|
|
|
.tones = {
|
|
|
- {"Nickel", 1700.0, 2200.0, {0, 0, 5}, 1, 66, 0},
|
|
|
- {"Dime", 1700.0, 2200.0, {1, 0, 5}, 2, 66, 66},
|
|
|
+ {"Nickel", 1700.0, 2200.0, {0, 0, 5}, 1, 66, 0},
|
|
|
+ {"Dime", 1700.0, 2200.0, {1, 0, 5}, 2, 66, 66},
|
|
|
{"Quarter", 1700.0, 2200.0, {2, 0, 5}, 5, 33, 33},
|
|
|
- {"Dollar", 1700.0, 2200.0, {3, 0, 5}, 1, 650, 0},
|
|
|
- }
|
|
|
-};
|
|
|
+ {"Dollar", 1700.0, 2200.0, {3, 0, 5}, 1, 650, 0},
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinSceneData DTMFDolphinSceneDataRedboxCA = {
|
|
|
.name = "Redbox (CA)",
|
|
|
.block = DTMF_DOLPHIN_TONE_BLOCK_REDBOX_CA,
|
|
|
.tone_count = 3,
|
|
|
.tones = {
|
|
|
- {"Nickel", 2200.0, 0.0, {0, 0, 5}, 1, 66, 0},
|
|
|
- {"Dime", 2200.0, 0.0, {1, 0, 5}, 2, 66, 66},
|
|
|
- {"Quarter", 2200.0, 0.0, {2, 0, 5}, 5, 33, 33},
|
|
|
- }
|
|
|
-};
|
|
|
+ {"Nickel", 2200.0, 0.0, {0, 0, 5}, 1, 66, 0},
|
|
|
+ {"Dime", 2200.0, 0.0, {1, 0, 5}, 2, 66, 66},
|
|
|
+ {"Quarter", 2200.0, 0.0, {2, 0, 5}, 5, 33, 33},
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinSceneData DTMFDolphinSceneDataRedboxUK = {
|
|
|
.name = "Redbox (UK)",
|
|
|
@@ -98,28 +94,25 @@ DTMFDolphinSceneData DTMFDolphinSceneDataRedboxUK = {
|
|
|
.tones = {
|
|
|
{"10p", 1000.0, 0.0, {0, 0, 5}, 1, 200, 0},
|
|
|
{"50p", 1000.0, 0.0, {1, 0, 5}, 1, 350, 0},
|
|
|
- }
|
|
|
-};
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinSceneData DTMFDolphinSceneDataMisc = {
|
|
|
.name = "Misc",
|
|
|
.block = DTMF_DOLPHIN_TONE_BLOCK_MISC,
|
|
|
.tone_count = 3,
|
|
|
.tones = {
|
|
|
- {"CCITT 11", 700.0, 1700.0, {0, 0, 5}, 0, 0, 0},
|
|
|
- {"CCITT 12", 900.0, 1700.0, {1, 0, 5}, 0, 0, 0},
|
|
|
+ {"CCITT 11", 700.0, 1700.0, {0, 0, 5}, 0, 0, 0},
|
|
|
+ {"CCITT 12", 900.0, 1700.0, {1, 0, 5}, 0, 0, 0},
|
|
|
{"CCITT KP2", 1300.0, 1700.0, {2, 0, 5}, 0, 0, 0},
|
|
|
- }
|
|
|
-};
|
|
|
+ }};
|
|
|
|
|
|
DTMFDolphinToneSection current_section;
|
|
|
-DTMFDolphinSceneData *current_scene_data;
|
|
|
+DTMFDolphinSceneData* current_scene_data;
|
|
|
|
|
|
void dtmf_dolphin_data_set_current_section(DTMFDolphinToneSection section) {
|
|
|
current_section = section;
|
|
|
|
|
|
- switch (current_section)
|
|
|
- {
|
|
|
+ switch(current_section) {
|
|
|
case DTMF_DOLPHIN_TONE_BLOCK_BLUEBOX:
|
|
|
current_scene_data = &DTMFDolphinSceneDataBluebox;
|
|
|
break;
|
|
|
@@ -128,7 +121,7 @@ void dtmf_dolphin_data_set_current_section(DTMFDolphinToneSection section) {
|
|
|
break;
|
|
|
case DTMF_DOLPHIN_TONE_BLOCK_REDBOX_CA:
|
|
|
current_scene_data = &DTMFDolphinSceneDataRedboxCA;
|
|
|
- break;
|
|
|
+ break;
|
|
|
case DTMF_DOLPHIN_TONE_BLOCK_REDBOX_UK:
|
|
|
current_scene_data = &DTMFDolphinSceneDataRedboxUK;
|
|
|
break;
|
|
|
@@ -145,14 +138,14 @@ DTMFDolphinToneSection dtmf_dolphin_data_get_current_section() {
|
|
|
return current_section;
|
|
|
}
|
|
|
|
|
|
-DTMFDolphinSceneData *dtmf_dolphin_data_get_current_scene_data() {
|
|
|
+DTMFDolphinSceneData* dtmf_dolphin_data_get_current_scene_data() {
|
|
|
return current_scene_data;
|
|
|
}
|
|
|
|
|
|
-bool dtmf_dolphin_data_get_tone_frequencies(float *freq1, float *freq2, uint8_t row, uint8_t col) {
|
|
|
- for (size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
+bool dtmf_dolphin_data_get_tone_frequencies(float* freq1, float* freq2, uint8_t row, uint8_t col) {
|
|
|
+ for(size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
DTMFDolphinTones tones = current_scene_data->tones[i];
|
|
|
- if (tones.pos.row == row && tones.pos.col == col) {
|
|
|
+ if(tones.pos.row == row && tones.pos.col == col) {
|
|
|
freq1[0] = tones.frequency_1;
|
|
|
freq2[0] = tones.frequency_2;
|
|
|
return true;
|
|
|
@@ -161,10 +154,15 @@ bool dtmf_dolphin_data_get_tone_frequencies(float *freq1, float *freq2, uint8_t
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-bool dtmf_dolphin_data_get_filter_data(uint16_t *pulses, uint16_t *pulse_ms, uint16_t *gap_ms, uint8_t row, uint8_t col) {
|
|
|
- for (size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
+bool dtmf_dolphin_data_get_filter_data(
|
|
|
+ uint16_t* pulses,
|
|
|
+ uint16_t* pulse_ms,
|
|
|
+ uint16_t* gap_ms,
|
|
|
+ uint8_t row,
|
|
|
+ uint8_t col) {
|
|
|
+ for(size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
DTMFDolphinTones tones = current_scene_data->tones[i];
|
|
|
- if (tones.pos.row == row && tones.pos.col == col) {
|
|
|
+ if(tones.pos.row == row && tones.pos.col == col) {
|
|
|
pulses[0] = tones.pulses;
|
|
|
pulse_ms[0] = tones.pulse_ms;
|
|
|
gap_ms[0] = tones.gap_duration;
|
|
|
@@ -175,9 +173,9 @@ bool dtmf_dolphin_data_get_filter_data(uint16_t *pulses, uint16_t *pulse_ms, uin
|
|
|
}
|
|
|
|
|
|
const char* dtmf_dolphin_data_get_tone_name(uint8_t row, uint8_t col) {
|
|
|
- for (size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
+ for(size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
DTMFDolphinTones tones = current_scene_data->tones[i];
|
|
|
- if (tones.pos.row == row && tones.pos.col == col) {
|
|
|
+ if(tones.pos.row == row && tones.pos.col == col) {
|
|
|
return tones.name;
|
|
|
}
|
|
|
}
|
|
|
@@ -185,7 +183,7 @@ const char* dtmf_dolphin_data_get_tone_name(uint8_t row, uint8_t col) {
|
|
|
}
|
|
|
|
|
|
const char* dtmf_dolphin_data_get_current_section_name() {
|
|
|
- if (current_scene_data) {
|
|
|
+ if(current_scene_data) {
|
|
|
return current_scene_data->name;
|
|
|
}
|
|
|
return NULL;
|
|
|
@@ -195,27 +193,26 @@ void dtmf_dolphin_tone_get_max_pos(uint8_t* max_rows, uint8_t* max_cols, uint8_t
|
|
|
max_rows[0] = 0;
|
|
|
max_cols[0] = 0;
|
|
|
max_span[0] = 0;
|
|
|
- uint8_t tmp_rowspan[5] = { 0, 0, 0, 0, 0 };
|
|
|
- for (size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
+ uint8_t tmp_rowspan[5] = {0, 0, 0, 0, 0};
|
|
|
+ for(size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
DTMFDolphinTones tones = current_scene_data->tones[i];
|
|
|
- if (tones.pos.row > max_rows[0]) {
|
|
|
+ if(tones.pos.row > max_rows[0]) {
|
|
|
max_rows[0] = tones.pos.row;
|
|
|
}
|
|
|
- if (tones.pos.col > max_cols[0]) {
|
|
|
+ if(tones.pos.col > max_cols[0]) {
|
|
|
max_cols[0] = tones.pos.col;
|
|
|
}
|
|
|
tmp_rowspan[tones.pos.row] += tones.pos.span;
|
|
|
- if (tmp_rowspan[tones.pos.row] > max_span[0])
|
|
|
- max_span[0] = tmp_rowspan[tones.pos.row];
|
|
|
+ if(tmp_rowspan[tones.pos.row] > max_span[0]) max_span[0] = tmp_rowspan[tones.pos.row];
|
|
|
}
|
|
|
max_rows[0]++;
|
|
|
max_cols[0]++;
|
|
|
}
|
|
|
|
|
|
uint8_t dtmf_dolphin_get_tone_span(uint8_t row, uint8_t col) {
|
|
|
- for (size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
+ for(size_t i = 0; i < current_scene_data->tone_count; i++) {
|
|
|
DTMFDolphinTones tones = current_scene_data->tones[i];
|
|
|
- if (tones.pos.row == row && tones.pos.col == col) {
|
|
|
+ if(tones.pos.row == row && tones.pos.col == col) {
|
|
|
return tones.pos.span;
|
|
|
}
|
|
|
}
|