| 66 | } |
| 67 | |
| 68 | int 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 | |
| 87 | int GoPiGo3::spi_write_32(uint8_t msg_type, uint32_t value){ |
| 88 | spi_array_out[0] = Address; |
nothing calls this directly
no test coverage detected