Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

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