ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
Pin.h
Go to the documentation of this file.
1
5
6#ifndef ATMEGA328P_DEFINITIONS_PIN_H
7#define ATMEGA328P_DEFINITIONS_PIN_H
8
9#include <stdint.h>
10#include "Config.h"
11
13namespace atmega328p
14{
16 namespace pin
17 {
19 enum class Port : uint8_t
20 {
21 B = 0,
22 C = 1,
23 D = 2,
24 };
25
27 enum class Pin : uint8_t
28 {
29 PB0 = 0x00,
30 PB1 = 0x01,
31 PB2 = 0x02,
32 PB3 = 0x03,
33 PB4 = 0x04,
34 PB5 = 0x05,
35 PB6 = 0x06,
36 PB7 = 0x07,
37 PC0 = 0x10,
38 PC1 = 0x11,
39 PC2 = 0x12,
40 PC3 = 0x13,
41 PC4 = 0x14,
42 PC5 = 0x15,
43 PC6 = 0x16,
44 PD0 = 0x20,
45 PD1 = 0x21,
46 PD2 = 0x22,
47 PD3 = 0x23,
48 PD4 = 0x24,
49 PD5 = 0x25,
50 PD6 = 0x26,
51 PD7 = 0x27,
52 };
53
54 enum : uint8_t
55 {
57 port_mask = 0xF0,
58 bit_mask = 0x0F,
65 port_b_mask = 0xFF,
66 port_c_mask = 0x7F,
67 port_d_mask = 0xFF,
68 pin_count = 23,
69 };
70 }
71
72 using pin::Pin;
73 using pin::Port;
74}
75
76#endif
Selects the ATmega328P package and operating grade.
Logical pin and alternate-function definitions.
Definition Pin.h:17
Port
GPIO port identifiers.
Definition Pin.h:20
@ C
1 - Port C.
Definition Pin.h:22
@ B
0 - Port B.
Definition Pin.h:21
@ D
2 - Port D.
Definition Pin.h:23
@ port_mask
Port mask.
Definition Pin.h:57
@ port_d_mask
Port d mask.
Definition Pin.h:67
@ port_c_code
Port c code.
Definition Pin.h:60
@ port_b_width
Port b width.
Definition Pin.h:62
@ port_c_width
Port c width.
Definition Pin.h:63
@ port_c_mask
Port c mask.
Definition Pin.h:66
@ port_d_width
Port d width.
Definition Pin.h:64
@ port_b_mask
Port b mask.
Definition Pin.h:65
@ port_d_code
Port d code.
Definition Pin.h:61
@ bit_mask
Bit mask.
Definition Pin.h:58
@ port_b_code
Port b code.
Definition Pin.h:59
@ port_shift
Port shift count.
Definition Pin.h:56
@ pin_count
Number of pin.
Definition Pin.h:68
Pin
Logical pin identifiers, independent of package terminals.
Definition Pin.h:28
@ PC6
0x16 - Port C, bit 6. RESET by default.
Definition Pin.h:43
@ PB5
0x05 - Port B, bit 5.
Definition Pin.h:34
@ PD4
0x24 - Port D, bit 4.
Definition Pin.h:48
@ PC3
0x13 - Port C, bit 3.
Definition Pin.h:40
@ PC0
0x10 - Port C, bit 0.
Definition Pin.h:37
@ PB7
0x07 - Port B, bit 7.
Definition Pin.h:36
@ PC2
0x12 - Port C, bit 2.
Definition Pin.h:39
@ PB3
0x03 - Port B, bit 3.
Definition Pin.h:32
@ PD7
0x27 - Port D, bit 7.
Definition Pin.h:51
@ PD0
0x20 - Port D, bit 0.
Definition Pin.h:44
@ PB0
0x00 - Port B, bit 0.
Definition Pin.h:29
@ PD6
0x26 - Port D, bit 6.
Definition Pin.h:50
@ PB6
0x06 - Port B, bit 6.
Definition Pin.h:35
@ PC4
0x14 - Port C, bit 4.
Definition Pin.h:41
@ PC1
0x11 - Port C, bit 1.
Definition Pin.h:38
@ PB2
0x02 - Port B, bit 2.
Definition Pin.h:31
@ PD3
0x23 - Port D, bit 3.
Definition Pin.h:47
@ PB4
0x04 - Port B, bit 4.
Definition Pin.h:33
@ PD1
0x21 - Port D, bit 1.
Definition Pin.h:45
@ PC5
0x15 - Port C, bit 5.
Definition Pin.h:42
@ PD2
0x22 - Port D, bit 2.
Definition Pin.h:46
@ PD5
0x25 - Port D, bit 5.
Definition Pin.h:49
@ PB1
0x01 - Port B, bit 1.
Definition Pin.h:30
Device-specific definitions for the ATmega328P.
Definition ADC.h:14