Embedded Artistry Framework
Embedded Systems C++ Framework
Enumerations | Functions | Variables
twim_helper_.hpp File Reference
#include <nordic_utils.hpp>
#include <processor_includes.hpp>
#include <volatile/volatile.hpp>
Include dependency graph for twim_helper_.hpp:
This graph shows which files directly or indirectly include this file:

Enumerations

enum  twi_task_t {
  TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), TWIM_TASK_STOP = offsetof(NRF_TWIM_Type, TASKS_STOP), TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND),
  TWIM_TASK_RESUME = offsetof(NRF_TWIM_Type, TASKS_RESUME)
}
 
enum  twi_event_t {
  TWIM_EVENT_STOPPED = offsetof(NRF_TWIM_Type, EVENTS_STOPPED), TWIM_EVENT_ERROR = offsetof(NRF_TWIM_Type, EVENTS_ERROR), TWIM_EVENT_SUSPENDED, TWIM_EVENT_RXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_RXSTARTED),
  TWIM_EVENT_TXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_TXSTARTED), TWIM_EVENT_LASTRX = offsetof(NRF_TWIM_Type, EVENTS_LASTRX), TWIM_EVENT_LASTTX = offsetof(NRF_TWIM_Type, EVENTS_LASTTX)
}
 

Functions

static void interrupts_disable_ (NRF_TWIM_Type *twi) noexcept
 
static void interrupts_enable_ (NRF_TWIM_Type *twi, uint32_t mask) noexcept
 
static void disable_shortcuts_ (NRF_TWIM_Type *twi) noexcept
 
static void set_shortcuts_ (NRF_TWIM_Type *twi, uint32_t mask) noexcept
 
static void clear_event_ (NRF_TWIM_Type *twi, twi_event_t event) noexcept
 
static bool check_event_ (NRF_TWIM_Type *twi, twi_event_t event) noexcept
 
static void task_trigger_ (NRF_TWIM_Type *twi, twi_task_t task) noexcept
 
static void set_tx_buffer_ (NRF_TWIM_Type *twi, const uint8_t *tx_data, size_t length) noexcept
 
static size_t get_txd_amount_ (NRF_TWIM_Type *twi) noexcept
 
static void set_rx_buffer_ (NRF_TWIM_Type *twi, uint8_t *rx_data, size_t length) noexcept
 
static size_t get_rxd_amount_ (NRF_TWIM_Type *twi) noexcept
 
static void tx_list_enable_ (NRF_TWIM_Type *twi) noexcept
 
static void tx_list_disable_ (NRF_TWIM_Type *twi) noexcept
 
static void rx_list_enable_ (NRF_TWIM_Type *twi) noexcept
 
static void rx_list_disable_ (NRF_TWIM_Type *twi) noexcept
 
static void handle_error_event_ (NRF_TWIM_Type *twi) noexcept
 
static void block_until_complete (NRF_TWIM_Type *twi, twi_event_t exit_event) noexcept
 
static void clear_events_prior_to_kickoff (NRF_TWIM_Type *twi) noexcept
 
static twi_event_t kickoff_rx (NRF_TWIM_Type *twi) noexcept
 
static twi_event_t kickoff_tx (NRF_TWIM_Type *twi, bool no_stop) noexcept
 
static twi_event_t kickoff_txrx (NRF_TWIM_Type *twi) noexcept
 
static uint32_t get_errorsrc_ (NRF_TWIM_Type *twi) noexcept
 

Variables

constexpr uint32_t ALL_INTS_MASK
 All TWI interrupts. More...
 
constexpr uint32_t ALL_SHORTCUTS_MASK
 All TWI shortcuts. More...
 

Enumeration Type Documentation

◆ twi_event_t

Enumerator
TWIM_EVENT_STOPPED 

TWI stopped.

TWIM_EVENT_ERROR 

TWI error.

TWIM_EVENT_SUSPENDED 

TWI entered the suspended state. //0x148 - they hardcoded??

TWIM_EVENT_RXSTARTED 
TWIM_EVENT_TXSTARTED 
TWIM_EVENT_LASTRX 
TWIM_EVENT_LASTTX 

◆ twi_task_t

enum twi_task_t
Enumerator
TWIM_TASK_STARTRX 

Start TWI receive sequence.

TWIM_TASK_STARTTX 

Start TWI transmit sequence.

TWIM_TASK_STOP 

Stop TWI transaction.

TWIM_TASK_SUSPEND 

Suspend TWI transaction.

TWIM_TASK_RESUME 

Resume TWI transaction.

Function Documentation

◆ block_until_complete()

static void block_until_complete ( NRF_TWIM_Type *  twi,
twi_event_t  exit_event 
)
staticnoexcept

◆ check_event_()

static bool check_event_ ( NRF_TWIM_Type *  twi,
twi_event_t  event 
)
inlinestaticnoexcept

◆ clear_event_()

static void clear_event_ ( NRF_TWIM_Type *  twi,
twi_event_t  event 
)
inlinestaticnoexcept

◆ clear_events_prior_to_kickoff()

static void clear_events_prior_to_kickoff ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ disable_shortcuts_()

static void disable_shortcuts_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ get_errorsrc_()

static uint32_t get_errorsrc_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ get_rxd_amount_()

static size_t get_rxd_amount_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ get_txd_amount_()

static size_t get_txd_amount_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ handle_error_event_()

static void handle_error_event_ ( NRF_TWIM_Type *  twi)
staticnoexcept

◆ interrupts_disable_()

static void interrupts_disable_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ interrupts_enable_()

static void interrupts_enable_ ( NRF_TWIM_Type *  twi,
uint32_t  mask 
)
inlinestaticnoexcept

◆ kickoff_rx()

static twi_event_t kickoff_rx ( NRF_TWIM_Type *  twi)
staticnoexcept

◆ kickoff_tx()

static twi_event_t kickoff_tx ( NRF_TWIM_Type *  twi,
bool  no_stop 
)
staticnoexcept

◆ kickoff_txrx()

static twi_event_t kickoff_txrx ( NRF_TWIM_Type *  twi)
staticnoexcept

◆ rx_list_disable_()

static void rx_list_disable_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ rx_list_enable_()

static void rx_list_enable_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ set_rx_buffer_()

static void set_rx_buffer_ ( NRF_TWIM_Type *  twi,
uint8_t rx_data,
size_t  length 
)
inlinestaticnoexcept

◆ set_shortcuts_()

static void set_shortcuts_ ( NRF_TWIM_Type *  twi,
uint32_t  mask 
)
inlinestaticnoexcept

◆ set_tx_buffer_()

static void set_tx_buffer_ ( NRF_TWIM_Type *  twi,
const uint8_t tx_data,
size_t  length 
)
inlinestaticnoexcept

◆ task_trigger_()

static void task_trigger_ ( NRF_TWIM_Type *  twi,
twi_task_t  task 
)
inlinestaticnoexcept

◆ tx_list_disable_()

static void tx_list_disable_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

◆ tx_list_enable_()

static void tx_list_enable_ ( NRF_TWIM_Type *  twi)
inlinestaticnoexcept

Variable Documentation

◆ ALL_INTS_MASK

constexpr uint32_t ALL_INTS_MASK
Initial value:
= static_cast<uint32_t>(
TWIM_INTENSET_STOPPED_Msk | TWIM_INTENSET_ERROR_Msk | TWIM_INTENSET_SUSPENDED_Msk |
TWIM_INTENSET_RXSTARTED_Msk | TWIM_INTENSET_TXSTARTED_Msk | TWIM_INTENSET_LASTRX_Msk |
TWIM_INTENSET_LASTTX_Msk)

All TWI interrupts.

Referenced by interrupts_disable_().

◆ ALL_SHORTCUTS_MASK

constexpr uint32_t ALL_SHORTCUTS_MASK
Initial value:
= static_cast<uint32_t>(
TWIM_SHORTS_LASTTX_STARTRX_Msk | TWIM_SHORTS_LASTTX_SUSPEND_Msk | TWIM_SHORTS_LASTTX_STOP_Msk |
TWIM_SHORTS_LASTRX_STARTTX_Msk | TWIM_SHORTS_LASTRX_STOP_Msk)

All TWI shortcuts.

Referenced by disable_shortcuts_().