ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
PinFunctions.h
Go to the documentation of this file.
1
5
6#ifndef ATMEGA328P_DEFINITIONS_PIN_FUNCTIONS_H
7#define ATMEGA328P_DEFINITIONS_PIN_FUNCTIONS_H
8
9#include <stdint.h>
10#include "Config.h"
11#include "Pin.h"
12
14namespace atmega328p
15{
17 namespace pin
18 {
20 enum Capability : uint16_t
21 {
22 None = 0x0000U,
23 GPIO = 0x0001U,
25 ADC = 0x0004U,
26 PWM = 0x0008U,
28 SPI = 0x0020U,
29 USART = 0x0040U,
30 TWI = 0x0080U,
32 InputCapture = 0x0200U,
33 ClockOutput = 0x0400U,
34 Reset = 0x0800U,
35 AnalogComparator = 0x1000U,
36 TimerOscillator = 0x2000U,
38 };
39
102
104 namespace capabilities
105 {
106 enum : uint16_t
107 {
108 PB0 = 0x0603U,
109 PB1 = 0x000BU,
110 PB2 = 0x002BU,
111 PB3 = 0x002BU,
112 PB4 = 0x0023U,
113 PB5 = 0x0023U,
114 PB6 = 0x6003U,
115 PB7 = 0x6003U,
116 PC0 = 0x0007U,
117 PC1 = 0x0007U,
118 PC2 = 0x0007U,
119 PC3 = 0x0007U,
120 PC4 = 0x0087U,
121 PC5 = 0x0087U,
122 PC6 = 0x0802U,
123 PC6WithRSTDISBL = 0x0003U,
124 PD0 = 0x0043U,
125 PD1 = 0x0043U,
126 PD2 = 0x0013U,
127 PD3 = 0x001BU,
128 PD4 = 0x0143U,
129 PD5 = 0x010BU,
130 PD6 = 0x100BU,
131 PD7 = 0x1003U,
132 };
133 }
134 }
135
136}
137
138#endif
Selects the ATmega328P package and operating grade.
Logical GPIO pin and port identifiers.
Capability masks for individual logical pins.
Definition PinFunctions.h:105
@ PD2
Capabilities of PD2.
Definition PinFunctions.h:126
@ PD0
Capabilities of PD0.
Definition PinFunctions.h:124
@ PC5
Capabilities of PC5.
Definition PinFunctions.h:121
@ PD4
Capabilities of PD4.
Definition PinFunctions.h:128
@ PC0
Capabilities of PC0.
Definition PinFunctions.h:116
@ PD3
Capabilities of PD3.
Definition PinFunctions.h:127
@ PB0
Capabilities of PB0.
Definition PinFunctions.h:108
@ PB7
Capabilities of PB7.
Definition PinFunctions.h:115
@ PC3
Capabilities of PC3.
Definition PinFunctions.h:119
@ PC1
Capabilities of PC1.
Definition PinFunctions.h:117
@ PD6
Capabilities of PD6.
Definition PinFunctions.h:130
@ PB1
Capabilities of PB1.
Definition PinFunctions.h:109
@ PD5
Capabilities of PD5.
Definition PinFunctions.h:129
@ PB3
Capabilities of PB3.
Definition PinFunctions.h:111
@ PB2
Capabilities of PB2.
Definition PinFunctions.h:110
@ PC6
Capabilities of PC6.
Definition PinFunctions.h:122
@ PC6WithRSTDISBL
Capabilities of PC6 with RSTDISBL.
Definition PinFunctions.h:123
@ PD1
Capabilities of PD1.
Definition PinFunctions.h:125
@ PB6
Capabilities of PB6.
Definition PinFunctions.h:114
@ PB5
Capabilities of PB5.
Definition PinFunctions.h:113
@ PD7
Capabilities of PD7.
Definition PinFunctions.h:131
@ PC4
Capabilities of PC4.
Definition PinFunctions.h:120
@ PB4
Capabilities of PB4.
Definition PinFunctions.h:112
@ PC2
Capabilities of PC2.
Definition PinFunctions.h:118
Logical pin and alternate-function definitions.
Definition Pin.h:17
Capability
Bit flags describing a pin's available hardware functions.
Definition PinFunctions.h:21
@ TimerOscillator
0x2000 - Timer2 oscillator connection.
Definition PinFunctions.h:36
@ PWM
0x0008 - Timer output-compare PWM.
Definition PinFunctions.h:26
@ InputCapture
0x0200 - Timer1 input capture.
Definition PinFunctions.h:32
@ TWI
0x0080 - Two-wire interface signal.
Definition PinFunctions.h:30
@ TimerExternalClock
0x0100 - External clock input for timer.
Definition PinFunctions.h:31
@ None
0x0000 - No alternate functions.
Definition PinFunctions.h:22
@ ExternalInterrupt
0x0010 - Dedicated external interrupt input.
Definition PinFunctions.h:27
@ USART
0x0040 - USART interface signal.
Definition PinFunctions.h:29
@ ADC
0x0004 - Analog-to-digital input.
Definition PinFunctions.h:25
@ PinChangeInterrupt
0x0002 - Pin-change interrupt source.
Definition PinFunctions.h:24
@ GPIO
0x0001 - Digital input/output.
Definition PinFunctions.h:23
@ AnalogComparator
0x1000 - Analog comparator input.
Definition PinFunctions.h:35
@ SPI
0x0020 - SPI interface signal.
Definition PinFunctions.h:28
@ Reset
0x0800 - External reset input.
Definition PinFunctions.h:34
@ MainClockOscillator
0x4000 - Main oscillator connection.
Definition PinFunctions.h:37
@ ClockOutput
0x0400 - System clock output.
Definition PinFunctions.h:33
Function
Alternate pin function identifiers.
Definition PinFunctions.h:42
@ TXD
USART transmit.
Definition PinFunctions.h:90
@ SDA
TWI serial data.
Definition PinFunctions.h:86
@ PCINT7
Pin-change interrupt source 7.
Definition PinFunctions.h:51
@ PCINT1
Pin-change interrupt source 1.
Definition PinFunctions.h:45
@ PCINT22
Pin-change interrupt source 22.
Definition PinFunctions.h:65
@ AIN0
Analog comparator positive input.
Definition PinFunctions.h:99
@ PCINT14
Pin-change interrupt source 14.
Definition PinFunctions.h:58
@ PCINT13
Pin-change interrupt source 13.
Definition PinFunctions.h:57
@ AIN1
Analog comparator negative input.
Definition PinFunctions.h:100
@ XCK
USART external clock.
Definition PinFunctions.h:94
@ PCINT23
Pin-change interrupt source 23.
Definition PinFunctions.h:66
@ ADC0
ADC input 0.
Definition PinFunctions.h:80
@ OC2A
Timer output-compare OC2A.
Definition PinFunctions.h:73
@ INT0
External interrupt 0.
Definition PinFunctions.h:91
@ SCL
TWI serial clock.
Definition PinFunctions.h:87
@ PCINT20
Pin-change interrupt source 20.
Definition PinFunctions.h:63
@ ADC5
ADC input 5.
Definition PinFunctions.h:85
@ SCK
SPI serial clock.
Definition PinFunctions.h:75
@ PCINT16
Pin-change interrupt source 16.
Definition PinFunctions.h:59
@ PCINT19
Pin-change interrupt source 19.
Definition PinFunctions.h:62
@ ADC4
ADC input 4.
Definition PinFunctions.h:84
@ OC2B
Timer output-compare OC2B.
Definition PinFunctions.h:93
@ OC0A
Timer output-compare OC0A.
Definition PinFunctions.h:98
@ PCINT17
Pin-change interrupt source 17.
Definition PinFunctions.h:60
@ PCINT11
Pin-change interrupt source 11.
Definition PinFunctions.h:55
@ ICP1
Timer1 input capture.
Definition PinFunctions.h:68
@ OC0B
Timer output-compare OC0B.
Definition PinFunctions.h:96
@ ADC2
ADC input 2.
Definition PinFunctions.h:82
@ OC1B
Timer output-compare OC1B.
Definition PinFunctions.h:71
@ XTAL1
Main oscillator input.
Definition PinFunctions.h:76
@ TOSC1
Timer2 oscillator input.
Definition PinFunctions.h:77
@ CLKO
System clock output.
Definition PinFunctions.h:67
@ PCINT2
Pin-change interrupt source 2.
Definition PinFunctions.h:46
@ PCINT18
Pin-change interrupt source 18.
Definition PinFunctions.h:61
@ PCINT3
Pin-change interrupt source 3.
Definition PinFunctions.h:47
@ ADC1
ADC input 1.
Definition PinFunctions.h:81
@ PCINT6
Pin-change interrupt source 6.
Definition PinFunctions.h:50
@ PCINT8
Pin-change interrupt source 8.
Definition PinFunctions.h:52
@ RXD
USART receive.
Definition PinFunctions.h:89
@ ADC3
ADC input 3.
Definition PinFunctions.h:83
@ T0
Timer0 external clock.
Definition PinFunctions.h:95
@ PCINT5
Pin-change interrupt source 5.
Definition PinFunctions.h:49
@ OC1A
Timer output-compare OC1A.
Definition PinFunctions.h:69
@ MISO
SPI master-in/slave-out.
Definition PinFunctions.h:74
@ RESET
External reset.
Definition PinFunctions.h:88
@ MOSI
SPI master-out/slave-in.
Definition PinFunctions.h:72
@ TOSC2
Timer2 oscillator output.
Definition PinFunctions.h:79
@ PCINT21
Pin-change interrupt source 21.
Definition PinFunctions.h:64
@ XTAL2
Main oscillator output.
Definition PinFunctions.h:78
@ PCINT4
Pin-change interrupt source 4.
Definition PinFunctions.h:48
@ T1
Timer1 external clock.
Definition PinFunctions.h:97
@ INT1
External interrupt 1.
Definition PinFunctions.h:92
@ SS
SPI slave select.
Definition PinFunctions.h:70
@ PCINT10
Pin-change interrupt source 10.
Definition PinFunctions.h:54
@ PCINT0
Pin-change interrupt source 0.
Definition PinFunctions.h:44
@ PCINT9
Pin-change interrupt source 9.
Definition PinFunctions.h:53
@ PCINT12
Pin-change interrupt source 12.
Definition PinFunctions.h:56
Device-specific definitions for the ATmega328P.
Definition ADC.h:14