#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 BOARD_NR_GPIO_PINS 52 //Not sure this is correct #define BOARD_DIGITAL_GPIO_PINS 52 //Pretty sure this isn't right #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(); /* *********************************************************************************************************** * 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 #define FUEL1_TIMER_ENABLE() #define FUEL2_TIMER_ENABLE() #define FUEL3_TIMER_ENABLE() #define FUEL4_TIMER_ENABLE() //The below are optional, but recommended if there are sufficient timers/compares #define FUEL5_TIMER_ENABLE() #define FUEL6_TIMER_ENABLE() #define FUEL7_TIMER_ENABLE() #define FUEL8_TIMER_ENABLE() #define FUEL1_TIMER_DISABLE() #define FUEL2_TIMER_DISABLE() #define FUEL3_TIMER_DISABLE() #define FUEL4_TIMER_DISABLE() //The below are optional, but recommended if there are sufficient timers/compares #define FUEL5_TIMER_DISABLE() #define FUEL6_TIMER_DISABLE() #define FUEL7_TIMER_DISABLE() #define FUEL8_TIMER_DISABLE() #define IGN1_TIMER_ENABLE() #define IGN2_TIMER_ENABLE() #define IGN3_TIMER_ENABLE() #define IGN4_TIMER_ENABLE() //The below are optional, but recommended if there are sufficient timers/compares #define IGN5_TIMER_ENABLE() #define IGN6_TIMER_ENABLE() #define IGN7_TIMER_ENABLE() #define IGN8_TIMER_ENABLE() #define IGN1_TIMER_DISABLE() #define IGN2_TIMER_DISABLE() #define IGN3_TIMER_DISABLE() #define IGN4_TIMER_DISABLE() //The below are optional, but recommended if there are sufficient timers/compares #define IGN5_TIMER_DISABLE() #define IGN6_TIMER_DISABLE() #define IGN7_TIMER_DISABLE() #define IGN8_TIMER_DISABLE() #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 MAX_TIMER_PERIOD_SLOW 139808 //If there is a second timer speed used, this is the same as above for that #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. #define uS_TO_TIMER_COMPARE_SLOW(uS) ((uS * 15) >> 5) //As above, but for the alternative slow timer if required /* *********************************************************************************************************** * Auxilliaries */ //macro functions for enabling and disabling timer interrupts for the boost and vvt functions #define ENABLE_BOOST_TIMER() #define DISABLE_BOOST_TIMER() #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