FastArduino - Arduino LEONARDO Support v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
Enumerations | Functions
board Namespace Reference

Defines all types and constants specific to support Arduino LEONARDO board (ATmega32u4 MCU target). More...

Enumerations

enum class  Port : uint8_t {
  PORT_B = 0 ,
  PORT_C ,
  PORT_D ,
  PORT_E ,
  PORT_F ,
  NONE = UINT8_MAX
}
 Defines all available ports of ATmega32u4. More...
 
enum class  DigitalPin : uint8_t {
  D0_PD2 = 0 ,
  D0 = D0_PD2 ,
  D1_PD3 ,
  D1 = D1_PD3 ,
  D2_PD1 ,
  D2 = D2_PD1 ,
  D3_PD0 ,
  D3 = D3_PD0 ,
  D4_PD4 ,
  D4 = D4_PD4 ,
  D5_PC6 ,
  D5 = D5_PC6 ,
  D6_PD7 ,
  D6 = D6_PD7 ,
  D7_PE6 ,
  D7 = D7_PE6 ,
  D8_PB4 ,
  D8 = D8_PB4 ,
  D9_PB5 ,
  D9 = D9_PB5 ,
  D10_PB6 ,
  D10 = D10_PB6 ,
  D11_PB7 ,
  D11 = D11_PB7 ,
  D12_PD6 ,
  D12 = D12_PD6 ,
  D13_PC7 ,
  D13 = D13_PC7 ,
  A0_PF7 ,
  A0 = A0_PF7 ,
  A1_PF6 ,
  A1 = A1_PF6 ,
  A2_PF5 ,
  A2 = A2_PF5 ,
  A3_PF4 ,
  A3 = A3_PF4 ,
  A4_PF1 ,
  A4 = A4_PF1 ,
  A5_PF0 ,
  A5 = A5_PF0 ,
  SCK_PB1 ,
  MOSI_PB2 ,
  MISO_PB3 ,
  RXLED_PB0 ,
  TXLED_PD5 ,
  LED = D13_PC7 ,
  NONE = UINT8_MAX
}
 Defines all available digital input/output pins of ATmega32u4, with reference to Arduino LEONARDO pins. More...
 
enum class  AnalogClock : uint8_t {
  MAX_FREQ_50KHz = 0 ,
  MAX_FREQ_100KHz ,
  MAX_FREQ_200KHz ,
  MAX_FREQ_500KHz ,
  MAX_FREQ_1MHz
}
 Defines available clocks of ATmega32u4, used for analog input. More...
 
enum class  AnalogReference : uint8_t {
  AREF = 0 ,
  AVCC ,
  INTERNAL_2_56V
}
 Defines available voltage references of ATmega32u4, used for analog input. More...
 
enum class  AnalogPin : uint8_t {
  A0_ADC7 = 0 ,
  A0 = A0_ADC7 ,
  A1_ADC6 ,
  A1 = A1_ADC6 ,
  A2_ADC5 ,
  A2 = A2_ADC5 ,
  A3_ADC4 ,
  A3 = A3_ADC4 ,
  A4_ADC1 ,
  A4 = A4_ADC1 ,
  A5_ADC0 ,
  A5 = A5_ADC0 ,
  A6_D4_ADC8 ,
  D4 = A6_D4_ADC8 ,
  A7_D6_ADC10 ,
  D6 = A7_D6_ADC10 ,
  A8_D8_ADC11 ,
  D8 = A8_D8_ADC11 ,
  A9_D9_ADC12 ,
  D9 = A9_D9_ADC12 ,
  A10_D10_ADC13 ,
  D10 = A10_D10_ADC13 ,
  A11_D12_ADC9 ,
  D12 = A11_D12_ADC9 ,
  TEMP ,
  BANDGAP ,
  NONE = UINT8_MAX
}
 Defines all available analog input pins of ATmega32u4, with reference to Arduino LEONARDO pins. More...
 
enum class  PWMPin : uint8_t {
  D11_PB7_OC0A = 0 ,
  D3_PD0_OC0B ,
  D9_PB5_OC1A ,
  D10_PB6_OC1B ,
  D11_PB7_OC1C ,
  D5_PC6_OC3A ,
  D3 = D3_PD0_OC0B ,
  D9 = D9_PB5_OC1A ,
  D10 = D10_PB6_OC1B ,
  D5 = D5_PC6_OC3A ,
  NONE = UINT8_MAX
}
 Defines all digital output pins of ATmega32u4, capable of PWM output. More...
 
enum class  ExternalInterruptPin : uint8_t {
  D3_PD0_EXT0 = 0 ,
  D2_PD1_EXT1 ,
  D0_PD2_EXT2 ,
  D1_PD3_EXT3 ,
  D7_PE6_EXT6 ,
  D3 = D3_PD0_EXT0 ,
  D2 = D2_PD1_EXT1 ,
  D0 = D0_PD2_EXT2 ,
  D1 = D1_PD3_EXT3 ,
  D7 = D7_PE6_EXT6
}
 Defines all digital output pins of ATmega32u4, usable as direct external interrupt pins. More...
 
enum class  InterruptPin : uint8_t {
  RXLED_PB0_PCI0 = uint8_t(DigitalPin::RXLED_PB0) ,
  SCK_PB1_PCI0 = uint8_t(DigitalPin::SCK_PB1) ,
  MOSI_PB2_PCI0 = uint8_t(DigitalPin::MOSI_PB2) ,
  MISO_PB3_PCI0 = uint8_t(DigitalPin::MISO_PB3) ,
  D8_PB4_PCI0 = uint8_t(DigitalPin::D8_PB4) ,
  D9_PB5_PCI0 = uint8_t(DigitalPin::D9_PB5) ,
  D10_PB6_PCI0 = uint8_t(DigitalPin::D10_PB6) ,
  D11_PB7_PCI0 = uint8_t(DigitalPin::D11_PB7) ,
  D8 = D8_PB4_PCI0 ,
  D9 = D9_PB5_PCI0 ,
  D10 = D10_PB6_PCI0 ,
  D11 = D11_PB7_PCI0
}
 Defines all digital output pins of ATmega32u4, usable as pin change interrupt (PCI) pins. More...
 
enum class  USART : uint8_t { USART1 = 1 }
 Defines all USART modules of ATmega32u4, actually only one. More...
 
enum class  Timer : uint8_t {
  TIMER0 = 0 ,
  TIMER1 = 1 ,
  TIMER3 = 3
}
 Defines all "standard" timers available for ATmega32u4. More...
 
enum class  SleepMode : uint8_t {
  IDLE = SLEEP_MODE_IDLE ,
  ADC_NOISE_REDUCTION = SLEEP_MODE_ADC ,
  POWER_DOWN = SLEEP_MODE_PWR_DOWN ,
  POWER_SAVE = SLEEP_MODE_PWR_SAVE ,
  STANDBY = SLEEP_MODE_STANDBY ,
  EXTENDED_STANDBY = SLEEP_MODE_EXT_STANDBY
}
 Defines all available sleep modes for ATmega32u4. More...
 

Functions

static void init ()
 Performs special initialization for ATmega32u4, actually disabling USB related interrupts, to avoid strange behavior at reset time. More...
 

Detailed Description

Defines all types and constants specific to support Arduino LEONARDO board (ATmega32u4 MCU target).

LEONARDO pinout: http://duino4projects.com/wp-content/uploads/2013/04/Ardunio_leonardo_pinout.jpg

Enumeration Type Documentation

◆ Port

enum class board::Port : uint8_t
strong

Defines all available ports of ATmega32u4.

Enumerator
PORT_B 

Port B (8 IO, only 7 available on LEONARDO)

PORT_C 

Port C (2 IO)

PORT_D 

Port D (8 IO, only 7 available on LEONARDO)

PORT_E 

Port E (2 IO, only 1 available on LEONARDO)

PORT_F 

Port F (6 IO)

Definition at line 59 of file leonardo.h.

◆ DigitalPin

enum class board::DigitalPin : uint8_t
strong

Defines all available digital input/output pins of ATmega32u4, with reference to Arduino LEONARDO pins.

Each symbol is in the form Dxx_Pyz, where xx is the pin number on Arduino, y is the port letter (B, C, D, E or F) and z is the bit number for that pin within its port.

Enumerator
D0_PD2 

Pin PD2 (D0 on Arduino LEONARDO)

D0 

Pin PD2 (D0 on Arduino LEONARDO)

D1_PD3 

Pin PD3 (D1 on Arduino LEONARDO)

D1 

Pin PD3 (D1 on Arduino LEONARDO)

D2_PD1 

Pin PD1 (D2 on Arduino LEONARDO)

D2 

Pin PD1 (D2 on Arduino LEONARDO)

D3_PD0 

Pin PD0 (D3 on Arduino LEONARDO)

D3 

Pin PD0 (D3 on Arduino LEONARDO)

D4_PD4 

Pin PD4 (D4 on Arduino LEONARDO)

D4 

Pin PD4 (D4 on Arduino LEONARDO)

D5_PC6 

Pin PC6 (D5 on Arduino LEONARDO)

D5 

Pin PC6 (D5 on Arduino LEONARDO)

D6_PD7 

Pin PD7 (D6 on Arduino LEONARDO)

D6 

Pin PD7 (D6 on Arduino LEONARDO)

D7_PE6 

Pin PE6 (D7 on Arduino LEONARDO)

D7 

Pin PE6 (D7 on Arduino LEONARDO)

D8_PB4 

Pin PB4 (D8 on Arduino LEONARDO)

D8 

Pin PB4 (D8 on Arduino LEONARDO)

D9_PB5 

Pin PB5 (D9 on Arduino LEONARDO)

D9 

Pin PB5 (D9 on Arduino LEONARDO)

D10_PB6 

Pin PB6 (D10 on Arduino LEONARDO)

D10 

Pin PB6 (D10 on Arduino LEONARDO)

D11_PB7 

Pin PB7 (D11 on Arduino LEONARDO)

D11 

Pin PB7 (D11 on Arduino LEONARDO)

D12_PD6 

Pin PD6 (D12 on Arduino LEONARDO)

D12 

Pin PD6 (D12 on Arduino LEONARDO)

D13_PC7 

Pin PC7 (D13 on Arduino LEONARDO)

D13 

Pin PC7 (D13 on Arduino LEONARDO)

A0_PF7 

Pin PF7 (A0 on Arduino LEONARDO)

A0 

Pin PF7 (A0 on Arduino LEONARDO)

A1_PF6 

Pin PF6 (A1 on Arduino LEONARDO)

A1 

Pin PF6 (A1 on Arduino LEONARDO)

A2_PF5 

Pin PF5 (A2 on Arduino LEONARDO)

A2 

Pin PF5 (A2 on Arduino LEONARDO)

A3_PF4 

Pin PF4 (A3 on Arduino LEONARDO)

A3 

Pin PF4 (A3 on Arduino LEONARDO)

A4_PF1 

Pin PF1 (A4 on Arduino LEONARDO)

A4 

Pin PF1 (A4 on Arduino LEONARDO)

A5_PF0 

Pin PF0 (A5 on Arduino LEONARDO)

A5 

Pin PF0 (A5 on Arduino LEONARDO)

SCK_PB1 

Pin PB1 (SCK (SPI) on Arduino LEONARDO)

MOSI_PB2 

Pin PB2 (MOSI (SPI) on Arduino LEONARDO)

MISO_PB3 

Pin PB3 (MISO (SPI) on Arduino LEONARDO)

RXLED_PB0 

Pin PB0 (RXLED on Arduino LEONARDO, no pin)

TXLED_PD5 

Pin PD5 (TXLED on Arduino LEONARDO, no pin)

LED 

Shortcut for LED pin on Arduino.

Definition at line 82 of file leonardo.h.

◆ AnalogClock

enum class board::AnalogClock : uint8_t
strong

Defines available clocks of ATmega32u4, used for analog input.

Definition at line 187 of file leonardo.h.

◆ AnalogReference

enum class board::AnalogReference : uint8_t
strong

Defines available voltage references of ATmega32u4, used for analog input.

Enumerator
AREF 

Voltage reference is given by the AREF pin.

AVCC 

Voltage reference is given by the AVcc pin.

INTERNAL_2_56V 

Voltage reference is internal 2.56V reference, generated from the internal bandgap reference.

Definition at line 199 of file leonardo.h.

◆ AnalogPin

enum class board::AnalogPin : uint8_t
strong

Defines all available analog input pins of ATmega32u4, with reference to Arduino LEONARDO pins.

Note that this includes also other sources than pin, e.g. the internal bandgap reference or the temperature sensor.

Enumerator
A0_ADC7 

Pin ADC7 (A0 on Arduino LEONARDO)

A0 

Alias to pin ADC7 (A0 on Arduino LEONARDO)

A1_ADC6 

Pin ADC6 (A1 on Arduino LEONARDO)

A1 

Alias to pin ADC7 (A0 on Arduino LEONARDO)

A2_ADC5 

Pin ADC5 (A2 on Arduino LEONARDO)

A2 

Alias to pin ADC5 (A2 on Arduino LEONARDO)

A3_ADC4 

Pin ADC4 (A3 on Arduino LEONARDO)

A3 

Alias to pin ADC4 (A3 on Arduino LEONARDO)

A4_ADC1 

Pin ADC1 (A4 on Arduino LEONARDO)

A4 

Alias to pin ADC1 (A4 on Arduino LEONARDO)

A5_ADC0 

Pin ADC0 (A5 on Arduino LEONARDO)

A5 

Alias to pin ADC0 (A5 on Arduino LEONARDO)

A6_D4_ADC8 

Pin ADC8 (D4 on Arduino LEONARDO)

D4 

Pin ADC8 (D4 on Arduino LEONARDO)

A7_D6_ADC10 

Pin ADC10 (D6 on Arduino LEONARDO)

D6 

Pin ADC10 (D6 on Arduino LEONARDO)

A8_D8_ADC11 

Pin ADC11 (D8 on Arduino LEONARDO)

D8 

Pin ADC11 (D8 on Arduino LEONARDO)

A9_D9_ADC12 

Pin ADC12 (D9 on Arduino LEONARDO)

D9 

Pin ADC12 (D9 on Arduino LEONARDO)

A10_D10_ADC13 

Pin ADC13 (D10 on Arduino LEONARDO)

D10 

Pin ADC13 (D10 on Arduino LEONARDO)

A11_D12_ADC9 

Pin ADC9 (D12 on Arduino LEONARDO)

D12 

Pin ADC9 (D12 on Arduino LEONARDO)

TEMP 

Temperature sensor.

BANDGAP 

Bandgap reference.

Definition at line 216 of file leonardo.h.

◆ PWMPin

enum class board::PWMPin : uint8_t
strong

Defines all digital output pins of ATmega32u4, capable of PWM output.

Each symbol is in the form Dxx_Pyz_OCuv, where xx is the pin number on Arduino, y is the port letter (B, C or D), z is the bit number for that pin within its port, u is the number of the timer used by this PWM pin and v the letter indicating which compare register of the timer this PWM pin is mapped to.

Note that Timer4, which is specific (high speed) is not present here, as it is not supported (yet) by FastArduino.

Also note that ATmega32u4 has pins that can be linked to several timers (e.g. pin PB7 is connected to OC0A and OC1C) but FastArduino is currently limited to pins linked to only one timer, hence for each pin, a choice had to be made: the main principles for this choice were to take timer comparison channels A and B first. In the future, support for pins with multiple timers linked may be added.

Definition at line 294 of file leonardo.h.

◆ ExternalInterruptPin

enum class board::ExternalInterruptPin : uint8_t
strong

Defines all digital output pins of ATmega32u4, usable as direct external interrupt pins.

Each symbol is in the form Dxx_Pyz_EXTu, where xx is the pin number on Arduino, y is the port letter (D or E), z is the bit number for that pin within its port and u is the number of the interrupt for that pin.

Definition at line 320 of file leonardo.h.

◆ InterruptPin

enum class board::InterruptPin : uint8_t
strong

Defines all digital output pins of ATmega32u4, usable as pin change interrupt (PCI) pins.

Each symbol is in the form Dxx_Pyz_PCIu or FUNC_Pyz_PCIu, where FUNC is the specific function of the pin or xx the pin number on Arduino, y is the port letter (always B), z is the bit number for that pin within its port and u is the number of the PCI vector for that pin.

Definition at line 344 of file leonardo.h.

◆ USART

enum class board::USART : uint8_t
strong

Defines all USART modules of ATmega32u4, actually only one.

Note that USB device is not represented here as it is not supported yet by FastArduino.

Definition at line 366 of file leonardo.h.

◆ Timer

enum class board::Timer : uint8_t
strong

Defines all "standard" timers available for ATmega32u4.

This excludes specific "high-speed" Timer4, not supported by FastArduino currently.

Enumerator
TIMER0 

Timer0 (8 bits)

TIMER1 

Timer1 (16 bits)

TIMER3 

Timer3 (16 bits)

Definition at line 375 of file leonardo.h.

◆ SleepMode

enum class board::SleepMode : uint8_t
strong

Defines all available sleep modes for ATmega32u4.

Enumerator
IDLE 

In this mode, CPU is stopped but all other peripherals and interrupts work normally.

In this mode, current consumption is reduced to about 25% of active mode consumption.

ADC_NOISE_REDUCTION 

In this mode, CPU is stopped but other peripherals and interrupts work normally, except IO.

This mode is actually very similar to IDLE.

POWER_DOWN 

In this mode, everything is stopped (including oscillator) but external interrupts, I2C slave (if enabled), USB interrupts and Watchdog Timer (if enabled).

This is lowest current consumption mode, typically a few uA, depending on other factors (voltage, watchdog enabled or not). Waking up from this mode may take significant time until internal oscillator is restarted and stabilized; refer to datasheet for more detailed data (look for Start-up times).

POWER_SAVE 

This mode is exactly the same as POWER_DOWN.

STANDBY 

This mode is similar to POWER_DOWN, except the oscillator is kept running, hence waking up from this mode takes only 6 clock cycles.

EXTENDED_STANDBY 

This mode is exactly the same as STANDBY.

Definition at line 390 of file leonardo.h.

Function Documentation

◆ init()

static void board::init ( )
inlinestatic

Performs special initialization for ATmega32u4, actually disabling USB related interrupts, to avoid strange behavior at reset time.

This must be called first in your main() function, even before sei().

Definition at line 46 of file leonardo.h.