remove uses of deprecated watch_gpio functions
This commit is contained in:
@@ -117,7 +117,7 @@ bool day_one_face_loop(movement_event_t event, void *context) {
|
||||
case EVENT_LOW_ENERGY_UPDATE:
|
||||
case EVENT_TICK:
|
||||
if (state->quick_cycle) {
|
||||
if (watch_get_pin_level(BTN_ALARM)) {
|
||||
if (HAL_GPIO_BTN_ALARM_read()) {
|
||||
_day_one_face_increment(state);
|
||||
} else {
|
||||
_day_one_face_abort_quick_cycle(state);
|
||||
|
||||
@@ -502,7 +502,7 @@ static bool _setting_loop(movement_event_t event, void *context)
|
||||
switch (event.event_type) {
|
||||
case EVENT_TICK:
|
||||
if (state->tick_freq == 8) {
|
||||
if (watch_get_pin_level(BTN_ALARM)) {
|
||||
if (HAL_GPIO_BTN_ALARM_read()) {
|
||||
_increment_date(state, date_time);
|
||||
_setting_display(event, state, date_time);
|
||||
} else {
|
||||
|
||||
@@ -520,7 +520,7 @@ static void update_game(endless_runner_state_t *state, uint8_t subsecond) {
|
||||
game_state.jump_state = JUMPING_FINAL_FRAME;
|
||||
else
|
||||
game_state.fuel--;
|
||||
if (!watch_get_pin_level(BTN_ALARM) && !watch_get_pin_level(BTN_LIGHT)) stop_jumping(state);
|
||||
if (!HAL_GPIO_BTN_ALARM_read() && !HAL_GPIO_BTN_LIGHT_read()) stop_jumping(state);
|
||||
}
|
||||
else {
|
||||
curr_jump_frame = game_state.jump_state - NOT_JUMPING;
|
||||
|
||||
@@ -39,8 +39,8 @@ void flashlight_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
void flashlight_face_activate(void *context) {
|
||||
(void) context;
|
||||
|
||||
watch_enable_digital_output(A2);
|
||||
watch_set_pin_level(A2, false);
|
||||
HAL_GPIO_A2_out();
|
||||
HAL_GPIO_A2_clr();
|
||||
}
|
||||
|
||||
bool flashlight_face_loop(movement_event_t event, void *context) {
|
||||
@@ -53,11 +53,7 @@ bool flashlight_face_loop(movement_event_t event, void *context) {
|
||||
case EVENT_LIGHT_BUTTON_DOWN:
|
||||
break;
|
||||
case EVENT_LIGHT_BUTTON_UP:
|
||||
if (watch_get_pin_level(A2)) {
|
||||
watch_set_pin_level(A2, false);
|
||||
} else {
|
||||
watch_set_pin_level(A2, true);
|
||||
}
|
||||
HAL_GPIO_A2_toggle();
|
||||
break;
|
||||
case EVENT_TIMEOUT:
|
||||
movement_move_to_face(0);
|
||||
@@ -72,7 +68,6 @@ bool flashlight_face_loop(movement_event_t event, void *context) {
|
||||
void flashlight_face_resign(void *context) {
|
||||
(void) context;
|
||||
|
||||
watch_set_pin_level(A2, false);
|
||||
watch_disable_digital_output(A2);
|
||||
HAL_GPIO_A2_clr();
|
||||
HAL_GPIO_A2_off();
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ static void _handle_backward(periodic_state_t *state, bool should_sound){
|
||||
|
||||
static void _handle_mode_still_pressed(periodic_state_t *state, bool should_sound) {
|
||||
if (_ts_ticks != 0){
|
||||
if (!watch_get_pin_level(BTN_MODE)) {
|
||||
if (!HAL_GPIO_BTN_MODE_read()) {
|
||||
_ts_ticks = 0;
|
||||
return;
|
||||
}
|
||||
@@ -401,8 +401,8 @@ bool periodic_face_loop(movement_event_t event, void *context)
|
||||
if (state->mode == SCREEN_TITLE) _text_pos = _loop_text(_text_looping, _text_pos, 5);
|
||||
else if (state->mode == SCREEN_FULL_NAME) _text_pos = _loop_text(_text_looping, _text_pos, 6);
|
||||
if (_quick_ticks_running) {
|
||||
if (watch_get_pin_level(BTN_LIGHT)) _handle_backward(state, false);
|
||||
else if (watch_get_pin_level(BTN_ALARM)) _handle_forward(state, false);
|
||||
if (HAL_GPIO_BTN_LIGHT_read()) _handle_backward(state, false);
|
||||
else if (HAL_GPIO_BTN_ALARM_read()) _handle_forward(state, false);
|
||||
else stop_quick_cyc();
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ bool tally_face_loop(movement_event_t event, void *context) {
|
||||
static bool using_led = false;
|
||||
|
||||
if (using_led) {
|
||||
if(!watch_get_pin_level(BTN_MODE) && !watch_get_pin_level(BTN_LIGHT) && !watch_get_pin_level(BTN_ALARM))
|
||||
if(!HAL_GPIO_BTN_MODE_read() && !HAL_GPIO_BTN_LIGHT_read() && !HAL_GPIO_BTN_ALARM_read())
|
||||
using_led = false;
|
||||
else {
|
||||
if (event.event_type == EVENT_LIGHT_BUTTON_DOWN || event.event_type == EVENT_ALARM_BUTTON_DOWN)
|
||||
@@ -125,8 +125,8 @@ bool tally_face_loop(movement_event_t event, void *context) {
|
||||
switch (event.event_type) {
|
||||
case EVENT_TICK:
|
||||
if (_quick_ticks_running) {
|
||||
bool light_pressed = watch_get_pin_level(BTN_LIGHT);
|
||||
bool alarm_pressed = watch_get_pin_level(BTN_ALARM);
|
||||
bool light_pressed = HAL_GPIO_BTN_LIGHT_read();
|
||||
bool alarm_pressed = HAL_GPIO_BTN_ALARM_read();
|
||||
if (light_pressed && alarm_pressed) stop_quick_cyc();
|
||||
else if (light_pressed) tally_face_increment(state, movement_button_should_sound());
|
||||
else if (alarm_pressed) tally_face_decrement(state, movement_button_should_sound());
|
||||
@@ -160,7 +160,7 @@ bool tally_face_loop(movement_event_t event, void *context) {
|
||||
break;
|
||||
case EVENT_LIGHT_BUTTON_DOWN:
|
||||
case EVENT_ALARM_BUTTON_DOWN:
|
||||
if (watch_get_pin_level(BTN_MODE)) {
|
||||
if (HAL_GPIO_BTN_MODE_read()) {
|
||||
movement_illuminate_led();
|
||||
using_led = true;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ bool time_left_face_loop(movement_event_t event, void *context) {
|
||||
case EVENT_TICK: {
|
||||
uint8_t subsecond = event.subsecond;
|
||||
if (_quick_ticks_running) {
|
||||
if (watch_get_pin_level(BTN_ALARM)) {
|
||||
if (HAL_GPIO_BTN_ALARM_read()) {
|
||||
_handle_alarm_button(state);
|
||||
subsecond = 0;
|
||||
} else _abort_quick_ticks();
|
||||
|
||||
@@ -224,7 +224,7 @@ bool timer_face_loop(movement_event_t event, void *context) {
|
||||
if (state->mode == running) state->now_ts++;
|
||||
else if (state->mode == pausing) state->pausing_seconds++;
|
||||
else if (state->quick_cycle) {
|
||||
if (watch_get_pin_level(BTN_ALARM)) {
|
||||
if (HAL_GPIO_BTN_ALARM_read()) {
|
||||
_settings_increment(state);
|
||||
subsecond = 0;
|
||||
} else _abort_quick_cycle(state);
|
||||
|
||||
@@ -123,7 +123,7 @@ bool wareki_loop(movement_event_t event, void *context) {
|
||||
|
||||
//printf("tick %d\n",state->disp_year );
|
||||
|
||||
if (_alarm_button_press && watch_get_pin_level(BTN_ALARM)){
|
||||
if (_alarm_button_press && HAL_GPIO_BTN_ALARM_read()){
|
||||
//printf("ALARM ON\n");
|
||||
}
|
||||
else{
|
||||
@@ -131,7 +131,7 @@ bool wareki_loop(movement_event_t event, void *context) {
|
||||
_alarm_button_press = false;
|
||||
}
|
||||
|
||||
if (_light_button_press && watch_get_pin_level(BTN_LIGHT)){
|
||||
if (_light_button_press && HAL_GPIO_BTN_LIGHT_read()){
|
||||
//printf("LIGHT ON\n");
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -556,7 +556,7 @@ bool wordle_face_loop(movement_event_t event, void *context) {
|
||||
display_letter(state, true);
|
||||
if (state->word_elements[state->position] == WORDLE_NUM_VALID_LETTERS) break;
|
||||
#if (WORDLE_USE_RANDOM_GUESS != 0)
|
||||
if (watch_get_pin_level(BTN_LIGHT) &&
|
||||
if (HAL_GPIO_BTN_LIGHT_read() &&
|
||||
(state->using_random_guess || (state->attempt == 0 && state->position == 0))) {
|
||||
insert_random_guess(state);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user