FastArduino - ATtinyX4 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 ATtinyX4 MCU targets. More...

Enumerations

enum class  Port : uint8_t {
  PORT_A = 0 ,
  PORT_B ,
  NONE = UINT8_MAX
}
 Defines all available ports of ATtinyX4. More...
 
enum class  DigitalPin : uint8_t {
  D0_PA0 = 0 ,
  D1_PA1 ,
  D2_PA2 ,
  D3_PA3 ,
  D4_PA4 ,
  D5_PA5 ,
  D6_PA6 ,
  D7_PA7 ,
  D8_PB0 ,
  D9_PB1 ,
  D10_PB2 ,
  LED = D7_PA7 ,
  NONE = UINT8_MAX
}
 Defines all available digital input/output pins of ATtinyX4, with additional pin imaginary numbering (as for an Arduino board). 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 ATtinyX4, used for analog input. More...
 
enum class  AnalogReference : uint8_t {
  AREF = 0 ,
  AVCC ,
  INTERNAL_1_1V
}
 Defines available voltage references of ATtinyX4, used for analog input. More...
 
enum class  AnalogPin : uint8_t {
  A0 = 0 ,
  A1 ,
  A2 ,
  A3 ,
  A4 ,
  A5 ,
  A6 ,
  A7 ,
  TEMP ,
  BANDGAP ,
  NONE = UINT8_MAX
}
 Defines all available analog input pins of ATtinyX4, with reference to AVR ATtinyX4 pins. More...
 
enum class  PWMPin : uint8_t {
  D10_PB2_OC0A = 0 ,
  D7_PA7_OC0B ,
  D6_PA6_OC1A ,
  D5_PA5_OC1B ,
  NONE = UINT8_MAX
}
 Defines all digital output pins of ATtinyX4, capable of PWM output. More...
 
enum class  ExternalInterruptPin : uint8_t { D10_PB2_EXT0 = 0 }
 Defines all digital output pins of ATtinyX4, usable as direct external interrupt pins. More...
 
enum class  InterruptPin : uint8_t {
  D0_PA0_PCI0 = uint8_t(DigitalPin::D0_PA0) ,
  D1_PA1_PCI0 = uint8_t(DigitalPin::D1_PA1) ,
  D2_PA2_PCI0 = uint8_t(DigitalPin::D2_PA2) ,
  D3_PA3_PCI0 = uint8_t(DigitalPin::D3_PA3) ,
  D4_PA4_PCI0 = uint8_t(DigitalPin::D4_PA4) ,
  D5_PA5_PCI0 = uint8_t(DigitalPin::D5_PA5) ,
  D6_PA6_PCI0 = uint8_t(DigitalPin::D6_PA6) ,
  D7_PA7_PCI0 = uint8_t(DigitalPin::D7_PA7) ,
  D8_PB0_PCI1 = uint8_t(DigitalPin::D8_PB0) ,
  D9_PB1_PCI1 = uint8_t(DigitalPin::D9_PB1) ,
  D10_PB2_PCI1 = uint8_t(DigitalPin::D10_PB2)
}
 Defines all digital output pins of ATtinyX4, usable as pin change interrupt (PCI) pins. More...
 
enum class  USART : uint8_t
 Defines all USART modules of ATtinyX4, actually none at all. More...
 
enum class  Timer : uint8_t {
  TIMER0 = 0 ,
  TIMER1 = 1
}
 Defines all timers available for ATtinyX4. 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_PWR_SAVE ,
  EXTENDED_STANDBY = SLEEP_MODE_PWR_SAVE
}
 Defines all available sleep modes for ATmega328P. More...
 

Functions

static void init ()
 Performs special initialization for ATtinyX4, actually nothing at all. More...
 

Detailed Description

Defines all types and constants specific to support ATtinyX4 MCU targets.

Enumeration Type Documentation

◆ Port

enum class board::Port : uint8_t
strong

Defines all available ports of ATtinyX4.

Enumerator
PORT_A 

Port A (8 IO)

PORT_B 

Port B (3 IO)

Definition at line 55 of file attiny_x4.h.

◆ DigitalPin

enum class board::DigitalPin : uint8_t
strong

Defines all available digital input/output pins of ATtinyX4, with additional pin imaginary numbering (as for an Arduino board).

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

Enumerator
D0_PA0 

Pin PA0 (D0)

D1_PA1 

Pin PA1 (D1)

D2_PA2 

Pin PA2 (D2)

D3_PA3 

Pin PA3 (D3)

D4_PA4 

Pin PA4 (D4)

D5_PA5 

Pin PA5 (D5)

D6_PA6 

Pin PA6 (D6)

D7_PA7 

Pin PA6 (D7)

D8_PB0 

Pin PB0 (D8)

D9_PB1 

Pin PB1 (D9)

D10_PB2 

Pin PB2 (D10)

LED 

Shortcut for LED pin, arbitrarily chosen to be D7.

Definition at line 72 of file attiny_x4.h.

◆ AnalogClock

enum class board::AnalogClock : uint8_t
strong

Defines available clocks of ATtinyX4, used for analog input.

Definition at line 105 of file attiny_x4.h.

◆ AnalogReference

enum class board::AnalogReference : uint8_t
strong

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

Enumerator
AREF 

Voltage reference is given by the AREF (PA0) pin.

AVCC 

Voltage reference is given by the Vcc pin.

INTERNAL_1_1V 

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

Definition at line 117 of file attiny_x4.h.

◆ AnalogPin

enum class board::AnalogPin : uint8_t
strong

Defines all available analog input pins of ATtinyX4, with reference to AVR ATtinyX4 pins.

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

Enumerator
A0 

Pin ADC0 (PA0)

A1 

Pin ADC1 (PA1)

A2 

Pin ADC2 (PA2)

A3 

Pin ADC3 (PA3)

A4 

Pin ADC4 (PA4)

A5 

Pin ADC5 (PA5)

A6 

Pin ADC6 (PA6)

A7 

Pin ADC7 (PA7)

TEMP 

Temperature sensor.

BANDGAP 

Bandgap reference.

Definition at line 134 of file attiny_x4.h.

◆ PWMPin

enum class board::PWMPin : uint8_t
strong

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

Each symbol is in the form Dxx_Pyz_OCuv, where xx is the imaginary pin number , 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.

Definition at line 168 of file attiny_x4.h.

◆ ExternalInterruptPin

enum class board::ExternalInterruptPin : uint8_t
strong

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

Each symbol is in the form Dxx_Pyz_EXTu, where xx is the imaginary pin number , y is the port letter (B, C or D), 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 186 of file attiny_x4.h.

◆ InterruptPin

enum class board::InterruptPin : uint8_t
strong

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

Each symbol is in the form Dxx_Pyz_PCIu, where xx is the imaginary pin number, y is the port letter (B, C or D), 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 199 of file attiny_x4.h.

◆ USART

enum class board::USART : uint8_t
strong

Defines all USART modules of ATtinyX4, actually none at all.

Definition at line 218 of file attiny_x4.h.

◆ Timer

enum class board::Timer : uint8_t
strong

Defines all timers available for ATtinyX4.

Enumerator
TIMER0 

Timer0 (8 bits)

TIMER1 

Timer1 (16 bits)

Definition at line 227 of file attiny_x4.h.

◆ SleepMode

enum class board::SleepMode : uint8_t
strong

Defines all available sleep modes for ATmega328P.

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) 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 similar to POWER_DOWN, except Timer2 is still running if enabled.

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).

STANDBY 

This mode is exactly the same POWER_DOWN.

EXTENDED_STANDBY 

This mode is exactly the same POWER_SAVE.

Definition at line 242 of file attiny_x4.h.

Function Documentation

◆ init()

static void board::init ( )
inlinestatic

Performs special initialization for ATtinyX4, actually nothing at all.

This must be called first in your main() function, even before sei(). In general you should ALWAYS call this function at the beginning of your main() even if you know it will not do anything; this will prevent strange behaviors when you want to port your code to another MCU target for which init() does perform important initialization, e.g. ATmega32u4 (Arduino LEONARDO).

Definition at line 50 of file attiny_x4.h.