| 51 | } |
| 52 | |
| 53 | int 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 | |
| 68 | int GoPiGo3::spi_read_string(uint8_t msg_type, char *str, uint8_t chars){ |
| 69 | if((chars + 4) > LONGEST_SPI_TRANSFER){ |
nothing calls this directly
no test coverage detected