| 177 | } |
| 178 | |
| 179 | int 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 | |
| 195 | int GoPiGo3::set_led(uint8_t led, uint8_t red, uint8_t green, uint8_t blue){ |
| 196 | spi_array_out[0] = Address; |
no test coverage detected