Skip to content

Commit

Permalink
Experimental SPI RASPBERRYPI update
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelpolach321 committed Sep 24, 2024
1 parent 9364680 commit 31877f8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/lt_l1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 31877f8

Please sign in to comment.