more speaker driver updates

This commit is contained in:
2025-03-26 04:56:57 -05:00
parent cc8dcfacb3
commit 41113ccafe
17 changed files with 64 additions and 31 deletions
+2 -2
View File
@@ -286,8 +286,8 @@ bool get_switch_flipped(SwitchKey* switch_) {
*switch_ = (SwitchKey) i;
}
// clear bit
button_pressed &= ~bit_selector;
button_released &= ~bit_selector;
switch_flipped_up &= ~bit_selector;
switch_flipped_down &= ~bit_selector;
return true;
}
}
+1 -1
View File
@@ -20,7 +20,7 @@
#define SPEAKER_PIN_DOUT GPIO_NUM_3
#define SAMPLE_RATE 44100
// The maximum number of clips that can be queued at one time.
#define CLIP_QUEUE_SIZE 8
#define CLIP_QUEUE_SIZE 64
extern i2s_chan_handle_t tx_chan;
+23 -10
View File
@@ -13,18 +13,31 @@ void init_sseg() {
ESP_LOGI(TAG, "Sseg initialized!");
}
void set_game_sseg_raw(const uint8_t* digits) {
sseg->setSegments(digits[0], 0);
sseg->setSegments(digits[1], 1);
sseg->setSegments(digits[2], 2);
sseg->setSegments(digits[3], 3);
void set_game_sseg_raw(const uint8_t* segments) {
sseg->setSegments(segments[0], 0);
sseg->setSegments(segments[1], 1);
sseg->setSegments(segments[2], 2);
sseg->setSegments(segments[3], 3);
}
void clear_game_sseg() {
sseg->setSegments(0, 0);
sseg->setSegments(0, 1);
sseg->setSegments(0, 2);
sseg->setSegments(0, 3);
}
void set_module_sseg_raw(const uint8_t* digits) {
sseg->setSegments(digits[0], 4);
sseg->setSegments(digits[1], 5);
sseg->setSegments(digits[2], 6);
sseg->setSegments(digits[3], 7);
void set_module_sseg_raw(const uint8_t* segments) {
sseg->setSegments(segments[0], 4);
sseg->setSegments(segments[1], 5);
sseg->setSegments(segments[2], 6);
sseg->setSegments(segments[3], 7);
}
void clear_module_sseg() {
sseg->setSegments(0, 4);
sseg->setSegments(0, 5);
sseg->setSegments(0, 6);
sseg->setSegments(0, 7);
}
void set_game_sseg_num(uint32_t value, uint8_t dot_pos) {
+10 -4
View File
@@ -12,19 +12,25 @@ extern TM1640* sseg;
/// Initializes the seven segment driver
void init_sseg();
/// sets the game seven segment to the value of the digits
/// @brief Sets the game seven segment to the value of `segments`.
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_game_sseg_raw(const uint8_t* digits);
void set_game_sseg_raw(const uint8_t* segments);
/// sets the module seven segment to the value of the digits
/// @brief Clears the game seven segment display.
void clear_game_sseg();
/// @brief Sets the module seven segment to the value of the `segments`.
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_module_sseg_raw(const uint8_t* digits);
void set_module_sseg_raw(const uint8_t* segments);
/// @brief Clears the game seven segment display.
void clear_module_sseg();
/// sets the game timer to the given number, with the dot at position `dot_pos` from the right (0 => right-most digit).
void set_game_sseg_num(uint32_t value, uint8_t dot_pos);