Bosch XDK110 Getting Started page 23

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

Extension Bus Advanced Guide | XDK110
Afterwards, the value of the variable
readVal
, as a return value of the function. Finally, the chip select pin is raised back to a high voltage level by calling
SpiSetCSHigh()
, which indicates that the SPI transmission is over.
SpiReadRegister()
A call of the function
Code 26. SPI write appInitSystem() function call
void appInitSystem(void
{
if
(CmdProcessorHandle == NULL)
{
printf("Command processor handle is null
assert(false);
}
BCDS_UNUSED(param2);
vTaskDelay(5000);
// Other Initialization code from the code snipppets 16-20 here
// Ensuring that CS is at its initial state high
SpiSetCSHigh();
uint8_t
regAddr = 0x02;
uint8_t
regReadVal = 0x00;
uint8_t
dataSize = UINT8_C(1);
SpiReadRegister(regAddr, &regReadVal, dataSize);
}
SpiReadRegister()
Here the function
data from the register, the length of the data to be read as inputs.
An alternative approach to read incoming data from the slave device would be easily achieved, by only lowering the chip
select line to a low voltage level and then call
only raising the voltage level on the chip select line to high would be required.
Note: While this example uses read / write buffers with a size of one byte, the functions
MCU_SPI_READ()
also allow that multiple bytes are read and written within one call. The code must be adapted accordingly.
readData
, which now contains the data received by the SPI module, is stored in
could then be used as shown in Code 26.
* CmdProcessorHandle,
is called, passing a register address, a pointer to a variable that stores the incoming
MCU_SPI_Read()
uint32_t
param2)
\n\r");
to read the incoming data from the slave device. Afterwards
23 24
|
MCU_SPI_SEND()
and

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents