Hardware Reference
In-Depth Information
{
result = true;
}
ATS_PrintTestStatus("12. setClockDivider(SPI_CLOCK_DIV32)", result);
result = false;
spireturn = SPITransfer(0x00, MSBFIRST, SPI_MODE0, SPI_CLOCK_DIV64);
if (spireturn == 0xf0)
{
result = true;
}
ATS_PrintTestStatus("13. setClockDivider(SPI_CLOCK_DIV64)", result);
result = false;
spireturn = SPITransfer(0x00, MSBFIRST, SPI_MODE0, SPI_CLOCK_DIV128);
if (spireturn == 0xf0)
{
result = true;
}
ATS_PrintTestStatus("14. setClockDivider(SPI_CLOCK_DIV128)", result);
result = false;
}
void loop (){}
SPI.transfer() Test
SPI.transfer() is the main function of this library. In the past, we've used it to verify that data was sent properly
between various configurations. Now we want to test if it sends data as defined in the API. A byte should be sent to the
slave device, and a byte will be received as the return value from the slave device, as shown in Listing 13-11.
Listing 13-11. Data Transfer Test
void testTransfer()
{
boolean result = false;
byte spireturn;
spireturn = SPITransfer(0x00, MSBFIRST, SPI_MODE0, SPI_CLOCK_DIV4);
if (spireturn == 0xf0)
{
result = true;
}
ATS_PrintTestStatus("1. transfer(0x00)", result);
}
 
Search WWH ::




Custom Search