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