diff options
author | Robert Pelnar <robert.pelnar@seznam.cz> | 2017-08-17 16:23:34 +0300 |
---|---|---|
committer | Robert Pelnar <robert.pelnar@seznam.cz> | 2017-08-17 16:23:34 +0300 |
commit | 683784c4c7d92f352c65b53e750b48fb50d2354b (patch) | |
tree | 0545097a1aa6bd19850b09158ba716f0f98e59a3 /Firmware/swspi.h | |
parent | a7477673de5ee67b09d04a8c81129ebd5345ebb7 (diff) |
PAT9125 I2C, hardware SG homing
separate pin configuration file for each board
changed board codes:
RAMBO =100, MiniRambo1.0 =200, MiniRambo1.3 = 203, Einy03 =303, Einy04 =304
Diffstat (limited to 'Firmware/swspi.h')
-rwxr-xr-x | Firmware/swspi.h | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/Firmware/swspi.h b/Firmware/swspi.h index ba75d2bb0..f95665c46 100755 --- a/Firmware/swspi.h +++ b/Firmware/swspi.h @@ -1,43 +1,14 @@ +// Software SPI #ifndef SWSPI_H #define SWSPI_H -//#define SWSPI_RPI -#define SWSPI_AVR - -#ifdef SWSPI_RPI -//#define SWSPI_MISO 9 -#define SWSPI_MISO 10 -#define SWSPI_MOSI 10 -#define SWSPI_SCK 11 -#define SWSPI_CS 7 -#endif //SWSPI_RPI - -#ifdef SWSPI_AVR -#endif //SWSPI_AVR - -#define SWSPI_POL 1 //polarity -#define SWSPI_PHA 0 //phase -#define SWSPI_DOR 0 //data order -#define SWSPI_DEL 2 //delay - - -void swspi_init(); - -#if (SWSPI_MOSI == SWSPI_MISO) - -void swspi_tx(unsigned char tx); -unsigned char swspi_rx(); - -#else //(SWSPI_MOSI == SWSPI_MISO) - -#define swspi_tx swspi_txrx -#define swspi_rx swspi_txrx -unsigned char swspi_txrx(unsigned char tx); - -#endif //(SWSPI_MOSI == SWSPI_MISO) - -void swspi_start(); -void swspi_stop(); - +//initialize gpio +extern void swspi_init(unsigned char miso, unsigned char mosi, unsigned char sck, unsigned char cfg); +//transmit and receive (full duplex mode) +extern unsigned char swspi_txrx(unsigned char tx); +//transmit (half dublex mode, miso == mosi) +extern void swspi_tx(unsigned char tx); +//receive (half dublex mode, miso == mosi) +extern unsigned char swspi_rx(); #endif //SWSPI_H |