Clear input queued while Pi was off

This commit is contained in:
Andrew D'Angelo 2024-05-04 06:11:56 -05:00
parent 8a9548305f
commit e9a2869985
3 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#pragma once
#define VERSION_MAJOR 3
#define VERSION_MINOR 7
#define VERSION_MINOR 8
#define KEY_FIFO_SIZE 31 // number of keys in the public FIFO

View File

@ -3,6 +3,7 @@
#include "keyboard.h"
#include "gpioexp.h"
#include "backlight.h"
#include "fifo.h"
#include "hardware/adc.h"
#include <hardware/pwm.h>
@ -57,6 +58,9 @@ void pi_power_on(enum power_on_reason reason)
gpio_put(PIN_PI_PWR, 1);
g_pi_state = PI_STATE_ON;
// Clear any input queued while Pi was off
fifo_flush();
// LED green while booting until driver loaded
state.setting = LED_SET_ON;
state.r = 0;

View File

@ -296,6 +296,9 @@ void reg_process_packet(uint8_t in_reg, uint8_t in_data, uint8_t *out_buffer, ui
// Driver loaded, cancel shutdown and power off
} else if (in_data) {
pi_cancel_power_alarms();
// Clear any input queued while driver was unloaded
fifo_flush();
}
} else {