libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
#include <libopencm3/cm3/common.h>
#include <libopencm3/nrf/memorymap.h>
#include <libopencm3/nrf/periph.h>
Go to the source code of this file.
Macros | |
#define | I2C0 I2C0_BASE |
#define | I2C1 I2C1_BASE |
#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_SHORTS_BB_SUSPEND (1 << 0) |
On byte boundary, activate suspend task. More... | |
#define | I2C_SHORTS_BB_STOP (1 << 1) |
On byte boundary, activate stop task. More... | |
#define | I2C_INTEN_STOPPED (1 << 1) |
#define | I2C_INTEN_RXDREADY (1 << 2) |
#define | I2C_INTEN_TXDSENT (1 << 7) |
#define | I2C_INTEN_ERROR (1 << 9) |
#define | I2C_INTEN_BB (1 << 14) |
#define | I2C_ERRORSRC_OVERRUN (1 << 0) |
#define | I2C_ERRORSRC_ANACK (1 << 1) |
#define | I2C_ERRORSRC_DNACK (1 << 2) |
#define | I2C_MODE_LEGACY (5) |
NRF51 legacy mode. More... | |
#define | I2C_FREQUENCY_100K (0x01980000) |
100kHz More... | |
#define | I2C_FREQUENCY_250K (0x04000000) |
250kHz More... | |
#define | I2C_FREQUENCY_390K (0x06200000) |
390kHz More... | |
#define | I2C_FREQUENCY_400K (0x06680000) |
400kHz More... | |
#define | I2C_PSEL_OFF (0xffffffff) |
Functions | |
void | i2c_enable (uint32_t i2c, uint32_t mode) |
Enable I2C peripheral. More... | |
void | i2c_disable (uint32_t i2c) |
Disable I2C peripheral. More... | |
void | i2c_start_tx (uint32_t i2c) |
Start I2C transmission. More... | |
void | i2c_start_rx (uint32_t i2c) |
Start I2C reception. More... | |
void | i2c_send_stop (uint32_t i2c) |
Signal stop on I2C line. More... | |
void | i2c_set_fast_mode (uint32_t i2c) |
Select Fast (400kHz) mode. More... | |
void | i2c_set_standard_mode (uint32_t i2c) |
Select Standard (100kHz) mode. More... | |
void | i2c_set_frequency (uint32_t i2c, uint32_t freq) |
Set I2C frequency. More... | |
void | i2c_send_data (uint32_t i2c, uint8_t data) |
Write Data to TXD register to be sent. More... | |
uint8_t | i2c_get_data (uint32_t i2c) |
Read Data from RXD register. More... | |
void | i2c_select_pins (uint32_t i2c, uint32_t scl_pin, uint32_t sda_pin) |
Select GPIO pins to be used by this peripheral. More... | |
void | i2c_set_address (uint32_t i2c, uint8_t addr) |
Set 7bit I2C address of the device you wish to communicate with. More... | |
void | i2c_resume (uint32_t i2c) |
Resume I2C transaction. More... | |
void | i2c_set_shorts (uint32_t i2c, uint32_t shorts) |
Configure event -> task shortcuts. More... | |