Transfer length number of bytes. Write from outArray, read to inArray.
| 65 | |
| 66 | // Transfer length number of bytes. Write from outArray, read to inArray. |
| 67 | int spi_transfer_array(uint8_t length, uint8_t *outArray, uint8_t *inArray){ |
| 68 | spi_xfer_struct.len = length; |
| 69 | spi_xfer_struct.tx_buf = (unsigned long)outArray; |
| 70 | spi_xfer_struct.rx_buf = (unsigned long)inArray; |
| 71 | |
| 72 | if (ioctl(spi_file_handle, SPI_IOC_MESSAGE(1), &spi_xfer_struct) < 0) { |
| 73 | return ERROR_SPI_FILE; |
| 74 | } |
| 75 | |
| 76 | return ERROR_NONE; |
| 77 | } |
| 78 | |
| 79 | // Function to call if an error occured that can not be resolved, such as failure to set up SPI |
| 80 | void fatal_error(const char *error){ |
no outgoing calls
no test coverage detected