diff options
Diffstat (limited to 'sw/spi.c')
| -rw-r--r-- | sw/spi.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/sw/spi.c b/sw/spi.c deleted file mode 100644 index 1793c4d..0000000 --- a/sw/spi.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <xc.h> - -#include <stdint.h> - -#include "sys.h" -#include "types.h" - -#include "spi.h" - -void -spiInit(void) { - U8 junk; - - TRISBbits.TRISB4 = IN; // SDI - TRISCbits.TRISC7 = OUT; // SDO - TRISBbits.TRISB6 = OUT; // SCK - - SSPSTAT = 0x00; - SSPCON1 = 0x01; // FOSC/16 => 3MHz SPI clock - SSPCON1bits.SSPEN = 1; // enable - junk = SSPBUF; // dummy read to clear BF - (void)junk; -} - -U8 -spiTx(U8 c) { - SSPBUF = c; - while (!SSPSTATbits.BF) {} - return SSPBUF; -} |