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