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

Method spi_read_32

Software/C/GoPiGo3.cpp:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53int GoPiGo3::spi_read_32(uint8_t msg_type, uint32_t &value){
54 value = 0;
55 spi_array_out[0] = Address;
56 spi_array_out[1] = msg_type;
57 // assign error to the value returned by spi_transfer_array, and if not 0:
58 if(int error = spi_transfer_array(8, spi_array_out, spi_array_in)){
59 return error;
60 }
61 if(spi_array_in[3] != 0xA5){
62 return ERROR_SPI_RESPONSE;
63 }
64 value = ((spi_array_in[4] << 24) | (spi_array_in[5] << 16) | (spi_array_in[6] << 8) | spi_array_in[7]);
65 return ERROR_NONE;
66}
67
68int GoPiGo3::spi_read_string(uint8_t msg_type, char *str, uint8_t chars){
69 if((chars + 4) > LONGEST_SPI_TRANSFER){

Callers

nothing calls this directly

Calls 1

spi_transfer_arrayFunction · 0.85

Tested by

no test coverage detected