ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
TWI.h
Go to the documentation of this file.
1
5
6#ifndef ATMEGA328P_DEFINITIONS_TWI_H
7#define ATMEGA328P_DEFINITIONS_TWI_H
8
9#include <stdint.h>
10#include "Config.h"
11#include "Pin.h"
12
14namespace atmega328p
15{
17 namespace twi
18 {
20 enum class Prescaler : uint8_t
21 {
22 Divide1 = 1,
23 Divide4 = 4,
24 Divide16 = 16,
25 Divide64 = 64,
26 };
27
59
60 enum : uint8_t
61 {
66 sda_pin_value = 0x14U,
67 scl_pin_value = 0x15U,
73 };
74
76 enum : uint16_t
77 {
79 };
80
81 enum : uint32_t
82 {
83 min_cpu_clock_hz = 250000UL,
85 fast_mode_max_hz = 400000UL,
86 };
87 }
88}
89
90#endif
Selects the ATmega328P package and operating grade.
Logical GPIO pin and port identifiers.
Two-wire interface definitions.
Definition TWI.h:18
StatusCode
TWI bus status codes.
Definition TWI.h:30
@ GeneralCallAck
0x70 - General call received; ACK sent.
Definition TWI.h:45
@ BusError
0x00 - Illegal START or STOP condition.
Definition TWI.h:31
@ AddressWriteAck
0x18 - SLA+W sent, ACK received.
Definition TWI.h:34
@ OwnAddressWriteAck
0x60 - Own SLA+W received; ACK sent.
Definition TWI.h:43
@ ArbitrationLost
0x38 - Bus arbitration lost.
Definition TWI.h:38
@ OwnAddressReadDataNack
0xC0 - Data transmitted; NACK received.
Definition TWI.h:55
@ DataReadNack
0x58 - Data received, NACK returned.
Definition TWI.h:42
@ OwnAddressDataAck
0x80 - Data received after own SLA+W; ACK sent.
Definition TWI.h:47
@ DataReadAck
0x50 - Data received, ACK returned.
Definition TWI.h:41
@ StartTransmitted
0x08 - START sent.
Definition TWI.h:32
@ AddressReadNack
0x48 - SLA+R sent, NACK received.
Definition TWI.h:40
@ AddressReadAck
0x40 - SLA+R sent, ACK received.
Definition TWI.h:39
@ DataWriteNack
0x30 - Data sent, NACK received.
Definition TWI.h:37
@ AddressWriteNack
0x20 - SLA+W sent, NACK received.
Definition TWI.h:35
@ StopOrRepeatedStartReceived
0xA0 - STOP or repeated START received.
Definition TWI.h:51
@ RepeatedStartTransmitted
0x10 - Repeated START sent.
Definition TWI.h:33
@ OwnAddressDataNack
0x88 - Data received after own SLA+W; NACK sent.
Definition TWI.h:48
@ OwnAddressReadAck
0xA8 - Own SLA+R received; ACK sent.
Definition TWI.h:52
@ ArbitrationLostOwnAddressWriteAck
0x68 - Arbitration lost; own SLA+W received.
Definition TWI.h:44
@ ArbitrationLostGeneralCallAck
0x78 - Arbitration lost; general call received.
Definition TWI.h:46
@ ArbitrationLostOwnAddressReadAck
0xB0 - Arbitration lost; own SLA+R received.
Definition TWI.h:53
@ GeneralCallDataNack
0x98 - General-call data received; NACK sent.
Definition TWI.h:50
@ NoRelevantStateInformation
0xF8 - No relevant TWI state.
Definition TWI.h:57
@ OwnAddressReadDataAck
0xB8 - Data transmitted; ACK received.
Definition TWI.h:54
@ GeneralCallDataAck
0x90 - General-call data received; ACK sent.
Definition TWI.h:49
@ DataWriteAck
0x28 - Data sent, ACK received.
Definition TWI.h:36
@ LastDataByteAck
0xC8 - Final data byte sent; ACK received.
Definition TWI.h:56
Prescaler
TWI clock prescaler values.
Definition TWI.h:21
@ Divide64
64 - TWI prescaler factor 64.
Definition TWI.h:25
@ Divide4
4 - TWI prescaler factor 4.
Definition TWI.h:23
@ Divide16
16 - TWI prescaler factor 16.
Definition TWI.h:24
@ Divide1
1 - TWI prescaler factor 1.
Definition TWI.h:22
@ min_cpu_clocks_per_scl_in_slave_mode
Min CPU clocks per SCL in slave mode.
Definition TWI.h:78
@ prescaler_count
Number of prescaler.
Definition TWI.h:65
@ address_bits
Address width (bits).
Definition TWI.h:63
@ scl_pin_value
SCL logical pin encoding.
Definition TWI.h:67
@ cpu_clock_must_exceed_max_of_16x_scl_and_250khz
CPU clock must exceed max of 16x SCL and 250khz.
Definition TWI.h:72
@ sda_pin_value
SDA logical pin encoding.
Definition TWI.h:66
@ supports_slave
Slave supported.
Definition TWI.h:69
@ supports_master
Master supported.
Definition TWI.h:68
@ module_count
Number of module.
Definition TWI.h:62
@ supports_multi_master_arbitration
Multi master arbitration supported.
Definition TWI.h:70
@ supports_general_call
General call supported.
Definition TWI.h:71
@ address_count
Number of address.
Definition TWI.h:64
@ fast_mode_max_hz
Fast mode max (Hz).
Definition TWI.h:85
@ standard_mode_max_hz
Standard mode max (Hz).
Definition TWI.h:84
@ min_cpu_clock_hz
Min CPU clock (Hz).
Definition TWI.h:83
Device-specific definitions for the ATmega328P.
Definition ADC.h:14