rename functions

This commit is contained in:
2025-03-25 21:20:19 -05:00
parent 3806fd7ee8
commit ab7148be42
10 changed files with 53 additions and 53 deletions
+7 -7
View File
@@ -173,10 +173,10 @@ static bool _take_key(KeypadKey* kp, uint16_t* keypad_bitfield) {
return false;
}
bool get_pressed_keypad(KeypadKey* kp) {
bool get_keypad_pressed(KeypadKey* kp) {
return _take_key(kp, &keypad_pressed);
}
bool get_released_keypad(KeypadKey* kp) {
bool get_keypad_released(KeypadKey* kp) {
return _take_key(kp, &keypad_released);
}
@@ -254,23 +254,23 @@ static bool _take_switch(SwitchKey* switch_, uint8_t* switch_bitfield) {
return false;
}
bool get_pressed_button(ButtonKey* button) {
bool get_button_pressed(ButtonKey* button) {
return _take_button(button, &button_pressed);
}
bool get_released_button(ButtonKey* button) {
bool get_button_released(ButtonKey* button) {
return _take_button(button, &button_released);
}
uint8_t get_button_state() {
return button_state;
}
bool get_flipped_up_switch(SwitchKey* switch_) {
bool get_switch_flipped_up(SwitchKey* switch_) {
return _take_switch(switch_, &switch_flipped_up);
}
bool get_flipped_down_switch(SwitchKey* switch_) {
bool get_switch_flipped_down(SwitchKey* switch_) {
return _take_switch(switch_, &switch_flipped_down);
}
bool get_flipped_switch(SwitchKey* switch_) {
bool get_switch_flipped(SwitchKey* switch_) {
for (int i = 0; i < 4; i++) {
int bit_selector = (1 << i);
if (
+7 -8
View File
@@ -62,11 +62,11 @@ void clear_all_pressed_released();
/// @brief Gets the key that was just pressed (if any)
/// @param kp an OUT variable for the key that was pressed (if any)
/// @return true if there was a key that was just pressed
bool get_pressed_keypad(KeypadKey* kp);
bool get_keypad_pressed(KeypadKey* kp);
/// @brief Gets the key that was just released (if any)
/// @param kp an OUT variable for the key that was released (if any)
/// @return true if there was a key that was just released
bool get_released_keypad(KeypadKey* kp);
bool get_keypad_released(KeypadKey* kp);
/// @brief Converts a `KeypadKey` to a char
/// @param kp The value to convert
/// @return The char representing the key
@@ -74,15 +74,14 @@ char char_of_keypad_key(KeypadKey kp);
// TODO: add a get_keypad state?
// TODO: rename these to get_button_pressed.
/// @brief Gets the button that was just pressed (if any)
/// @param button an OUT variable for the button that was pressed (if any)
/// @return true if there was a button that was just pressed
bool get_pressed_button(ButtonKey* button);
bool get_button_pressed(ButtonKey* button);
/// @brief Gets the button that was just released (if any)
/// @param button an OUT variable for the button that was released (if any)
/// @return true if there was a button that was just released
bool get_released_button(ButtonKey* button);
bool get_button_released(ButtonKey* button);
/// @brief Gets the raw state of the buttons b1-b4 as bitflags.
/// B1 is MSB and B4 is LSB.
/// @return Bitflags for b1-b4.
@@ -91,15 +90,15 @@ uint8_t get_button_state();
/// @brief Gets the switch that was just flipped up (if any)
/// @param switch_ an OUT variable for the switch that was flipped up (if any)
/// @return true if there was a switch that was just flipped up
bool get_flipped_up_switch(SwitchKey* switch_);
bool get_switch_flipped_up(SwitchKey* switch_);
/// @brief Gets the switch that was just flipped down (if any)
/// @param switch_ an OUT variable for the switch that was flipped down (if any)
/// @return true if there was a switch that was just flipped down
bool get_flipped_down_switch(SwitchKey* switch_);
bool get_switch_flipped_down(SwitchKey* switch_);
/// @brief Gets the switch that was just flipped (if any)
/// @param switch_ an OUT variable for the switch that was flipped (if any)
/// @return true if there was a switch that was just flipped
bool get_flipped_switch(SwitchKey* switch_);
bool get_switch_flipped(SwitchKey* switch_);
/// @brief Gets the raw state of the switches s1-s4 as bitflags.
/// S1 is MSB and S4 is LSB.
/// @return Bitflags for s1-s4.
+3 -2
View File
@@ -47,13 +47,14 @@ bool init_sd() {
ESP_LOGI(TAG, "Filesystem mounted");
} else {
ESP_LOGE(TAG, "Failed to mount sd card: %s.", esp_err_to_name(ret));
lcd_print(0, 0, "SD Mount Failed!");
lcd_print(0, 1, esp_err_to_name(ret));
lcd_print(0, 2, "Press Green to retry");
lcd_print(0, 3, "Press Red to format");
// TODO: impl buttons
ButtonKey button;
while (!( ))
return false;
}