#include "config.h" #include "include/spi_drv.h" void spi_write_string (Byte* string_a) { Byte i=0; while (string_a[i]!= 0) { Spi_write_data(string_a[i]); Spi_wait_eot(); /* wait until transmission is done */ i++; } } void spi_read_bytes (Byte* buffer_a, Byte length_a) { Byte i=0; while (i < length_a) { Spi_write_dummy(); Spi_wait_eor(); /* wait until last receive is done */ buffer_a[i] = Spi_read_data(); i++; } } void spi_write_and_read_bytes (Byte* write_buf_a, Byte* read_buf_a, Byte length_a) { Byte i=0; while (i < length_a) { Spi_write_data(write_buf_a[i]); Spi_wait_eot(); /* wait until transmission is done */ read_buf_a[i] = Spi_read_data(); i++; } } /* Set the SPI controller priority interrupt */ void spi_set_prio (Byte priority) { /* set LSB priority bit */ if ((priority == 1) || (priority == 3)) { IPL1 |= MSK_ESPI; } /* set MSB priority bit */ if ((priority == 2) || (priority == 3)) { IPH1 |= MSK_ESPI; } }