Speeduino
Loading...
Searching...
No Matches
board_template.h
Go to the documentation of this file.
1#ifndef TEMPLATE_H
2#define TEMPLATE_H
3#if defined(CORE_TEMPLATE)
4
5/*
6***********************************************************************************************************
7* General
8*/
9 #define TS_SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
10 #define FPU_MAX_SIZE 0 //Size of the FPU buffer. 0 means no FPU.
11 #define BOARD_MAX_IO_PINS 52 //digital pins + analog channels + 1
12 #define BOARD_MAX_DIGITAL_PINS 52 //Pretty sure this isn't right
13 #define EEPROM_LIB_H <EEPROM.h> //The name of the file that provides the EEPROM class
14 typedef int eeprom_address_t;
15
16 // Forbidden pins like USB
17 static inline bool pinIsReserved(uint8_t pin) {
18 return pin==0U;
19 }
20
21/*
22***********************************************************************************************************
23* Schedules
24*/
25
26 #define FUEL1_COUNTER <register here>
27 #define FUEL2_COUNTER <register here>
28 #define FUEL3_COUNTER <register here>
29 #define FUEL4_COUNTER <register here>
30 //The below are optional, but recommended if there are sufficient timers/compares
31 #define FUEL5_COUNTER <register here>
32 #define FUEL6_COUNTER <register here>
33 #define FUEL7_COUNTER <register here>
34 #define FUEL8_COUNTER <register here>
35
36 #define IGN1_COUNTER <register here>
37 #define IGN2_COUNTER <register here>
38 #define IGN3_COUNTER <register here>
39 #define IGN4_COUNTER <register here>
40 //The below are optional, but recommended if there are sufficient timers/compares
41 #define IGN5_COUNTER <register here>
42 #define IGN6_COUNTER <register here>
43 #define IGN7_COUNTER <register here>
44 #define IGN8_COUNTER <register here>
45
46 #define FUEL1_COMPARE <register here>
47 #define FUEL2_COMPARE <register here>
48 #define FUEL3_COMPARE <register here>
49 #define FUEL4_COMPARE <register here>
50 //The below are optional, but recommended if there are sufficient timers/compares
51 #define FUEL5_COMPARE <register here>
52 #define FUEL6_COMPARE <register here>
53 #define FUEL7_COMPARE <register here>
54 #define FUEL8_COMPARE <register here>
55
56 #define IGN1_COMPARE <register here>
57 #define IGN2_COMPARE <register here>
58 #define IGN3_COMPARE <register here>
59 #define IGN4_COMPARE <register here>
60 //The below are optional, but recommended if there are sufficient timers/compares
61 #define IGN5_COMPARE <register here>
62 #define IGN6_COMPARE <register here>
63 #define IGN7_COMPARE <register here>
64 #define IGN8_COMPARE <register here>
65
66 static inline void FUEL1_TIMER_ENABLE(void) {<macro here>;}
67 static inline void FUEL2_TIMER_ENABLE(void) {<macro here>;}
68 static inline void FUEL3_TIMER_ENABLE(void) {<macro here>;}
69 static inline void FUEL4_TIMER_ENABLE(void) {<macro here>;}
70 //The below are optional, but recommended if there are sufficient timers/compares
71 static inline void FUEL5_TIMER_ENABLE(void) {<macro here>;}
72 static inline void FUEL6_TIMER_ENABLE(void) {<macro here>;}
73 static inline void FUEL7_TIMER_ENABLE(void) {<macro here>;}
74 static inline void FUEL8_TIMER_ENABLE(void) {<macro here>;}
75
76 static inline void FUEL1_TIMER_DISABLE(void) { <macro here>;}
77 static inline void FUEL2_TIMER_DISABLE(void) { <macro here>;}
78 static inline void FUEL3_TIMER_DISABLE(void) { <macro here>;}
79 static inline void FUEL4_TIMER_DISABLE(void) { <macro here>;}
80 //The below are optional, but recommended if there are sufficient timers/compares
81 static inline void FUEL5_TIMER_DISABLE(void) { <macro here>;}
82 static inline void FUEL6_TIMER_DISABLE(void) { <macro here>;}
83 static inline void FUEL7_TIMER_DISABLE(void) { <macro here>;}
84 static inline void FUEL8_TIMER_DISABLE(void) { <macro here>;}
85
86 static inline void IGN1_TIMER_ENABLE(void) {<macro here>;}
87 static inline void IGN2_TIMER_ENABLE(void) {<macro here>;}
88 static inline void IGN3_TIMER_ENABLE(void) {<macro here>;}
89 static inline void IGN4_TIMER_ENABLE(void) {<macro here>;}
90 //The below are optional, but recommended if there are sufficient timers/compares
91 static inline void IGN5_TIMER_ENABLE(void) {<macro here>;}
92 static inline void IGN6_TIMER_ENABLE(void) {<macro here>;}
93 static inline void IGN7_TIMER_ENABLE(void) {<macro here>;}
94 static inline void IGN8_TIMER_ENABLE(void) {<macro here>;}
95
96 static inline void IGN1_TIMER_DISABLE(void) {<macro here>;}
97 static inline void IGN2_TIMER_DISABLE(void) {<macro here>;}
98 static inline void IGN3_TIMER_DISABLE(void) {<macro here>;}
99 static inline void IGN4_TIMER_DISABLE(void) {<macro here>;}
100 //The below are optional, but recommended if there are suffici;}ent timers/compares
101 static inline void IGN5_TIMER_DISABLE(void) {<macro here>;}
102 static inline void IGN6_TIMER_DISABLE(void) {<macro here>;}
103 static inline void IGN7_TIMER_DISABLE(void) {<macro here>;}
104 static inline void IGN8_TIMER_DISABLE(void) {<macro here>;}
105
106
107 #define MAX_TIMER_PERIOD 139808 //This is the maximum time, in uS, that the compare channels can run before overflowing. It is typically 65535 * <how long each tick represents>
108 #define uS_TO_TIMER_COMPARE(uS) ((uS * 15) >> 5) //Converts a given number of uS into the required number of timer ticks until that time has passed.
109
110/*
111***********************************************************************************************************
112* Auxiliaries
113*/
114 //macro functions for enabling and disabling timer interrupts for the boost and vvt functions
115 #define ENABLE_BOOST_TIMER() <macro here>
116 #define DISABLE_BOOST_TIMER(void) { <macro here>
117
118 #define ENABLE_VVT_TIMER() <macro here>
119 #define DISABLE_VVT_TIMER() <macro here>
120
121 #define BOOST_TIMER_COMPARE <register here>
122 #define BOOST_TIMER_COUNTER <register here>
123 #define VVT_TIMER_COMPARE <register here>
124 #define VVT_TIMER_COUNTER <register here>
125
126/*
127***********************************************************************************************************
128* Idle
129*/
130 //Same as above, but for the timer controlling PWM idle
131 #define IDLE_COUNTER <register here>
132 #define IDLE_COMPARE <register here>
133
134 #define IDLE_TIMER_ENABLE() <macro here>
135 #define IDLE_TIMER_DISABLE() <macro here>
136
137/*
138***********************************************************************************************************
139* CAN / Second serial
140*/
141
142
143#endif //CORE_TEMPLATE
144#endif //TEMPLATE_H
static void IGN1_TIMER_ENABLE(void)
Definition board_avr2560.h:109
static void IGN3_TIMER_DISABLE(void)
Definition board_avr2560.h:120
static void IGN1_TIMER_DISABLE(void)
Definition board_avr2560.h:118
static void FUEL2_TIMER_ENABLE(void)
Definition board_avr2560.h:91
static void FUEL1_TIMER_DISABLE(void)
Definition board_avr2560.h:99
static void FUEL4_TIMER_DISABLE(void)
Definition board_avr2560.h:102
static void IGN3_TIMER_ENABLE(void)
Definition board_avr2560.h:111
static void FUEL4_TIMER_ENABLE(void)
Definition board_avr2560.h:93
int eeprom_address_t
Definition board_avr2560.h:37
static void FUEL5_TIMER_DISABLE(void)
Definition board_avr2560.h:103
static void FUEL2_TIMER_DISABLE(void)
Definition board_avr2560.h:100
static void FUEL3_TIMER_DISABLE(void)
Definition board_avr2560.h:101
static void IGN5_TIMER_ENABLE(void)
Definition board_avr2560.h:113
static bool pinIsReserved(uint8_t pin)
Definition board_avr2560.h:46
static void FUEL7_TIMER_DISABLE(void)
Definition board_avr2560.h:105
static void FUEL7_TIMER_ENABLE(void)
Definition board_avr2560.h:96
static void FUEL3_TIMER_ENABLE(void)
Definition board_avr2560.h:92
static void FUEL6_TIMER_ENABLE(void)
Definition board_avr2560.h:95
static void IGN6_TIMER_DISABLE(void)
Definition board_avr2560.h:123
static void FUEL6_TIMER_DISABLE(void)
Definition board_avr2560.h:104
static void IGN7_TIMER_DISABLE(void)
Definition board_avr2560.h:124
static void IGN2_TIMER_DISABLE(void)
Definition board_avr2560.h:119
static void IGN8_TIMER_DISABLE(void)
Definition board_avr2560.h:125
static void IGN6_TIMER_ENABLE(void)
Definition board_avr2560.h:114
static void IGN2_TIMER_ENABLE(void)
Definition board_avr2560.h:110
static void IGN8_TIMER_ENABLE(void)
Definition board_avr2560.h:116
static void FUEL8_TIMER_DISABLE(void)
Definition board_avr2560.h:106
static void IGN4_TIMER_ENABLE(void)
Definition board_avr2560.h:112
static void IGN7_TIMER_ENABLE(void)
Definition board_avr2560.h:115
static void IGN5_TIMER_DISABLE(void)
Definition board_avr2560.h:122
static void IGN4_TIMER_DISABLE(void)
Definition board_avr2560.h:121
static void FUEL1_TIMER_ENABLE(void)
Definition board_avr2560.h:90
static void FUEL8_TIMER_ENABLE(void)
Definition board_avr2560.h:97
static void FUEL5_TIMER_ENABLE(void)
Definition board_avr2560.h:94