#ifndef TEMPLATE_H #define TEMPLATE_H #if defined(CORE_TEMPLATE) /* *********************************************************************************************************** * General */ #define PORT_TYPE uint32_t //Size of the port variables (Eg inj1_pin_port). Most systems use a byte, but SAMD21 and possibly others are a 32-bit unsigned int #define PINMASK_TYPE uint32_t #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) #define FPU_MAX_SIZE 0 //Size of the FPU buffer. 0 means no FPU. #define BOARD_MAX_IO_PINS 52 //digital pins + analog channels + 1 #define BOARD_MAX_DIGITAL_PINS 52 //Pretty sure this isn't right #define EEPROM_LIB_H //The name of the file that provides the EEPROM class typedef int eeprom_address_t; #define micros_safe() micros() //timer5 method is not used on anything but AVR, the micros_safe() macro is simply an alias for the normal micros() void initBoard(); uint16_t freeRam(); void doSystemReset(); void jumpToBootloader(); #define pinIsReserved(pin) ( ((pin) == 0) ) //Forbidden pins like USB /* *********************************************************************************************************** * Schedules */ #define FUEL1_COUNTER #define FUEL2_COUNTER #define FUEL3_COUNTER #define FUEL4_COUNTER //The below are optional, but recommended if there are sufficient timers/compares #define FUEL5_COUNTER #define FUEL6_COUNTER #define FUEL7_COUNTER #define FUEL8_COUNTER #define IGN1_COUNTER #define IGN2_COUNTER #define IGN3_COUNTER #define IGN4_COUNTER //The below are optional, but recommended if there are sufficient timers/compares #define IGN5_COUNTER #define IGN6_COUNTER #define IGN7_COUNTER #define IGN8_COUNTER #define FUEL1_COMPARE #define FUEL2_COMPARE #define FUEL3_COMPARE #define FUEL4_COMPARE //The below are optional, but recommended if there are sufficient timers/compares #define FUEL5_COMPARE #define FUEL6_COMPARE #define FUEL7_COMPARE #define FUEL8_COMPARE #define IGN1_COMPARE #define IGN2_COMPARE #define IGN3_COMPARE #define IGN4_COMPARE //The below are optional, but recommended if there are sufficient timers/compares #define IGN5_COMPARE #define IGN6_COMPARE #define IGN7_COMPARE #define IGN8_COMPARE static inline void FUEL1_TIMER_ENABLE(void) {;} static inline void FUEL2_TIMER_ENABLE(void) {;} static inline void FUEL3_TIMER_ENABLE(void) {;} static inline void FUEL4_TIMER_ENABLE(void) {;} //The below are optional, but recommended if there are sufficient timers/compares static inline void FUEL5_TIMER_ENABLE(void) {;} static inline void FUEL6_TIMER_ENABLE(void) {;} static inline void FUEL7_TIMER_ENABLE(void) {;} static inline void FUEL8_TIMER_ENABLE(void) {;} static inline void FUEL1_TIMER_DISABLE(void) { ;} static inline void FUEL2_TIMER_DISABLE(void) { ;} static inline void FUEL3_TIMER_DISABLE(void) { ;} static inline void FUEL4_TIMER_DISABLE(void) { ;} //The below are optional, but recommended if there are sufficient timers/compares static inline void FUEL5_TIMER_DISABLE(void) { ;} static inline void FUEL6_TIMER_DISABLE(void) { ;} static inline void FUEL7_TIMER_DISABLE(void) { ;} static inline void FUEL8_TIMER_DISABLE(void) { ;} static inline void IGN1_TIMER_ENABLE(void) {;} static inline void IGN2_TIMER_ENABLE(void) {;} static inline void IGN3_TIMER_ENABLE(void) {;} static inline void IGN4_TIMER_ENABLE(void) {;} //The below are optional, but recommended if there are sufficient timers/compares static inline void IGN5_TIMER_ENABLE(void) {;} static inline void IGN6_TIMER_ENABLE(void) {;} static inline void IGN7_TIMER_ENABLE(void) {;} static inline void IGN8_TIMER_ENABLE(void) {;} static inline void IGN1_TIMER_DISABLE(void) {;} static inline void IGN2_TIMER_DISABLE(void) {;} static inline void IGN3_TIMER_DISABLE(void) {;} static inline void IGN4_TIMER_DISABLE(void) {;} //The below are optional, but recommended if there are suffici;}ent timers/compares static inline void IGN5_TIMER_DISABLE(void) {;} static inline void IGN6_TIMER_DISABLE(void) {;} static inline void IGN7_TIMER_DISABLE(void) {;} static inline void IGN8_TIMER_DISABLE(void) {;} #define MAX_TIMER_PERIOD 139808 //This is the maximum time, in uS, that the compare channels can run before overflowing. It is typically 65535 * #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. /* *********************************************************************************************************** * Auxiliaries */ //macro functions for enabling and disabling timer interrupts for the boost and vvt functions #define ENABLE_BOOST_TIMER() #define DISABLE_BOOST_TIMER(void) { #define ENABLE_VVT_TIMER() #define DISABLE_VVT_TIMER() #define BOOST_TIMER_COMPARE #define BOOST_TIMER_COUNTER #define VVT_TIMER_COMPARE #define VVT_TIMER_COUNTER /* *********************************************************************************************************** * Idle */ //Same as above, but for the timer controlling PWM idle #define IDLE_COUNTER #define IDLE_COMPARE #define IDLE_TIMER_ENABLE() #define IDLE_TIMER_DISABLE() /* *********************************************************************************************************** * CAN / Second serial */ #endif //CORE_TEMPLATE #endif //TEMPLATE_H