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 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 void initBoard();
17 void doSystemReset();
18 void jumpToBootloader();
20
21 #define pinIsReserved(pin) ( ((pin) == 0) ) //Forbidden pins like USB
22
23/*
24***********************************************************************************************************
25* Schedules
26*/
27
28 #define FUEL1_COUNTER <register here>
29 #define FUEL2_COUNTER <register here>
30 #define FUEL3_COUNTER <register here>
31 #define FUEL4_COUNTER <register here>
32 //The below are optional, but recommended if there are sufficient timers/compares
33 #define FUEL5_COUNTER <register here>
34 #define FUEL6_COUNTER <register here>
35 #define FUEL7_COUNTER <register here>
36 #define FUEL8_COUNTER <register here>
37
38 #define IGN1_COUNTER <register here>
39 #define IGN2_COUNTER <register here>
40 #define IGN3_COUNTER <register here>
41 #define IGN4_COUNTER <register here>
42 //The below are optional, but recommended if there are sufficient timers/compares
43 #define IGN5_COUNTER <register here>
44 #define IGN6_COUNTER <register here>
45 #define IGN7_COUNTER <register here>
46 #define IGN8_COUNTER <register here>
47
48 #define FUEL1_COMPARE <register here>
49 #define FUEL2_COMPARE <register here>
50 #define FUEL3_COMPARE <register here>
51 #define FUEL4_COMPARE <register here>
52 //The below are optional, but recommended if there are sufficient timers/compares
53 #define FUEL5_COMPARE <register here>
54 #define FUEL6_COMPARE <register here>
55 #define FUEL7_COMPARE <register here>
56 #define FUEL8_COMPARE <register here>
57
58 #define IGN1_COMPARE <register here>
59 #define IGN2_COMPARE <register here>
60 #define IGN3_COMPARE <register here>
61 #define IGN4_COMPARE <register here>
62 //The below are optional, but recommended if there are sufficient timers/compares
63 #define IGN5_COMPARE <register here>
64 #define IGN6_COMPARE <register here>
65 #define IGN7_COMPARE <register here>
66 #define IGN8_COMPARE <register here>
67
68 static inline void FUEL1_TIMER_ENABLE(void) {<macro here>;}
69 static inline void FUEL2_TIMER_ENABLE(void) {<macro here>;}
70 static inline void FUEL3_TIMER_ENABLE(void) {<macro here>;}
71 static inline void FUEL4_TIMER_ENABLE(void) {<macro here>;}
72 //The below are optional, but recommended if there are sufficient timers/compares
73 static inline void FUEL5_TIMER_ENABLE(void) {<macro here>;}
74 static inline void FUEL6_TIMER_ENABLE(void) {<macro here>;}
75 static inline void FUEL7_TIMER_ENABLE(void) {<macro here>;}
76 static inline void FUEL8_TIMER_ENABLE(void) {<macro here>;}
77
78 static inline void FUEL1_TIMER_DISABLE(void) { <macro here>;}
79 static inline void FUEL2_TIMER_DISABLE(void) { <macro here>;}
80 static inline void FUEL3_TIMER_DISABLE(void) { <macro here>;}
81 static inline void FUEL4_TIMER_DISABLE(void) { <macro here>;}
82 //The below are optional, but recommended if there are sufficient timers/compares
83 static inline void FUEL5_TIMER_DISABLE(void) { <macro here>;}
84 static inline void FUEL6_TIMER_DISABLE(void) { <macro here>;}
85 static inline void FUEL7_TIMER_DISABLE(void) { <macro here>;}
86 static inline void FUEL8_TIMER_DISABLE(void) { <macro here>;}
87
88 static inline void IGN1_TIMER_ENABLE(void) {<macro here>;}
89 static inline void IGN2_TIMER_ENABLE(void) {<macro here>;}
90 static inline void IGN3_TIMER_ENABLE(void) {<macro here>;}
91 static inline void IGN4_TIMER_ENABLE(void) {<macro here>;}
92 //The below are optional, but recommended if there are sufficient timers/compares
93 static inline void IGN5_TIMER_ENABLE(void) {<macro here>;}
94 static inline void IGN6_TIMER_ENABLE(void) {<macro here>;}
95 static inline void IGN7_TIMER_ENABLE(void) {<macro here>;}
96 static inline void IGN8_TIMER_ENABLE(void) {<macro here>;}
97
98 static inline void IGN1_TIMER_DISABLE(void) {<macro here>;}
99 static inline void IGN2_TIMER_DISABLE(void) {<macro here>;}
100 static inline void IGN3_TIMER_DISABLE(void) {<macro here>;}
101 static inline void IGN4_TIMER_DISABLE(void) {<macro here>;}
102 //The below are optional, but recommended if there are suffici;}ent timers/compares
103 static inline void IGN5_TIMER_DISABLE(void) {<macro here>;}
104 static inline void IGN6_TIMER_DISABLE(void) {<macro here>;}
105 static inline void IGN7_TIMER_DISABLE(void) {<macro here>;}
106 static inline void IGN8_TIMER_DISABLE(void) {<macro here>;}
107
108
109 #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>
110 #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.
111
112/*
113***********************************************************************************************************
114* Auxiliaries
115*/
116 //macro functions for enabling and disabling timer interrupts for the boost and vvt functions
117 #define ENABLE_BOOST_TIMER() <macro here>
118 #define DISABLE_BOOST_TIMER(void) { <macro here>
119
120 #define ENABLE_VVT_TIMER() <macro here>
121 #define DISABLE_VVT_TIMER() <macro here>
122
123 #define BOOST_TIMER_COMPARE <register here>
124 #define BOOST_TIMER_COUNTER <register here>
125 #define VVT_TIMER_COMPARE <register here>
126 #define VVT_TIMER_COUNTER <register here>
127
128/*
129***********************************************************************************************************
130* Idle
131*/
132 //Same as above, but for the timer controlling PWM idle
133 #define IDLE_COUNTER <register here>
134 #define IDLE_COMPARE <register here>
135
136 #define IDLE_TIMER_ENABLE() <macro here>
137 #define IDLE_TIMER_DISABLE() <macro here>
138
139/*
140***********************************************************************************************************
141* CAN / Second serial
142*/
143
144
145#endif //CORE_TEMPLATE
146#endif //TEMPLATE_H
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:348