79typedef enum : uint32_t {
110typedef enum : uint8_t {
236 uint8_t peripheral_7b,
280ra8_i2c_read(uint8_t channel, uint8_t peripheral_7b, uint8_t* data, uint32_t len);
318 uint8_t peripheral_7b,
410typedef enum : uint8_t {
431typedef enum : uint8_t {
616 uint32_t* out_received);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t ra8_i2c_deinit(uint8_t channel)
Tear down an IIC channel.
ra8_i2c_speed_t
Supported bus speeds.
@ k_ra8_i2c_speed_standard
100 kHz Standard mode (Sm).
@ k_ra8_i2c_speed_fast
400 kHz Fast mode (Fm).
@ k_ra8_i2c_speed_fast_plus
1 MHz Fast-mode Plus (Fm+).
ra8_err_t ra8_i2c_peripheral_transmit(uint8_t channel, const uint8_t *data, uint32_t len, uint32_t *out_sent)
Answer a controller-read transaction from data (target transmit).
ra8_err_t ra8_i2c_scan(uint8_t channel, uint8_t peripheral_7b, bool *out_acked)
Probe whether a 7-bit peripheral address ACKs.
ra8_err_t ra8_i2c_init(uint8_t channel, const ra8_i2c_cfg_t *cfg)
Initialise an IIC channel as a controller and bring the bus up.
ra8_err_t ra8_i2c_peripheral_init(uint8_t channel, const ra8_i2c_peripheral_cfg_t *cfg)
Arm an IIC channel to answer as an I2C target (peripheral).
ra8_err_t ra8_i2c_write(uint8_t channel, uint8_t peripheral_7b, const uint8_t *data, uint32_t len, bool send_stop)
Polling write of len bytes to a 7-bit peripheral address.
ra8_err_t ra8_i2c_get_errors(uint8_t channel, uint8_t *out_mask)
Read latched error flags from ICSR2 (AL / NACKF / TMOF).
ra8_err_t ra8_i2c_read(uint8_t channel, uint8_t peripheral_7b, uint8_t *data, uint32_t len)
Polling read of len bytes from a 7-bit peripheral.
ra8_i2c_peripheral_slot_t
Which own-address register pair (SARLy/SARUy) holds the address.
@ k_ra8_i2c_peripheral_slot_2
Own-address slot 2 (SARL2/SARU2).
@ k_ra8_i2c_peripheral_slot_0
Own-address slot 0 (SARL0/SARU0).
@ k_ra8_i2c_peripheral_slot_1
Own-address slot 1 (SARL1/SARU1).
ra8_err_t ra8_i2c_clear_errors(uint8_t channel)
Clear latched error flags in ICSR2.
void(* ra8_i2c_peripheral_event_fn_t)(void *ctx, ra8_i2c_peripheral_event_t event)
Address-match callback fired by ra8_i2c_peripheral_dispatch.
ra8_err_t ra8_i2c_peripheral_poll(uint8_t channel, ra8_i2c_peripheral_event_t *out_event)
Wait (bounded) for a controller to address this target.
ra8_i2c_err_mask_t
Error-mask bits returned by ra8_i2c_get_errors.
@ k_ra8_i2c_err_none
No latched error.
@ k_ra8_i2c_err_arb_lost
ICSR2.AL set (arbitration lost).
@ k_ra8_i2c_err_nack
ICSR2.NACKF set (NACK received).
@ k_ra8_i2c_err_timeout
ICSR2.TMOF set (bus timeout).
ra8_err_t ra8_i2c_set_clock(uint8_t channel, uint32_t bus_hz, uint32_t pclkb_hz)
Update the bus clock without tearing the channel down.
ra8_err_t ra8_i2c_transfer(uint8_t channel, uint8_t peripheral_7b, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Combined write-then-RESTART-then-read in one bus transaction.
ra8_err_t ra8_i2c_peripheral_deinit(uint8_t channel)
Disarm own-address matching, returning the channel to controller use.
void ra8_i2c_peripheral_dispatch(uint8_t channel)
Snapshot the latched target status and fire the attached callback.
ra8_err_t ra8_i2c_peripheral_receive(uint8_t channel, uint8_t *buf, uint32_t capacity, uint32_t *out_received)
Drain a controller-write transaction into buf (target receive).
ra8_i2c_peripheral_event_t
Outcome of ra8_i2c_peripheral_poll / ra8_i2c_peripheral_dispatch.
@ k_ra8_i2c_peripheral_event_none
No own-address match observed.
@ k_ra8_i2c_peripheral_event_write
Controller WRITE: call receive next.
@ k_ra8_i2c_peripheral_event_read
Controller READ: call transmit next.
@ k_ra8_i2c_peripheral_event_stop
STOP ended the transaction (idle).
ra8_err_t ra8_i2c_peripheral_attach_handler(uint8_t channel, ra8_i2c_peripheral_event_fn_t fn, void *ctx)
Attach (or detach) the address-match callback for a channel.
Configuration descriptor for ra8_i2c_init.
uint32_t bus_hz
Target I2C clock rate in Hz.
uint32_t pclkb_hz
Current PCLKB frequency in Hz for bit-rate calc.
Configuration descriptor for ra8_i2c_peripheral_init.
ra8_i2c_peripheral_slot_t slot
Own-address comparator slot.
uint8_t own_addr_7b
7-bit own address to answer on.
bool general_call
Also answer the general-call addr.
bool irq_enable
Arm ICIER RIE / TIE / SPIE.
bool clock_stretch
Arm ICMR3.WAIT clock stretching.