From 31877f8682949d29b328a4f3ec7fb336d9326e4b Mon Sep 17 00:00:00 2001 From: Pavel Polach Date: Tue, 24 Sep 2024 11:03:48 +0200 Subject: [PATCH] Experimental SPI RASPBERRYPI update --- src/lt_l1.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lt_l1.c b/src/lt_l1.c index c5511ff..11d204f 100644 --- a/src/lt_l1.c +++ b/src/lt_l1.c @@ -46,7 +46,7 @@ lt_ret_t lt_l1_read(lt_handle_t *h, const uint32_t max_len, const uint32_t timeo // store the byte which was initally in l2_buff uint8_t store_byte = h->l2_buff[0]; // put raspberry command byte there - h->l2_buff[0] = PUT READ BYTE HERE; + h->l2_buff[0] = 0x00; // do transmit of that one command if (lt_l1_spi_transfer(h, 0, 1, timeout) != LT_OK) { @@ -135,7 +135,20 @@ lt_ret_t lt_l1_write(lt_handle_t *h, const uint16_t len, const uint32_t timeout) #endif lt_l1_spi_csn_low(h); - +#ifdef EXPERIMENTAL_SPI_RASPBERRYPI + // store the byte which was initally in l2_buff + uint8_t store_byte = h->l2_buff[0]; + // put raspberry command byte there + h->l2_buff[0] = 0x01; + // do transmit of that one command + if (lt_l1_spi_transfer(h, 0, 1, timeout) != LT_OK) + { + lt_l1_spi_csn_high(h); + return LT_L1_SPI_ERROR; + } + // put previous byte back to buffer and continue as usually + h->l2_buff[0] = store_byte; +#endif if (lt_l1_spi_transfer(h, 0, len, timeout) != LT_OK) { lt_l1_spi_csn_high(h);