Speeduino
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
board_avr2560.h File Reference
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include "src/pins/fastInputPin.h"
#include "src/pins/fastOutputPin.h"

Go to the source code of this file.

Macros

#define CORE_AVR
 
#define BOARD_MAX_DIGITAL_PINS   54
 
#define BOARD_MAX_IO_PINS   70
 
#define LED_BUILTIN   13
 
#define INJ_CHANNELS   4
 
#define IGN_CHANNELS   5
 
#define TS_SERIAL_BUFFER_SIZE   (256+7+1)
 
#define FPU_MAX_SIZE   0
 
#define RTC_LIB_H   <Time.h>
 
#define FUEL1_COUNTER   TCNT3
 
#define FUEL2_COUNTER   TCNT3
 
#define FUEL3_COUNTER   TCNT3
 
#define FUEL4_COUNTER   TCNT4
 
#define FUEL5_COUNTER   TCNT4
 
#define FUEL6_COUNTER   TCNT4
 
#define FUEL7_COUNTER   TCNT5
 
#define FUEL8_COUNTER   TCNT5
 
#define IGN1_COUNTER   TCNT5
 
#define IGN2_COUNTER   TCNT5
 
#define IGN3_COUNTER   TCNT5
 
#define IGN4_COUNTER   TCNT4
 
#define IGN5_COUNTER   TCNT4
 
#define IGN6_COUNTER   TCNT4
 
#define IGN7_COUNTER   TCNT3
 
#define IGN8_COUNTER   TCNT3
 
#define FUEL1_COMPARE   OCR3A
 
#define FUEL2_COMPARE   OCR3B
 
#define FUEL3_COMPARE   OCR3C
 
#define FUEL4_COMPARE   OCR4B
 
#define FUEL5_COMPARE   OCR4C
 
#define FUEL6_COMPARE   OCR4A
 
#define FUEL7_COMPARE   OCR5C
 
#define FUEL8_COMPARE   OCR5B
 
#define IGN1_COMPARE   OCR5A
 
#define IGN2_COMPARE   OCR5B
 
#define IGN3_COMPARE   OCR5C
 
#define IGN4_COMPARE   OCR4A
 
#define IGN5_COMPARE   OCR4C
 
#define IGN6_COMPARE   OCR4B
 
#define IGN7_COMPARE   OCR3C
 
#define IGN8_COMPARE   OCR3B
 
#define ENABLE_BOOST_TIMER()   TIMSK1 |= (1 << OCIE1A)
 
#define DISABLE_BOOST_TIMER()   TIMSK1 &= ~(1 << OCIE1A)
 
#define ENABLE_VVT_TIMER()   TIMSK1 |= (1 << OCIE1B)
 
#define DISABLE_VVT_TIMER()   TIMSK1 &= ~(1 << OCIE1B)
 
#define BOOST_TIMER_COMPARE   OCR1A
 
#define BOOST_TIMER_COUNTER   TCNT1
 
#define VVT_TIMER_COMPARE   OCR1B
 
#define VVT_TIMER_COUNTER   TCNT1
 
#define IDLE_COUNTER   TCNT1
 
#define IDLE_COMPARE   OCR1C
 
#define IDLE_TIMER_ENABLE()   TIMSK1 |= (1 << OCIE1C)
 
#define IDLE_TIMER_DISABLE()   TIMSK1 &= ~(1 << OCIE1C)
 
#define SECONDARY_SERIAL_T   HardwareSerial
 

Typedefs

using COMPARE_TYPE = uint16_t
 The timer overflow type.
 
using boardInputPin_t = fastInputPin_t
 
using boardOutputPin_t = fastOutputPin_t
 

Functions

static constexpr COMPARE_TYPE uS_TO_TIMER_COMPARE (uint32_t micros)
 Convert µS to timer ticks.
 
static constexpr uint32_t ticksToMicros (COMPARE_TYPE ticks)
 Convert timer ticks to µS.
 
static bool pinIsReserved (uint8_t pin)
 
static void FUEL1_TIMER_ENABLE (void)
 
static void FUEL2_TIMER_ENABLE (void)
 
static void FUEL3_TIMER_ENABLE (void)
 
static void FUEL4_TIMER_ENABLE (void)
 
static void FUEL5_TIMER_ENABLE (void)
 
static void FUEL6_TIMER_ENABLE (void)
 
static void FUEL7_TIMER_ENABLE (void)
 
static void FUEL8_TIMER_ENABLE (void)
 
static void FUEL1_TIMER_DISABLE (void)
 
static void FUEL2_TIMER_DISABLE (void)
 
static void FUEL3_TIMER_DISABLE (void)
 
static void FUEL4_TIMER_DISABLE (void)
 
static void FUEL5_TIMER_DISABLE (void)
 
static void FUEL6_TIMER_DISABLE (void)
 
static void FUEL7_TIMER_DISABLE (void)
 
static void FUEL8_TIMER_DISABLE (void)
 
static void IGN1_TIMER_ENABLE (void)
 
static void IGN2_TIMER_ENABLE (void)
 
static void IGN3_TIMER_ENABLE (void)
 
static void IGN4_TIMER_ENABLE (void)
 
static void IGN5_TIMER_ENABLE (void)
 
static void IGN6_TIMER_ENABLE (void)
 
static void IGN7_TIMER_ENABLE (void)
 
static void IGN8_TIMER_ENABLE (void)
 
static void IGN1_TIMER_DISABLE (void)
 
static void IGN2_TIMER_DISABLE (void)
 
static void IGN3_TIMER_DISABLE (void)
 
static void IGN4_TIMER_DISABLE (void)
 
static void IGN5_TIMER_DISABLE (void)
 
static void IGN6_TIMER_DISABLE (void)
 
static void IGN7_TIMER_DISABLE (void)
 
static void IGN8_TIMER_DISABLE (void)
 

Variables

constexpr uint16_t BLOCKING_FACTOR = 121
 
constexpr uint16_t TABLE_BLOCKING_FACTOR = 64
 
constexpr uint8_t ANALOG_PINS [] = { _ANALOG_PINS_A0_A14 }
 Analog pin mapping.
 
constexpr uint8_t SERIAL_BUFFER_THRESHOLD = 32U
 When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure.
 

Macro Definition Documentation

◆ BOARD_MAX_DIGITAL_PINS

#define BOARD_MAX_DIGITAL_PINS   54

◆ BOARD_MAX_IO_PINS

#define BOARD_MAX_IO_PINS   70

◆ BOOST_TIMER_COMPARE

#define BOOST_TIMER_COMPARE   OCR1A

◆ BOOST_TIMER_COUNTER

#define BOOST_TIMER_COUNTER   TCNT1

◆ CORE_AVR

#define CORE_AVR

DO NOT INCLUDE DIRECTLY - should be included via board_definition.h

◆ DISABLE_BOOST_TIMER

#define DISABLE_BOOST_TIMER ( )    TIMSK1 &= ~(1 << OCIE1A)

◆ DISABLE_VVT_TIMER

#define DISABLE_VVT_TIMER ( )    TIMSK1 &= ~(1 << OCIE1B)

◆ ENABLE_BOOST_TIMER

#define ENABLE_BOOST_TIMER ( )    TIMSK1 |= (1 << OCIE1A)

◆ ENABLE_VVT_TIMER

#define ENABLE_VVT_TIMER ( )    TIMSK1 |= (1 << OCIE1B)

◆ FPU_MAX_SIZE

#define FPU_MAX_SIZE   0

◆ FUEL1_COMPARE

#define FUEL1_COMPARE   OCR3A

◆ FUEL1_COUNTER

#define FUEL1_COUNTER   TCNT3

◆ FUEL2_COMPARE

#define FUEL2_COMPARE   OCR3B

◆ FUEL2_COUNTER

#define FUEL2_COUNTER   TCNT3

◆ FUEL3_COMPARE

#define FUEL3_COMPARE   OCR3C

◆ FUEL3_COUNTER

#define FUEL3_COUNTER   TCNT3

◆ FUEL4_COMPARE

#define FUEL4_COMPARE   OCR4B

◆ FUEL4_COUNTER

#define FUEL4_COUNTER   TCNT4

◆ FUEL5_COMPARE

#define FUEL5_COMPARE   OCR4C

◆ FUEL5_COUNTER

#define FUEL5_COUNTER   TCNT4

◆ FUEL6_COMPARE

#define FUEL6_COMPARE   OCR4A

◆ FUEL6_COUNTER

#define FUEL6_COUNTER   TCNT4

◆ FUEL7_COMPARE

#define FUEL7_COMPARE   OCR5C

◆ FUEL7_COUNTER

#define FUEL7_COUNTER   TCNT5

◆ FUEL8_COMPARE

#define FUEL8_COMPARE   OCR5B

◆ FUEL8_COUNTER

#define FUEL8_COUNTER   TCNT5

◆ IDLE_COMPARE

#define IDLE_COMPARE   OCR1C

◆ IDLE_COUNTER

#define IDLE_COUNTER   TCNT1

◆ IDLE_TIMER_DISABLE

#define IDLE_TIMER_DISABLE ( )    TIMSK1 &= ~(1 << OCIE1C)

◆ IDLE_TIMER_ENABLE

#define IDLE_TIMER_ENABLE ( )    TIMSK1 |= (1 << OCIE1C)

◆ IGN1_COMPARE

#define IGN1_COMPARE   OCR5A

◆ IGN1_COUNTER

#define IGN1_COUNTER   TCNT5

◆ IGN2_COMPARE

#define IGN2_COMPARE   OCR5B

◆ IGN2_COUNTER

#define IGN2_COUNTER   TCNT5

◆ IGN3_COMPARE

#define IGN3_COMPARE   OCR5C

◆ IGN3_COUNTER

#define IGN3_COUNTER   TCNT5

◆ IGN4_COMPARE

#define IGN4_COMPARE   OCR4A

◆ IGN4_COUNTER

#define IGN4_COUNTER   TCNT4

◆ IGN5_COMPARE

#define IGN5_COMPARE   OCR4C

◆ IGN5_COUNTER

#define IGN5_COUNTER   TCNT4

◆ IGN6_COMPARE

#define IGN6_COMPARE   OCR4B

◆ IGN6_COUNTER

#define IGN6_COUNTER   TCNT4

◆ IGN7_COMPARE

#define IGN7_COMPARE   OCR3C

◆ IGN7_COUNTER

#define IGN7_COUNTER   TCNT3

◆ IGN8_COMPARE

#define IGN8_COMPARE   OCR3B

◆ IGN8_COUNTER

#define IGN8_COUNTER   TCNT3

◆ IGN_CHANNELS

#define IGN_CHANNELS   5

◆ INJ_CHANNELS

#define INJ_CHANNELS   4

◆ LED_BUILTIN

#define LED_BUILTIN   13

◆ RTC_LIB_H

#define RTC_LIB_H   <Time.h>

◆ SECONDARY_SERIAL_T

#define SECONDARY_SERIAL_T   HardwareSerial

◆ TS_SERIAL_BUFFER_SIZE

#define TS_SERIAL_BUFFER_SIZE   (256+7+1)

◆ VVT_TIMER_COMPARE

#define VVT_TIMER_COMPARE   OCR1B

◆ VVT_TIMER_COUNTER

#define VVT_TIMER_COUNTER   TCNT1

Typedef Documentation

◆ boardInputPin_t

◆ boardOutputPin_t

◆ COMPARE_TYPE

The timer overflow type.

On some boards timers can overflow at less than the timer register width

Function Documentation

◆ FUEL1_TIMER_DISABLE()

static void FUEL1_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL1_TIMER_ENABLE()

static void FUEL1_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL2_TIMER_DISABLE()

static void FUEL2_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL2_TIMER_ENABLE()

static void FUEL2_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL3_TIMER_DISABLE()

static void FUEL3_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL3_TIMER_ENABLE()

static void FUEL3_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL4_TIMER_DISABLE()

static void FUEL4_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL4_TIMER_ENABLE()

static void FUEL4_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL5_TIMER_DISABLE()

static void FUEL5_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL5_TIMER_ENABLE()

static void FUEL5_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL6_TIMER_DISABLE()

static void FUEL6_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL6_TIMER_ENABLE()

static void FUEL6_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL7_TIMER_DISABLE()

static void FUEL7_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL7_TIMER_ENABLE()

static void FUEL7_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL8_TIMER_DISABLE()

static void FUEL8_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ FUEL8_TIMER_ENABLE()

static void FUEL8_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN1_TIMER_DISABLE()

static void IGN1_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN1_TIMER_ENABLE()

static void IGN1_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN2_TIMER_DISABLE()

static void IGN2_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN2_TIMER_ENABLE()

static void IGN2_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN3_TIMER_DISABLE()

static void IGN3_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN3_TIMER_ENABLE()

static void IGN3_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN4_TIMER_DISABLE()

static void IGN4_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN4_TIMER_ENABLE()

static void IGN4_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN5_TIMER_DISABLE()

static void IGN5_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN5_TIMER_ENABLE()

static void IGN5_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN6_TIMER_DISABLE()

static void IGN6_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN6_TIMER_ENABLE()

static void IGN6_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN7_TIMER_DISABLE()

static void IGN7_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN7_TIMER_ENABLE()

static void IGN7_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN8_TIMER_DISABLE()

static void IGN8_TIMER_DISABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ IGN8_TIMER_ENABLE()

static void IGN8_TIMER_ENABLE ( void  )
inlinestatic
Here is the caller graph for this function:

◆ pinIsReserved()

static bool pinIsReserved ( uint8_t  pin)
inlinestatic
Here is the caller graph for this function:

◆ ticksToMicros()

static constexpr uint32_t ticksToMicros ( COMPARE_TYPE  ticks)
staticconstexpr

Convert timer ticks to µS.

◆ uS_TO_TIMER_COMPARE()

static constexpr COMPARE_TYPE uS_TO_TIMER_COMPARE ( uint32_t  micros)
staticconstexpr

Convert µS to timer ticks.

Here is the caller graph for this function:

Variable Documentation

◆ ANALOG_PINS

constexpr uint8_t ANALOG_PINS[] = { _ANALOG_PINS_A0_A14 }
constexpr

Analog pin mapping.

◆ BLOCKING_FACTOR

constexpr uint16_t BLOCKING_FACTOR = 121
constexpr

◆ SERIAL_BUFFER_THRESHOLD

constexpr uint8_t SERIAL_BUFFER_THRESHOLD = 32U
constexpr

When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure.

◆ TABLE_BLOCKING_FACTOR

constexpr uint16_t TABLE_BLOCKING_FACTOR = 64
constexpr