spi_software: add a delay on mode change
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
committed by
KevinOConnor
parent
14685bf77f
commit
28a4baf95c
@@ -40,18 +40,21 @@ DECL_COMMAND(command_spi_set_sw_bus,
|
||||
"spi_set_sw_bus oid=%c miso_pin=%u mosi_pin=%u sclk_pin=%u"
|
||||
" mode=%u pulse_ticks=%u");
|
||||
|
||||
void
|
||||
spi_software_prepare(struct spi_software *ss)
|
||||
{
|
||||
gpio_out_write(ss->sclk, ss->mode & 0x02);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_delay(uint32_t end)
|
||||
{
|
||||
while (timer_is_before(timer_read_time(), end));
|
||||
}
|
||||
|
||||
void
|
||||
spi_software_prepare(struct spi_software *ss)
|
||||
{
|
||||
gpio_out_write(ss->sclk, ss->mode & 0x02);
|
||||
uint32_t end = timer_read_time() + ss->sck_ticks;
|
||||
spi_delay(end);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spi_software_transfer(struct spi_software *ss, uint8_t receive_data
|
||||
, uint8_t len, uint8_t *data)
|
||||
|
||||
Reference in New Issue
Block a user