Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 225 → Rev 226

/PIC Stuff/Cerebot_32MX7_LED_Cube/SPI1.c
45,19 → 45,19
INTEnableInterrupts();
}
 
int SPI1_Write(unsigned char *array, unsigned int count, void (*tx_callback)(void)) {
int SPI1_Write(char *array, int length, void (*tx_callback)(void)) {
spi_data_ptr->tx_callback = tx_callback;
 
if (count > SPI1_BUFFER_SIZE)
if (length > SPI1_BUFFER_OUT_SIZE)
return 0;
if (spi_data_ptr->buffer_out_len != 0)
return 0;
 
// Put the data to send into the outbound buffer
spi_data_ptr->buffer_out_len = count;
spi_data_ptr->buffer_out_ind = count-1;
spi_data_ptr->buffer_out_len = length;
spi_data_ptr->buffer_out_ind = length-1;
int i;
for (i = 0; i < count; i++) {
for (i = 0; i < length; i++) {
spi_data_ptr->buffer_out[i] = array[i];
}
IEC0SET = 0x02000000; // Enable TX interrupt