| 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
|
| 155 |
Kevin |
8 |
|
| 158 |
Kevin |
9 |
// <editor-fold defaultstate="expanded" desc="Test Cases">
|
| 152 |
Kevin |
10 |
//#define _TEST_UART
|
|
|
11 |
//#define _TEST_I2C_MASTER
|
|
|
12 |
//#define _TEST_I2C_SLAVE
|
|
|
13 |
//#define _TEST_SPI
|
|
|
14 |
//#define _TEST_NFC
|
|
|
15 |
//#define _TEST_LED_BACKPACK
|
|
|
16 |
//#define _TEST_SSD1306_OLED
|
|
|
17 |
//#define _TEST_SSD1331_OLED
|
| 155 |
Kevin |
18 |
//#define _TEST_TIMER1_RTC
|
|
|
19 |
//#define _TEST_LUX
|
|
|
20 |
//#define _TEST_OLED_CHAR
|
|
|
21 |
//#define _TEST_NFC_TO_SSD1306_OLED
|
|
|
22 |
//#define _TEST_LUX_TO_CHAR_OLED
|
| 152 |
Kevin |
23 |
//#define _TEST_ADC
|
| 157 |
Kevin |
24 |
//#define _TEST_BMP
|
|
|
25 |
//#define _TEST_XBEE
|
| 158 |
Kevin |
26 |
// </editor-fold>
|
| 152 |
Kevin |
27 |
|
| 158 |
Kevin |
28 |
// <editor-fold defaultstate="collapsed" desc="Debug Redirection">
|
| 152 |
Kevin |
29 |
#ifdef _DEBUG
|
|
|
30 |
#define DBG_PRINT_MAIN UART1_WriteS
|
| 155 |
Kevin |
31 |
#define DBG_PRINT_UART UART1_WriteS
|
|
|
32 |
#define DBG_PRINT_I2C UART1_WriteS
|
|
|
33 |
#define DBG_PRINT_SPI UART1_WriteS
|
|
|
34 |
#define DBG_PRINT_XBEE UART1_WriteS
|
|
|
35 |
#define DBG_PRINT_PORTB_INT
|
|
|
36 |
#define DBG_PRINT_INT
|
|
|
37 |
#define DBG_PRINT_LUX
|
|
|
38 |
#define DBG_PRINT_BMP
|
| 152 |
Kevin |
39 |
#else
|
| 155 |
Kevin |
40 |
#define DBG_PRINT_MAIN
|
|
|
41 |
#define DBG_PRINT_UART
|
|
|
42 |
#define DBG_PRINT_I2C
|
|
|
43 |
#define DBG_PRINT_SPI
|
|
|
44 |
#define DBG_PRINT_XBEE
|
|
|
45 |
#define DBG_PRINT_PORTB_INT
|
|
|
46 |
#define DBG_PRINT_INT
|
|
|
47 |
#define DBG_PRINT_LUX
|
|
|
48 |
#define DBG_PRINT_BMP
|
| 152 |
Kevin |
49 |
#endif
|
| 158 |
Kevin |
50 |
// </editor-fold>
|
| 152 |
Kevin |
51 |
|
| 158 |
Kevin |
52 |
// <editor-fold defaultstate="collapsed" desc="Pin Allocations">
|
| 152 |
Kevin |
53 |
#define UART1_RX_TRIS TRISCbits.TRISC7
|
|
|
54 |
#define UART1_TX_TRIS TRISCbits.TRISC6
|
|
|
55 |
|
|
|
56 |
#define I2C_CLK_TRIS TRISCbits.TRISC3
|
|
|
57 |
#define I2C_DAT_TRIS TRISCbits.TRISC4
|
|
|
58 |
|
|
|
59 |
#define LED_BLUE_TRIS TRISCbits.TRISC5
|
|
|
60 |
#define LED_BLUE_LAT LATCbits.LATC5
|
|
|
61 |
#define LED_RED_TRIS TRISCbits.TRISC2
|
|
|
62 |
#define LED_RED_LAT LATCbits.LATC2
|
|
|
63 |
|
|
|
64 |
#define ADC_AN0_TRIS TRISAbits.TRISA0
|
|
|
65 |
#define ADC_AN1_TRIS TRISAbits.TRISA1
|
|
|
66 |
#define ADC_AN2_TRIS TRISAbits.TRISA2
|
|
|
67 |
|
|
|
68 |
#define XBEE_CTS_TRIS TRISBbits.TRISB0
|
|
|
69 |
#define XBEE_CTS_LAT LATBbits.LATB0
|
|
|
70 |
#define XBEE_CTS_PORT PORTBbits.RB0
|
|
|
71 |
#define XBEE_RTS_TRIS TRISBbits.TRISB1
|
|
|
72 |
#define XBEE_RTS_LAT LATBbits.LATB1
|
|
|
73 |
|
|
|
74 |
#define SPI_MOSI_TRIS TRISBbits.TRISB0
|
|
|
75 |
#ifndef SPI2_WRITE_ONLY
|
|
|
76 |
#define SPI_MISO_TRIS TRISBbits.TRISB0
|
|
|
77 |
#endif
|
|
|
78 |
#define SPI_CLK_TRIS TRISAbits.TRISA0
|
|
|
79 |
#define SPI_DC_SELECT_TRIS TRISAbits.TRISA1
|
|
|
80 |
#define SPI_DC_SELECT_LAT LATAbits.LATA1
|
|
|
81 |
#define SPI_RESET_TRIS TRISAbits.TRISA2
|
|
|
82 |
#define SPI_RESET_LAT LATAbits.LATA2
|
|
|
83 |
#define SPI_SLAVE_SELECT_TRIS TRISAbits.TRISA3
|
|
|
84 |
#define SPI_SLAVE_SELECT_LAT LATAbits.LATA3
|
|
|
85 |
|
|
|
86 |
#define PARALLEL_RS_TRIS TRISBbits.TRISB7
|
|
|
87 |
#define PARALLEL_RS_LAT LATBbits.LATB7
|
|
|
88 |
#define PARALLEL_RW_TRIS TRISBbits.TRISB6
|
|
|
89 |
#define PARALLEL_RW_LAT LATBbits.LATB6
|
|
|
90 |
#define PARALLEL_EN_TRIS TRISBbits.TRISB5
|
|
|
91 |
#define PARALLEL_EN_LAT LATBbits.LATB5
|
|
|
92 |
#define PARALLEL_D4_TRIS TRISBbits.TRISB4
|
|
|
93 |
#define PARALLEL_D4_LAT LATBbits.LATB4
|
|
|
94 |
#define PARALLEL_D5_TRIS TRISBbits.TRISB3
|
|
|
95 |
#define PARALLEL_D5_LAT LATBbits.LATB3
|
|
|
96 |
#define PARALLEL_D6_TRIS TRISBbits.TRISB2
|
|
|
97 |
#define PARALLEL_D6_LAT LATBbits.LATB2
|
|
|
98 |
#define PARALLEL_D7_TRIS TRISBbits.TRISB1
|
|
|
99 |
#define PARALLEL_D7_LAT LATBbits.LATB1
|
|
|
100 |
#define PARALLEL_BUSY_TRIS TRISBbits.TRISB1
|
|
|
101 |
#define PARALLEL_BUSY_PORT PORTBbits.RB1
|
|
|
102 |
|
|
|
103 |
#define NFC_IRQ_TRIS TRISAbits.TRISA5
|
|
|
104 |
#define NFC_IRQ_PORT PORTAbits.RA5
|
|
|
105 |
//#define NFC_RESET_TRIS TRISCbits.TRISC2
|
|
|
106 |
//#define NFC_RESET_LAT LATCbits.LATC2
|
|
|
107 |
|
|
|
108 |
// PPS bindings (RP Pins)
|
|
|
109 |
#define PPS_SPI2_CLK_IN 0 // A0
|
|
|
110 |
#define PPS_SPI2_CLK_OUT RPOR0 // A0
|
|
|
111 |
#define PPS_SPI2_MOSI RPOR3 // B0
|
|
|
112 |
#ifndef SPI2_WRITE_ONLY
|
|
|
113 |
#define PPS_SPI2_MISO 3 // NA
|
|
|
114 |
#endif
|
|
|
115 |
|
|
|
116 |
//#define PPS_UART2_RX 5
|
|
|
117 |
//#define PPS_UART2_TX RPOR6
|
| 158 |
Kevin |
118 |
// </editor-fold>
|
| 152 |
Kevin |
119 |
|
|
|
120 |
#endif /* DEFINES_H */
|
|
|
121 |
|