mirror of
https://github.com/badgeteam/mch2022-template-app.git
synced 2025-01-08 15:25:34 +00:00
Merge pull request #45 from badgeteam/tnt/spi-keys
Small fixes for the SPI key report mechanism
This commit is contained in:
commit
6e3dc8299d
1 changed files with 4 additions and 8 deletions
|
@ -66,8 +66,6 @@ esp_err_t fpga_process_events(xQueueHandle buttonQueue, ICE40* ice40, uint16_t *
|
||||||
while (xQueueReceive(buttonQueue, &buttonMessage, 0) == pdTRUE) {
|
while (xQueueReceive(buttonQueue, &buttonMessage, 0) == pdTRUE) {
|
||||||
uint8_t pin = buttonMessage.input;
|
uint8_t pin = buttonMessage.input;
|
||||||
bool value = buttonMessage.state;
|
bool value = buttonMessage.state;
|
||||||
//snprintf(message, sizeof(message), "button %d %d\n", pin, value);
|
|
||||||
//fpga_uart_mess(message);
|
|
||||||
uint16_t key_mask = 0;
|
uint16_t key_mask = 0;
|
||||||
switch(pin) {
|
switch(pin) {
|
||||||
case RP2040_INPUT_JOYSTICK_DOWN:
|
case RP2040_INPUT_JOYSTICK_DOWN:
|
||||||
|
@ -113,14 +111,12 @@ esp_err_t fpga_process_events(xQueueHandle buttonQueue, ICE40* ice40, uint16_t *
|
||||||
else {
|
else {
|
||||||
*key_state &= ~key_mask;
|
*key_state &= ~key_mask;
|
||||||
}
|
}
|
||||||
//snprintf(message, sizeof(message), "send %04X %04X\n", key_state, key_mask);
|
|
||||||
//fpga_uart_mess(message);
|
|
||||||
|
|
||||||
uint8_t spi_message[5] = { 0xf4 };
|
uint8_t spi_message[5] = { 0xf4 };
|
||||||
spi_message[1] = *key_state & 0xff;
|
spi_message[1] = *key_state >> 8;
|
||||||
spi_message[2] = *key_state >> 8;
|
spi_message[2] = *key_state & 0xff;
|
||||||
spi_message[3] = key_mask & 0xff;
|
spi_message[3] = key_mask >> 8;
|
||||||
spi_message[4] = key_mask >> 8;
|
spi_message[4] = key_mask & 0xff;
|
||||||
esp_err_t res = ice40_send(ice40, spi_message, 5);
|
esp_err_t res = ice40_send(ice40, spi_message, 5);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue