forked from collin80/GVRET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.h
139 lines (112 loc) · 4.38 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* config.h
*
* Defines the components to be used in the GEVCU and allows the user to configure
* static parameters.
*
* Note: Make sure with all pin defintions of your hardware that each pin number is
* only defined once.
Copyright (c) 2013 Collin Kidder, Michael Neuweiler, Charles Galpin
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Author: Michael Neuweiler
*/
#ifndef CONFIG_H_
#define CONFIG_H_
#include "due_can.h"
struct FILTER { //should be 10 bytes
uint32_t id;
uint32_t mask;
boolean extended;
boolean enabled;
};
enum FILEOUTPUTTYPE
{
NONE = 0,
BINARYFILE = 1,
GVRET = 2,
CRTD = 3
};
struct EEPROMSettings { //222 bytes right now. Must stay under 256
uint8_t version;
uint32_t CAN0Speed;
uint32_t CAN1Speed;
boolean CAN0_Enabled;
boolean CAN1_Enabled;
FILTER CAN0Filters[8]; // filters for our 8 mailboxes - 10*8 = 80 bytes
FILTER CAN1Filters[8]; // filters for our 8 mailboxes - 10*8 = 80 bytes
boolean useBinarySerialComm; //use a binary protocol on the serial link or human readable format?
FILEOUTPUTTYPE fileOutputType; //what format should we use for file output?
char fileNameBase[30]; //Base filename to use
char fileNameExt[4]; //extension to use
uint16_t fileNum; //incrementing value to append to filename if we create a new file each time
boolean appendFile; //start a new file every power up or append to current?
boolean autoStartLogging; //should logging start immediately on start up?
uint8_t logLevel; //Level of logging to output on serial line
uint8_t sysType; //0 = CANDUE, 1 = GEVCU
uint16_t valid; //stores a validity token to make sure EEPROM is not corrupt
uint8_t singleWireMode; //anything other than 1 means normal mode. 1 means use single wire mode where we strobe the enable line to go into HV mode
};
struct SystemSettings
{
uint8_t eepromWPPin;
uint8_t CAN0EnablePin;
uint8_t CAN1EnablePin;
uint8_t SWCANMode0;
uint8_t SWCANMode1;
boolean useSD; //should we attempt to use the SDCard? (No logging possible otherwise)
boolean logToFile; //are we currently supposed to be logging to file?
uint8_t SDCardSelPin;
boolean SDCardInserted;
uint8_t LED_CANTX;
uint8_t LED_CANRX;
uint8_t LED_LOGGING;
boolean txToggle; //LED toggle values
boolean rxToggle;
boolean logToggle;
};
extern EEPROMSettings settings;
extern SystemSettings SysSettings;
#define BUF_SIZE 8192 //buffer size for SDCard - Sending canbus data to the card. Still allocated even for GEVCU but unused in that case
#define CFG_BUILD_NUM 323
#define CFG_VERSION "GVRET alpha 2015-08-15"
#define EEPROM_PAGE 275 //this is within an eeprom space currently unused on GEVCU so it's safe
#define EEPROM_VER 0x15
#define CANDUE_EEPROM_WP_PIN 18
#define CANDUE_CAN0_EN_PIN 50
#define CANDUE_CAN1_EN_PIN 48
#define CANDUE_USE_SD 1
#define CANDUE_SDCARD_SEL 10
#define CANDUE_SWCAN_MODE0 46
#define CANDUE_SWCAN_MODE1 44
#define GEVCU_EEPROM_WP_PIN 19
#define GEVCU_CAN0_EN_PIN 255 //GEVCU has a different transceiver with no enable pin
#define GEVCU_CAN1_EN_PIN 255
#define GEVCU_USE_SD 0
#define GEVCU_SDCARD_SEL 10
#define GEVCU_SWCAN_MODE0 255
#define GEVCU_SWCAN_MODE1 255
/*
* SERIAL CONFIGURATION
*/
#define CFG_SERIAL_SPEED 115200
//#define SerialUSB Serial // re-route serial-usb output to programming port ;) comment if output should go to std usb
#define BLINK_LED 73 //13 is L, 73 is TX, 72 is RX
#define NUM_ANALOG 4
#define NUM_DIGITAL 4
#define NUM_OUTPUT 8
#endif /* CONFIG_H_ */