|
|
@ -4,6 +4,8 @@
|
|
|
|
#include "pin.hpp"
|
|
|
|
#include "pin.hpp"
|
|
|
|
#include "spi.hpp"
|
|
|
|
#include "spi.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// spi channel has a hardware spi object and a pin object for the chipselect.
|
|
|
|
|
|
|
|
|
|
|
|
template <typename DerivedPin,
|
|
|
|
template <typename DerivedPin,
|
|
|
|
typename DerivedSPI>
|
|
|
|
typename DerivedSPI>
|
|
|
|
struct SPICH
|
|
|
|
struct SPICH
|
|
|
@ -19,11 +21,14 @@ struct SPICH
|
|
|
|
uint8_t read_write_u8(const uint8_t& data)
|
|
|
|
uint8_t read_write_u8(const uint8_t& data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t temp;
|
|
|
|
uint8_t temp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// spiHwCH.takeMutex();
|
|
|
|
chipSelect.write(false);
|
|
|
|
chipSelect.write(false);
|
|
|
|
|
|
|
|
|
|
|
|
temp = spiHwCH.trx_u8(data);
|
|
|
|
temp = spiHwCH.trx_u8(data);
|
|
|
|
|
|
|
|
|
|
|
|
chipSelect.write(true);
|
|
|
|
chipSelect.write(true);
|
|
|
|
|
|
|
|
// spiHwCH.releaseMutex();
|
|
|
|
return temp;
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|