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

Method spi_read_string

Software/C/GoPiGo3.cpp:68–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int GoPiGo3::spi_read_string(uint8_t msg_type, char *str, uint8_t chars){
69 if((chars + 4) > LONGEST_SPI_TRANSFER){
70 return -3;
71 }
72 spi_array_out[0] = Address;
73 spi_array_out[1] = msg_type;
74 // assign error to the value returned by spi_transfer_array, and if not 0:
75 if(int error = spi_transfer_array(chars + 4, spi_array_out, spi_array_in)){
76 return error;
77 }
78 if(spi_array_in[3] != 0xA5){
79 return ERROR_SPI_RESPONSE;
80 }
81 for(uint8_t i = 0; i < chars; i++){
82 str[i] = spi_array_in[i + 4];
83 }
84 return ERROR_NONE;
85}
86
87int GoPiGo3::spi_write_32(uint8_t msg_type, uint32_t value){
88 spi_array_out[0] = Address;

Callers

nothing calls this directly

Calls 1

spi_transfer_arrayFunction · 0.85

Tested by

no test coverage detected