2019-01-22 20:19:54 -08:00
# 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
2019-03-03 14:15:57 -08:00
# define PINMASK_TYPE uint32_t
2021-11-19 13:29:11 -08:00
# 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)
2022-08-09 19:12:42 -07:00
# define FPU_MAX_SIZE 0 //Size of the FPU buffer. 0 means no FPU.
2021-02-01 15:00:04 -08:00
# define BOARD_MAX_IO_PINS 52 //digital pins + analog channels + 1
# define BOARD_MAX_DIGITAL_PINS 52 //Pretty sure this isn't right
2019-03-04 06:02:02 -08:00
# define EEPROM_LIB_H <EEPROM.h> //The name of the file that provides the EEPROM class
2021-09-13 23:51:26 -07:00
typedef int eeprom_address_t ;
2019-01-22 20:19:54 -08:00
# 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 ( ) ;
2020-12-02 14:24:15 -08:00
void doSystemReset ( ) ;
void jumpToBootloader ( ) ;
2019-01-22 20:19:54 -08:00
2022-04-10 17:49:58 -07:00
# define pinIsReserved(pin) ( ((pin) == 0) ) //Forbidden pins like USB
2019-01-22 20:19:54 -08:00
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Schedules
*/
# define FUEL1_COUNTER <register here>
# define FUEL2_COUNTER <register here>
# define FUEL3_COUNTER <register here>
# define FUEL4_COUNTER <register here>
//The below are optional, but recommended if there are sufficient timers/compares
# define FUEL5_COUNTER <register here>
# define FUEL6_COUNTER <register here>
# define FUEL7_COUNTER <register here>
# define FUEL8_COUNTER <register here>
# define IGN1_COUNTER <register here>
# define IGN2_COUNTER <register here>
# define IGN3_COUNTER <register here>
# define IGN4_COUNTER <register here>
//The below are optional, but recommended if there are sufficient timers/compares
# define IGN5_COUNTER <register here>
# define IGN6_COUNTER <register here>
# define IGN7_COUNTER <register here>
# define IGN8_COUNTER <register here>
# define FUEL1_COMPARE <register here>
# define FUEL2_COMPARE <register here>
# define FUEL3_COMPARE <register here>
# define FUEL4_COMPARE <register here>
//The below are optional, but recommended if there are sufficient timers/compares
# define FUEL5_COMPARE <register here>
# define FUEL6_COMPARE <register here>
# define FUEL7_COMPARE <register here>
# define FUEL8_COMPARE <register here>
# define IGN1_COMPARE <register here>
# define IGN2_COMPARE <register here>
# define IGN3_COMPARE <register here>
# define IGN4_COMPARE <register here>
//The below are optional, but recommended if there are sufficient timers/compares
# define IGN5_COMPARE <register here>
# define IGN6_COMPARE <register here>
# define IGN7_COMPARE <register here>
# define IGN8_COMPARE <register here>
2023-10-06 14:25:26 -07:00
static inline void FUEL1_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL2_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL3_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL4_TIMER_ENABLE ( void ) { < macro here > ; }
2019-01-22 20:19:54 -08:00
//The below are optional, but recommended if there are sufficient timers/compares
2023-10-06 14:25:26 -07:00
static inline void FUEL5_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL6_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL7_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL8_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void FUEL1_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL2_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL3_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL4_TIMER_DISABLE ( void ) { < macro here > ; }
2019-01-22 20:19:54 -08:00
//The below are optional, but recommended if there are sufficient timers/compares
2023-10-06 14:25:26 -07:00
static inline void FUEL5_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL6_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL7_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void FUEL8_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN1_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN2_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN3_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN4_TIMER_ENABLE ( void ) { < macro here > ; }
2019-01-22 20:19:54 -08:00
//The below are optional, but recommended if there are sufficient timers/compares
2023-10-06 14:25:26 -07:00
static inline void IGN5_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN6_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN7_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN8_TIMER_ENABLE ( void ) { < macro here > ; }
static inline void IGN1_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN2_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN3_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN4_TIMER_DISABLE ( void ) { < macro here > ; }
//The below are optional, but recommended if there are suffici;}ent timers/compares
static inline void IGN5_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN6_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN7_TIMER_DISABLE ( void ) { < macro here > ; }
static inline void IGN8_TIMER_DISABLE ( void ) { < macro here > ; }
2019-01-22 20:19:54 -08:00
# 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>
# 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.
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2022-04-10 17:49:58 -07:00
* Auxiliaries
2019-01-22 20:19:54 -08:00
*/
//macro functions for enabling and disabling timer interrupts for the boost and vvt functions
# define ENABLE_BOOST_TIMER() <macro here>
2023-10-06 14:25:26 -07:00
# define DISABLE_BOOST_TIMER(void) { <macro here>
2019-01-22 20:19:54 -08:00
# define ENABLE_VVT_TIMER() <macro here>
# define DISABLE_VVT_TIMER() <macro here>
# define BOOST_TIMER_COMPARE <register here>
# define BOOST_TIMER_COUNTER <register here>
# define VVT_TIMER_COMPARE <register here>
# define VVT_TIMER_COUNTER <register here>
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Idle
*/
//Same as above, but for the timer controlling PWM idle
# define IDLE_COUNTER <register here>
# define IDLE_COMPARE <register here>
# define IDLE_TIMER_ENABLE() <macro here>
# define IDLE_TIMER_DISABLE() <macro here>
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* CAN / Second serial
*/
# endif //CORE_TEMPLATE
2022-04-10 17:49:58 -07:00
# endif //TEMPLATE_H