Skip to content

Commit

Permalink
Wait for CS when using SBC
Browse files Browse the repository at this point in the history
  • Loading branch information
gloomyandy committed Feb 3, 2021
1 parent e2f332e commit c58a71c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Linux/DataTransfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,12 @@ bool DataTransfer::IsReady() noexcept
{
if (dataReceived)
{
#if !__LPC17xx__ && !STM32F4
#if SAME5x
#if __LPC17xx__ || STM32F4
if (!digitalRead(SbcCsPin)) // transfer is complete if SS is high
{
return false;
}
#elif SAME5x
if (!digitalRead(SbcSSPin)) // transfer is complete if SS is high
{
return false;
Expand All @@ -758,7 +762,6 @@ bool DataTransfer::IsReady() noexcept
{
return false;
}
#endif
#endif

// Transfer has finished
Expand Down
1 change: 1 addition & 0 deletions src/targets/LPC/BoardConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static const boardConfigEntry_t boardConfigs[]=
#if HAS_LINUX_INTERFACE
{"sbc.lpcTfrReadyPin", &SbcTfrReadyPin, nullptr, cvPinType},
{"sbc.TfrReadyPin", &SbcTfrReadyPin, nullptr, cvPinType},
{"sbc.csPin", &SbcCsPin, nullptr, cvPinType},
#endif

#if defined(SERIAL_AUX_DEVICE)
Expand Down
1 change: 1 addition & 0 deletions src/targets/LPC/Pins_LPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Pin SSP0Pins[4] = {SPI0_SCK, SPI0_MISO, SPI0_MOSI, SPI0_SSEL}; //GPIO pins for S

#if HAS_LINUX_INTERFACE
Pin SbcTfrReadyPin = NoPin;
Pin SbcCsPin = P0_16;
#endif

bool ADCEnablePreFilter = true;
Expand Down
1 change: 1 addition & 0 deletions src/targets/LPC/Pins_LPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ extern SSPChannel TempSensorSSPChannel;

#if HAS_LINUX_INTERFACE
extern Pin SbcTfrReadyPin;
extern Pin SbcCsPin;
#endif

// Power control
Expand Down

0 comments on commit c58a71c

Please sign in to comment.