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

Method get_id

Software/C/GoPiGo3.cpp:179–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179int GoPiGo3::get_id(char *str){
180 spi_array_out[0] = Address;
181 spi_array_out[1] = GPGSPI_MESSAGE_GET_ID;
182 // assign error to the value returned by spi_read_32, and if not 0:
183 if(int error = spi_transfer_array(20, spi_array_out, spi_array_in)){
184 return error;
185 }
186 if(spi_array_in[3] != 0xA5){
187 return ERROR_SPI_RESPONSE;
188 }
189 for(int i = 0; i < 16; i++){
190 sprintf((str + (i * 2)), "%02X", spi_array_in[i + 4]);
191 }
192 return ERROR_NONE;
193}
194
195int GoPiGo3::set_led(uint8_t led, uint8_t red, uint8_t green, uint8_t blue){
196 spi_array_out[0] = Address;

Callers 1

mainFunction · 0.45

Calls 1

spi_transfer_arrayFunction · 0.85

Tested by

no test coverage detected