Sansa Connect: Ensure adequate AVR Slave Select delay

Waiting 10 us between selecting slave and transmitting data on SPI
resolves spurious startup glitches.

Cache last read monotime value as it can differ from the first one.

Change-Id: Ia6ac5696f6ee2bc3c6a8be27e33aaddd9ff4ce2a
This commit is contained in:
Tomasz Moń 2021-06-27 13:32:20 +02:00
parent 1b81bd8a61
commit 3c7c71030f
No known key found for this signature in database
GPG key ID: 92BA8820D4D517C8

View file

@ -376,6 +376,7 @@ static bool avr_run_command(uint8_t opcode, uint8_t *data, size_t data_length)
IO_SERIAL1_TX_ENABLE = 0x0001;
avr_hid_select();
udelay(10);
IO_SERIAL1_TX_DATA = CMD_SYNC;
spi_read_byte();
@ -660,7 +661,7 @@ static void read_monotime(void)
if ((t1 == t2) || (t1 + 1 == t2))
{
int flags = disable_irq_save();
monotime_value = t1;
monotime_value = t2;
monotime_value_tick = current_tick;
restore_irq(flags);
monotime_available = true;