MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / spi_read_8

Method spi_read_8

Software/C/GoPiGo3.cpp:23–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23int GoPiGo3::spi_read_8(uint8_t msg_type, uint8_t &value){
24 value = 0;
25 spi_array_out[0] = Address;
26 spi_array_out[1] = msg_type;
27 // assign error to the value returned by spi_transfer_array, and if not 0:
28 if(int error = spi_transfer_array(5, spi_array_out, spi_array_in)){
29 return error;
30 }
31 if(spi_array_in[3] != 0xA5){
32 return ERROR_SPI_RESPONSE;
33 }
34 value = spi_array_in[4];
35 return ERROR_NONE;
36}
37
38int GoPiGo3::spi_read_16(uint8_t msg_type, uint16_t &value){
39 value = 0;

Callers

nothing calls this directly

Calls 1

spi_transfer_arrayFunction · 0.85

Tested by

no test coverage detected