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

Method spi_read_16

Software/C/GoPiGo3.cpp:38–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38int GoPiGo3::spi_read_16(uint8_t msg_type, uint16_t &value){
39 value = 0;
40 spi_array_out[0] = Address;
41 spi_array_out[1] = msg_type;
42 // assign error to the value returned by spi_transfer_array, and if not 0:
43 if(int error = spi_transfer_array(6, spi_array_out, spi_array_in)){
44 return error;
45 }
46 if(spi_array_in[3] != 0xA5){
47 return ERROR_SPI_RESPONSE;
48 }
49 value = ((spi_array_in[4] << 8) | spi_array_in[5]);
50 return ERROR_NONE;
51}
52
53int GoPiGo3::spi_read_32(uint8_t msg_type, uint32_t &value){
54 value = 0;

Callers

nothing calls this directly

Calls 1

spi_transfer_arrayFunction · 0.85

Tested by

no test coverage detected