Serial Wombat 4A and 4B Firmware
Wombat16F15214.X
deviceSpecific.h
Go to the documentation of this file.
1
/*
2
Copyright 2020 Broadwell Consulting Inc.
3
4
Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
11
The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
* OTHER DEALINGS IN THE SOFTWARE.
21
*/
22
23
#ifndef DEVICE_SPECIFIC_H
24
#define DEVICE_SPECIFIC_H
25
#include <xc.h>
26
#include "mcc_generated_files/mcc.h"
27
28
#define JOIN3(_a,_b,_c) JOIN(_a,JOIN(_b,_c))
29
#define JOIN(_a,_b) JOIN_AGAIN(_a,_b)
30
#define JOIN_AGAIN(_a,_b) _a ## _b
31
32
33
34
#define NUMBER_OF_PHYSICAL_PINS 4
35
#define NUMBER_OF_VIRTUAL_PINS 0
36
#define NUMBER_OF_TOTAL_PINS (NUMBER_OF_PHYSICAL_PINS + NUMBER_OF_VIRTUAL_PINS)
37
38
#ifdef I2CWOMBAT
39
#define SERIAL_WOMBAT_HARDWARE_IDENTIFIER 'B'
40
#endif
41
#ifdef UARTWOMBAT
42
#define SERIAL_WOMBAT_HARDWARE_IDENTIFIER 'A'
43
#endif
44
45
#define ADC_MAX_COUNTS 0xFFC0
46
47
#define SIZE_OF_USER_BUFFER 0
48
49
#define IOC_BUFFER_SIZE 8
50
#include "
pinDigitalHwSpecific.h
"
51
52
extern
volatile
uint8_t
CCP1SetLowMask
;
53
void
SetLowMaskCurrentPin
();
54
55
#ifdef __16F15224__
56
#define RX_PPS_SOURCE 0x13 //RC3
57
#define TX_PPS_REGISTER RC2PPS
58
#define TX_TRISBIT TRISCbits.TRISC2
59
#define PPS_PORT 0x10
60
#define PPS_ARRAY (&RC0PPS)
61
#define I2C_PPS_SCL_IN 0x14
62
#define I2C_PPS_SCL_OUT RC4PPS
63
64
#define I2C_PPS_SDA_OUT RC5PPS
65
#define I2C_PPS_SDA_IN 0x15
66
67
#define WP_TRIS TRISC
68
#define WP_TRIS_INIT 0x3F // Set upper 2 pins (not wired) to Output
69
#define WP_LAT LATC
70
#define WP_LAT_INIT 0 // All pins low, including non-wired pins
71
#define WP_PORT PORTC
72
#define WP_ANSEL ANSELC
73
#define WP_WPU WPUC
74
#define WP_ODCON ODCONC
75
#ifdef UARTWOMBAT
76
#define WP0_PPS RC5PPS
77
#define WP1_PPS RC4PPS
78
#define WP2_PPS RC1PPS
79
#define WP3_PPS RC0PPS
80
#define WP0_PORTPINNUM 5
81
#define WP1_PORTPINNUM 4
82
#define WP2_PORTPINNUM 1
83
#define WP3_PORTPINNUM 0
84
#endif
85
#ifdef I2CWOMBAT
86
#define WP0_PPS RC3PPS
87
#define WP1_PPS RC2PPS
88
#define WP2_PPS RC1PPS
89
#define WP3_PPS RC0PPS
90
#define WP0_PORTPINNUM 3
91
#define WP1_PORTPINNUM 2
92
#define WP2_PORTPINNUM 1
93
#define WP3_PORTPINNUM 0
94
#endif
95
#define WP_IOCN IOCCN
96
#define WP_IOCP IOCCP
97
#define WP_IOCF IOCCF
98
#define FRAME_TIMING_HIGH() {ANSELA = 0; TRISAbits.TRISA5 = 0; LATAbits.LATA5 = 1;}
99
#define FRAME_TIMING_LOW() {TRISAbits.TRISA5 = 0; LATAbits.LATA5 = 0;}
100
#define FRAME_OVERFLOW_INDICATOR() {TRISAbits.TRISA4 = 0; LATAbits.LATA4 = ~LATAbits.LATA4;}
101
#elif defined __16F15214__
102
103
#define RX_PPS_SOURCE 0x03 //RA3
104
#define TX_PPS_REGISTER RA2PPS
105
#define TX_TRISBIT TRISAbits.TRISA2
106
107
#define PPS_PORT 0x00
108
#define PPS_ARRAY (&RA0PPS)
109
110
#define I2C_PPS_SCL_IN 0x04
111
#define I2C_PPS_SCL_OUT RA4PPS
112
113
#define I2C_PPS_SDA_OUT RA5PPS
114
#define I2C_PPS_SDA_IN 0x05
115
116
#define WP_TRIS TRISA
117
#define WP_TRIS_INIT 0x3F // Set upper 2 pins (not wired) to Output
118
#define WP_LAT LATA
119
#define WP_LAT_INIT 0 // All pins low, including non-wired pins
120
#define WP_PORT PORTA
121
#define WP_ANSEL ANSELA
122
#define WP_WPU WPUA
123
#define WP_ODCON ODCONA
124
#ifdef UARTWOMBAT
125
#define WP0_PPS RA5PPS
126
#define WP1_PPS RA4PPS
127
#define WP2_PPS RA1PPS
128
#define WP3_PPS RA0PPS
129
#define WP0_PORTPINNUM 5
130
#define WP1_PORTPINNUM 4
131
#define WP2_PORTPINNUM 1
132
#define WP3_PORTPINNUM 0
133
#endif
134
#ifdef I2CWOMBAT
135
// #define WP0_PPS RA3PPS //No PPS for this pin
136
#define WP1_PPS RA2PPS
137
#define WP2_PPS RA1PPS
138
#define WP3_PPS RA0PPS
139
#define WP0_PORTPINNUM 3
140
#define WP1_PORTPINNUM 2
141
#define WP2_PORTPINNUM 1
142
#define WP3_PORTPINNUM 0
143
#endif
144
#define WP_IOCN IOCAN
145
#define WP_IOCP IOCAP
146
#define WP_IOCF IOCAF
147
#define FRAME_TIMING_HIGH() {}
148
#define FRAME_TIMING_LOW() {}
149
#define FRAME_OVERFLOW_INDICATOR() {}
150
151
#endif
152
#define error(_a) {Txbuffer[0] = 'E'; Txbuffer[1] = 'X';}
153
154
#endif
SetLowMaskCurrentPin
void SetLowMaskCurrentPin()
Definition:
pinDigitalHwSpecific.c:79
pinDigitalHwSpecific.h
CCP1SetLowMask
volatile uint8_t CCP1SetLowMask
Definition:
pinDigitalHwSpecific.c:33
Generated by
1.8.17