Created
November 21, 2018 19:35
-
-
Save martinribelotta/5f9943c9864f56288af7877f34b50c6a to your computer and use it in GitHub Desktop.
sAPI SPI shift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to libs/sapi/sapi_v0.5.2/soc/peripherals/src/sapi_spi.c | |
void spiShiftBlock( spiMap_t spi, const uint8_t *in, uint8_t *out, uint32_t count) | |
{ | |
Chip_SSP_DATA_SETUP_T xferConfig; | |
uint8_t out; | |
xferConfig.tx_data = ∈ | |
xferConfig.tx_cnt = 0; | |
xferConfig.rx_data = &out; | |
xferConfig.rx_cnt = 0; | |
xferConfig.length = count; | |
Chip_SSP_RWFrames_Blocking( LPC_SSP1, &xferConfig ); | |
} | |
uint8_t spiShift( spiMap_t spi, uint8_t in) | |
{ | |
uint8_t out; | |
spiShiftBlock(spi, &in, &out, 1); | |
return out; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to libs/sapi/sapi_v0.5.2/soc/peripherals/inc/sapi_spi.h | |
void spiShiftBlock( spiMap_t spi, const uint8_t *in, uint8_t *out, uint32_t count); | |
uint8_t spiShift( spiMap_t spi, uint8_t in); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment