libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
I2C Defines

Defined Constants and Types for the NRF52xx I2C More...

Collaboration diagram for I2C Defines:

Modules

 I2C event -> task shortcuts
 The effect of activated shortcut is, that upon I2C event triggering, the hardware will automatically start chosen task without intervention of the software.
 
 I2C interrupt enable flags
 
 I2C peripheral mode
 
 I2C instances
 
 I2C interrupts
 
 I2C frequency constants
 

Macros

#define I2C_EVENT_RXSTARTED(i2c)   MMIO32((i2c) + 0x14C)
 
#define I2C_EVENT_TXSTARTED(i2c)   MMIO32((i2c) + 0x150)
 
#define I2C_EVENT_LASTRX(i2c)   MMIO32((i2c) + 0x15C)
 
#define I2C_EVENT_LASTTX(i2c)   MMIO32((i2c) + 0x160)
 
#define I2C_RXDPTR(i2c)   MMIO32((i2c) + 0x534)
 
#define I2C_RXDMAXCNT(i2c)   MMIO32((i2c) + 0x538)
 
#define I2C_RXDAMOUNT(i2c)   MMIO32((i2c) + 0x53C)
 
#define I2C_RXDLIST(i2c)   MMIO32((i2c) + 0x540)
 
#define I2C_TXDPTR(i2c)   MMIO32((i2c) + 0x544)
 
#define I2C_TXDMAXCNT(i2c)   MMIO32((i2c) + 0x548)
 
#define I2C_TXDAMOUNT(i2c)   MMIO32((i2c) + 0x54C)
 
#define I2C_TXDLIST(i2c)   MMIO32((i2c) + 0x550)
 
#define I2C_TASK_STARTRX(i2c)   MMIO32((i2c) + 0x000)
 
#define I2C_TASK_STARTTX(i2c)   MMIO32((i2c) + 0x008)
 
#define I2C_TASK_STOP(i2c)   MMIO32((i2c) + 0x014)
 
#define I2C_TASK_SUSPEND(i2c)   MMIO32((i2c) + 0x01c)
 
#define I2C_TASK_RESUME(i2c)   MMIO32((i2c) + 0x020)
 
#define I2C_EVENT_STOPPED(i2c)   MMIO32((i2c) + 0x104)
 
#define I2C_EVENT_RXDREADY(i2c)   MMIO32((i2c) + 0x108)
 
#define I2C_EVENT_TXDSENT(i2c)   MMIO32((i2c) + 0x11c)
 
#define I2C_EVENT_ERROR(i2c)   MMIO32((i2c) + 0x124)
 
#define I2C_EVENT_BB(i2c)   MMIO32((i2c) + 0x138)
 
#define I2C_EVENT_SUSPENDED(i2c)   MMIO32((i2c) + 0x148)
 
#define I2C_SHORTS(i2c)   MMIO32((i2c) + 0x200)
 
#define I2C_INTEN(i2c)   MMIO32((i2c) + 0x300)
 
#define I2C_INTENSET(i2c)   MMIO32((i2c) + 0x304)
 
#define I2C_INTENCLR(i2c)   MMIO32((i2c) + 0x308)
 
#define I2C_ERRORSRC(i2c)   MMIO32((i2c) + 0x4c4)
 
#define I2C_ENABLE(i2c)   MMIO32((i2c) + 0x500)
 
#define I2C_PSELSCL(i2c)   MMIO32((i2c) + 0x508)
 
#define I2C_PSELSDA(i2c)   MMIO32((i2c) + 0x50c)
 
#define I2C_RXD(i2c)   MMIO32((i2c) + 0x518)
 
#define I2C_TXD(i2c)   MMIO32((i2c) + 0x51c)
 
#define I2C_FREQUENCY(i2c)   MMIO32((i2c) + 0x524)
 
#define I2C_ADDRESS(i2c)   MMIO32((i2c) + 0x588)
 
#define I2C_ERRORSRC_OVERRUN   (1 << 0)
 
#define I2C_ERRORSRC_ANACK   (1 << 1)
 
#define I2C_ERRORSRC_DNACK   (1 << 2)
 
#define I2C_PSEL_OFF   (0xffffffff)
 

Functions

void i2c_set_tx_buffer (uint32_t i2c, const uint8_t *buffer, uint8_t len)
 Configure I2C transmit buffer properties. More...
 
void i2c_set_rx_buffer (uint32_t i2c, uint8_t *buffer, uint8_t len)
 Configure I2C receive buffer properties. More...
 

Detailed Description

Defined Constants and Types for the NRF52xx I2C

Version
1.0.0
Date
Nov 2021

LGPL License Terms libopencm3 License

Author
© 2016 Maxim Sloyko maxim.nosp@m.s@go.nosp@m.ogle..nosp@m.com
© 2021 Eduard Drusa <ventyl86 at netkosice dot sk>

Macro Definition Documentation

◆ I2C_ADDRESS

#define I2C_ADDRESS (   i2c)    MMIO32((i2c) + 0x588)

Definition at line 73 of file common/i2c.h.

◆ I2C_ENABLE

#define I2C_ENABLE (   i2c)    MMIO32((i2c) + 0x500)

Definition at line 67 of file common/i2c.h.

◆ I2C_ERRORSRC

#define I2C_ERRORSRC (   i2c)    MMIO32((i2c) + 0x4c4)

Definition at line 66 of file common/i2c.h.

◆ I2C_ERRORSRC_ANACK

#define I2C_ERRORSRC_ANACK   (1 << 1)

Definition at line 104 of file common/i2c.h.

◆ I2C_ERRORSRC_DNACK

#define I2C_ERRORSRC_DNACK   (1 << 2)

Definition at line 105 of file common/i2c.h.

◆ I2C_ERRORSRC_OVERRUN

#define I2C_ERRORSRC_OVERRUN   (1 << 0)

Definition at line 103 of file common/i2c.h.

◆ I2C_EVENT_BB

#define I2C_EVENT_BB (   i2c)    MMIO32((i2c) + 0x138)

Definition at line 58 of file common/i2c.h.

◆ I2C_EVENT_ERROR

#define I2C_EVENT_ERROR (   i2c)    MMIO32((i2c) + 0x124)

Definition at line 57 of file common/i2c.h.

◆ I2C_EVENT_LASTRX

#define I2C_EVENT_LASTRX (   i2c)    MMIO32((i2c) + 0x15C)

Definition at line 44 of file 52/i2c.h.

◆ I2C_EVENT_LASTTX

#define I2C_EVENT_LASTTX (   i2c)    MMIO32((i2c) + 0x160)

Definition at line 45 of file 52/i2c.h.

◆ I2C_EVENT_RXDREADY

#define I2C_EVENT_RXDREADY (   i2c)    MMIO32((i2c) + 0x108)

Definition at line 55 of file common/i2c.h.

◆ I2C_EVENT_RXSTARTED

#define I2C_EVENT_RXSTARTED (   i2c)    MMIO32((i2c) + 0x14C)

Definition at line 42 of file 52/i2c.h.

◆ I2C_EVENT_STOPPED

#define I2C_EVENT_STOPPED (   i2c)    MMIO32((i2c) + 0x104)

Definition at line 54 of file common/i2c.h.

◆ I2C_EVENT_SUSPENDED

#define I2C_EVENT_SUSPENDED (   i2c)    MMIO32((i2c) + 0x148)

Definition at line 59 of file common/i2c.h.

◆ I2C_EVENT_TXDSENT

#define I2C_EVENT_TXDSENT (   i2c)    MMIO32((i2c) + 0x11c)

Definition at line 56 of file common/i2c.h.

◆ I2C_EVENT_TXSTARTED

#define I2C_EVENT_TXSTARTED (   i2c)    MMIO32((i2c) + 0x150)

Definition at line 43 of file 52/i2c.h.

◆ I2C_FREQUENCY

#define I2C_FREQUENCY (   i2c)    MMIO32((i2c) + 0x524)

Definition at line 72 of file common/i2c.h.

◆ I2C_INTEN

#define I2C_INTEN (   i2c)    MMIO32((i2c) + 0x300)

Definition at line 63 of file common/i2c.h.

◆ I2C_INTENCLR

#define I2C_INTENCLR (   i2c)    MMIO32((i2c) + 0x308)

Definition at line 65 of file common/i2c.h.

◆ I2C_INTENSET

#define I2C_INTENSET (   i2c)    MMIO32((i2c) + 0x304)

Definition at line 64 of file common/i2c.h.

◆ I2C_PSEL_OFF

#define I2C_PSEL_OFF   (0xffffffff)

Definition at line 139 of file common/i2c.h.

◆ I2C_PSELSCL

#define I2C_PSELSCL (   i2c)    MMIO32((i2c) + 0x508)

Definition at line 68 of file common/i2c.h.

◆ I2C_PSELSDA

#define I2C_PSELSDA (   i2c)    MMIO32((i2c) + 0x50c)

Definition at line 69 of file common/i2c.h.

◆ I2C_RXD

#define I2C_RXD (   i2c)    MMIO32((i2c) + 0x518)

Definition at line 70 of file common/i2c.h.

◆ I2C_RXDAMOUNT

#define I2C_RXDAMOUNT (   i2c)    MMIO32((i2c) + 0x53C)

Definition at line 49 of file 52/i2c.h.

◆ I2C_RXDLIST

#define I2C_RXDLIST (   i2c)    MMIO32((i2c) + 0x540)

Definition at line 50 of file 52/i2c.h.

◆ I2C_RXDMAXCNT

#define I2C_RXDMAXCNT (   i2c)    MMIO32((i2c) + 0x538)

Definition at line 48 of file 52/i2c.h.

◆ I2C_RXDPTR

#define I2C_RXDPTR (   i2c)    MMIO32((i2c) + 0x534)

Definition at line 47 of file 52/i2c.h.

◆ I2C_SHORTS

#define I2C_SHORTS (   i2c)    MMIO32((i2c) + 0x200)

Definition at line 62 of file common/i2c.h.

◆ I2C_TASK_RESUME

#define I2C_TASK_RESUME (   i2c)    MMIO32((i2c) + 0x020)

Definition at line 51 of file common/i2c.h.

◆ I2C_TASK_STARTRX

#define I2C_TASK_STARTRX (   i2c)    MMIO32((i2c) + 0x000)

Definition at line 47 of file common/i2c.h.

◆ I2C_TASK_STARTTX

#define I2C_TASK_STARTTX (   i2c)    MMIO32((i2c) + 0x008)

Definition at line 48 of file common/i2c.h.

◆ I2C_TASK_STOP

#define I2C_TASK_STOP (   i2c)    MMIO32((i2c) + 0x014)

Definition at line 49 of file common/i2c.h.

◆ I2C_TASK_SUSPEND

#define I2C_TASK_SUSPEND (   i2c)    MMIO32((i2c) + 0x01c)

Definition at line 50 of file common/i2c.h.

◆ I2C_TXD

#define I2C_TXD (   i2c)    MMIO32((i2c) + 0x51c)

Definition at line 71 of file common/i2c.h.

◆ I2C_TXDAMOUNT

#define I2C_TXDAMOUNT (   i2c)    MMIO32((i2c) + 0x54C)

Definition at line 53 of file 52/i2c.h.

◆ I2C_TXDLIST

#define I2C_TXDLIST (   i2c)    MMIO32((i2c) + 0x550)

Definition at line 54 of file 52/i2c.h.

◆ I2C_TXDMAXCNT

#define I2C_TXDMAXCNT (   i2c)    MMIO32((i2c) + 0x548)

Definition at line 52 of file 52/i2c.h.

◆ I2C_TXDPTR

#define I2C_TXDPTR (   i2c)    MMIO32((i2c) + 0x544)

Definition at line 51 of file 52/i2c.h.

Function Documentation

◆ i2c_set_rx_buffer()

void i2c_set_rx_buffer ( uint32_t  i2c,
uint8_t *  buffer,
uint8_t  len 
)

Configure I2C receive buffer properties.

Configures receive buffer for EasyDMA transaction. This API is only available if I2C_MODE_MASTER mode is activated.

Configures linear RX buffer for EasyDMA transmission.

Parameters
[in]i2ci2c peripheral base, see I2C instances
[in]bufferaddress of buffer start
[in]lenlength of the buffer

Definition at line 54 of file i2c.c.

References I2C_RXDLIST, I2C_RXDMAXCNT, and I2C_RXDPTR.

◆ i2c_set_tx_buffer()

void i2c_set_tx_buffer ( uint32_t  i2c,
const uint8_t *  buffer,
uint8_t  len 
)

Configure I2C transmit buffer properties.

Configures transmit buffer for EasyDMA transaction. This API is only available if I2C_MODE_MASTER mode is activated.

Configures linear TX buffer for EasyDMA transmission.

Parameters
[in]i2ci2c peripheral base, see I2C instances
[in]bufferaddress of buffer start
[in]lenlength of data in the buffer

Definition at line 37 of file i2c.c.

References I2C_TXDLIST, I2C_TXDMAXCNT, and I2C_TXDPTR.