ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
atmega328p::twi Namespace Reference

Two-wire interface definitions. More...

Enumerations

enum class  Prescaler : uint8_t { Divide1 = 1 , Divide4 = 4 , Divide16 = 16 , Divide64 = 64 }
 TWI clock prescaler values. More...
enum class  StatusCode : uint8_t {
  BusError = 0x00 , StartTransmitted = 0x08 , RepeatedStartTransmitted = 0x10 , AddressWriteAck = 0x18 ,
  AddressWriteNack = 0x20 , DataWriteAck = 0x28 , DataWriteNack = 0x30 , ArbitrationLost = 0x38 ,
  AddressReadAck = 0x40 , AddressReadNack = 0x48 , DataReadAck = 0x50 , DataReadNack = 0x58 ,
  OwnAddressWriteAck = 0x60 , ArbitrationLostOwnAddressWriteAck = 0x68 , GeneralCallAck = 0x70 , ArbitrationLostGeneralCallAck = 0x78 ,
  OwnAddressDataAck = 0x80 , OwnAddressDataNack = 0x88 , GeneralCallDataAck = 0x90 , GeneralCallDataNack = 0x98 ,
  StopOrRepeatedStartReceived = 0xA0 , OwnAddressReadAck = 0xA8 , ArbitrationLostOwnAddressReadAck = 0xB0 , OwnAddressReadDataAck = 0xB8 ,
  OwnAddressReadDataNack = 0xC0 , LastDataByteAck = 0xC8 , NoRelevantStateInformation = 0xF8
}
 TWI bus status codes. More...
enum  : uint8_t {
  module_count = 1U , address_bits = 7U , address_count = 128U , prescaler_count = 4U ,
  sda_pin_value = 0x14U , scl_pin_value = 0x15U , supports_master = 1 , supports_slave = 1 ,
  supports_multi_master_arbitration = 1 , supports_general_call = 1 , cpu_clock_must_exceed_max_of_16x_scl_and_250khz = 1
}
enum  : uint16_t { min_cpu_clocks_per_scl_in_slave_mode = 16U }
 TWI timing limits. More...
enum  : uint32_t { min_cpu_clock_hz = 250000UL , standard_mode_max_hz = 100000UL , fast_mode_max_hz = 400000UL }

Detailed Description

Two-wire interface definitions.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
min_cpu_clock_hz 

Min CPU clock (Hz).

standard_mode_max_hz 

Standard mode max (Hz).

fast_mode_max_hz 

Fast mode max (Hz).

◆ anonymous enum

anonymous enum : uint8_t
Enumerator
module_count 

Number of module.

address_bits 

Address width (bits).

address_count 

Number of address.

prescaler_count 

Number of prescaler.

sda_pin_value 

SDA logical pin encoding.

scl_pin_value 

SCL logical pin encoding.

supports_master 

Master supported.

supports_slave 

Slave supported.

supports_multi_master_arbitration 

Multi master arbitration supported.

supports_general_call 

General call supported.

cpu_clock_must_exceed_max_of_16x_scl_and_250khz 

CPU clock must exceed max of 16x SCL and 250khz.

◆ anonymous enum

anonymous enum : uint16_t

TWI timing limits.

Enumerator
min_cpu_clocks_per_scl_in_slave_mode 

Min CPU clocks per SCL in slave mode.

◆ Prescaler

enum class atmega328p::twi::Prescaler : uint8_t
strong

TWI clock prescaler values.

Enumerator
Divide1 

1 - TWI prescaler factor 1.

Divide4 

4 - TWI prescaler factor 4.

Divide16 

16 - TWI prescaler factor 16.

Divide64 

64 - TWI prescaler factor 64.

◆ StatusCode

enum class atmega328p::twi::StatusCode : uint8_t
strong

TWI bus status codes.

Enumerator
BusError 

0x00 - Illegal START or STOP condition.

StartTransmitted 

0x08 - START sent.

RepeatedStartTransmitted 

0x10 - Repeated START sent.

AddressWriteAck 

0x18 - SLA+W sent, ACK received.

AddressWriteNack 

0x20 - SLA+W sent, NACK received.

DataWriteAck 

0x28 - Data sent, ACK received.

DataWriteNack 

0x30 - Data sent, NACK received.

ArbitrationLost 

0x38 - Bus arbitration lost.

AddressReadAck 

0x40 - SLA+R sent, ACK received.

AddressReadNack 

0x48 - SLA+R sent, NACK received.

DataReadAck 

0x50 - Data received, ACK returned.

DataReadNack 

0x58 - Data received, NACK returned.

OwnAddressWriteAck 

0x60 - Own SLA+W received; ACK sent.

ArbitrationLostOwnAddressWriteAck 

0x68 - Arbitration lost; own SLA+W received.

GeneralCallAck 

0x70 - General call received; ACK sent.

ArbitrationLostGeneralCallAck 

0x78 - Arbitration lost; general call received.

OwnAddressDataAck 

0x80 - Data received after own SLA+W; ACK sent.

OwnAddressDataNack 

0x88 - Data received after own SLA+W; NACK sent.

GeneralCallDataAck 

0x90 - General-call data received; ACK sent.

GeneralCallDataNack 

0x98 - General-call data received; NACK sent.

StopOrRepeatedStartReceived 

0xA0 - STOP or repeated START received.

OwnAddressReadAck 

0xA8 - Own SLA+R received; ACK sent.

ArbitrationLostOwnAddressReadAck 

0xB0 - Arbitration lost; own SLA+R received.

OwnAddressReadDataAck 

0xB8 - Data transmitted; ACK received.

OwnAddressReadDataNack 

0xC0 - Data transmitted; NACK received.

LastDataByteAck 

0xC8 - Final data byte sent; ACK received.

NoRelevantStateInformation 

0xF8 - No relevant TWI state.