Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
152 Kevin 1
#ifndef DEFINES_H
2
#define	DEFINES_H
3
 
4
#define UART1_RX_TO_BUFFER
5
//#define UART1_RX_TO_XBEE
6
 
7
#define _DEBUG
8
//#define _TEST_UART
9
//#define _TEST_I2C_MASTER
10
//#define _TEST_I2C_SLAVE
11
//#define _TEST_SPI
12
//#define _TEST_NFC
13
//#define _TEST_LED_BACKPACK
14
//#define _TEST_SSD1306_OLED
15
//#define _TEST_SSD1331_OLED
16
//#define _TEST_ADC
17
//#define _TEST_XBEE
18
 
19
// Enable or disable debug prints depending on project preprocessor (_DEBUG)
20
#ifdef _DEBUG
21
#define DBG_PRINT_MAIN UART1_WriteS
22
#define DBG_PRINT_UART(x) UART1_WriteS(x)
23
#define DBG_PRINT_I2C(x) UART1_WriteS(x)
24
#define DBG_PRINT_SPI(x) UART1_WriteS(x)
25
#define DBG_PRINT_XBEE(x) UART1_WriteS(x)
26
#define DBG_PRINT_PORTB_INT(x)
27
#define DBG_PRINT_INT(x)
28
#define DBG_PRINT_BUFFER(x)
29
#else
30
#define DBG_PRINT_MAIN(x)
31
#define DBG_PRINT_UART(x)
32
#define DBG_PRINT_I2C(x)
33
#define DBG_PRINT_SPI(x)
34
#define DBG_PRINT_XBEE(x)
35
#define DBG_PRINT_PORTB_INT(x)
36
#define DBG_PRINT_INT(x)
37
#define DBG_PRINT_BUFFER(x)
38
#endif
39
 
40
// Pin allocations
41
#define UART1_RX_TRIS           TRISCbits.TRISC7
42
#define UART1_TX_TRIS           TRISCbits.TRISC6
43
 
44
#define I2C_CLK_TRIS            TRISCbits.TRISC3
45
#define I2C_DAT_TRIS            TRISCbits.TRISC4
46
 
47
#define LED_BLUE_TRIS           TRISCbits.TRISC5
48
#define LED_BLUE_LAT            LATCbits.LATC5
49
#define LED_RED_TRIS            TRISCbits.TRISC2
50
#define LED_RED_LAT             LATCbits.LATC2
51
 
52
#define ADC_AN0_TRIS            TRISAbits.TRISA0
53
#define ADC_AN1_TRIS            TRISAbits.TRISA1
54
#define ADC_AN2_TRIS            TRISAbits.TRISA2
55
 
56
#define XBEE_CTS_TRIS           TRISBbits.TRISB0
57
#define XBEE_CTS_LAT            LATBbits.LATB0
58
#define XBEE_CTS_PORT           PORTBbits.RB0
59
#define XBEE_RTS_TRIS           TRISBbits.TRISB1
60
#define XBEE_RTS_LAT            LATBbits.LATB1
61
 
62
#define SPI_MOSI_TRIS           TRISBbits.TRISB0
63
#ifndef SPI2_WRITE_ONLY
64
#define SPI_MISO_TRIS           TRISBbits.TRISB0
65
#endif
66
#define SPI_CLK_TRIS            TRISAbits.TRISA0
67
#define SPI_DC_SELECT_TRIS      TRISAbits.TRISA1
68
#define SPI_DC_SELECT_LAT       LATAbits.LATA1
69
#define SPI_RESET_TRIS          TRISAbits.TRISA2
70
#define SPI_RESET_LAT           LATAbits.LATA2
71
#define SPI_SLAVE_SELECT_TRIS   TRISAbits.TRISA3
72
#define SPI_SLAVE_SELECT_LAT    LATAbits.LATA3
73
 
74
#define PARALLEL_RS_TRIS        TRISBbits.TRISB7
75
#define PARALLEL_RS_LAT         LATBbits.LATB7
76
#define PARALLEL_RW_TRIS        TRISBbits.TRISB6
77
#define PARALLEL_RW_LAT         LATBbits.LATB6
78
#define PARALLEL_EN_TRIS        TRISBbits.TRISB5
79
#define PARALLEL_EN_LAT         LATBbits.LATB5
80
#define PARALLEL_D4_TRIS        TRISBbits.TRISB4
81
#define PARALLEL_D4_LAT         LATBbits.LATB4
82
#define PARALLEL_D5_TRIS        TRISBbits.TRISB3
83
#define PARALLEL_D5_LAT         LATBbits.LATB3
84
#define PARALLEL_D6_TRIS        TRISBbits.TRISB2
85
#define PARALLEL_D6_LAT         LATBbits.LATB2
86
#define PARALLEL_D7_TRIS        TRISBbits.TRISB1
87
#define PARALLEL_D7_LAT         LATBbits.LATB1
88
#define PARALLEL_BUSY_TRIS      TRISBbits.TRISB1
89
#define PARALLEL_BUSY_PORT      PORTBbits.RB1
90
 
91
#define NFC_IRQ_TRIS            TRISAbits.TRISA5
92
#define NFC_IRQ_PORT            PORTAbits.RA5
93
//#define NFC_RESET_TRIS          TRISCbits.TRISC2
94
//#define NFC_RESET_LAT           LATCbits.LATC2
95
 
96
// PPS bindings (RP Pins)
97
#define PPS_SPI2_CLK_IN         0       // A0
98
#define PPS_SPI2_CLK_OUT        RPOR0   // A0
99
#define PPS_SPI2_MOSI           RPOR3   // B0
100
#ifndef SPI2_WRITE_ONLY
101
#define PPS_SPI2_MISO           3       // NA
102
#endif
103
 
104
//#define PPS_UART2_RX            5
105
//#define PPS_UART2_TX            RPOR6
106
 
107
#endif	/* DEFINES_H */
108