nRF52 Series only: Hardware access layer for managing the Inter-IC Sound (I2S) peripheral. More...
Macros | |
#define | NRF_I2S_PIN_NOT_CONNECTED 0xFFFFFFFF |
This value can be provided as a parameter for the nrf_i2s_pins_set function call to specify that a given I2S signal (SDOUT, SDIN, or MCK) shall not be connected to a physical pin. | |
Enumerations | |
enum | nrf_i2s_task_t { NRF_I2S_TASK_START = offsetof(NRF_I2S_Type, TASKS_START), NRF_I2S_TASK_STOP = offsetof(NRF_I2S_Type, TASKS_STOP) } |
I2S tasks. More... | |
enum | nrf_i2s_event_t { NRF_I2S_EVENT_RXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_RXPTRUPD), NRF_I2S_EVENT_TXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_TXPTRUPD), NRF_I2S_EVENT_STOPPED = offsetof(NRF_I2S_Type, EVENTS_STOPPED) } |
I2S events. More... | |
enum | nrf_i2s_int_mask_t { NRF_I2S_INT_RXPTRUPD_MASK = I2S_INTENSET_RXPTRUPD_Msk, NRF_I2S_INT_TXPTRUPD_MASK = I2S_INTENSET_TXPTRUPD_Msk, NRF_I2S_INT_STOPPED_MASK = I2S_INTENSET_STOPPED_Msk } |
I2S interrupts. More... | |
enum | nrf_i2s_mode_t { NRF_I2S_MODE_MASTER = I2S_CONFIG_MODE_MODE_Master, NRF_I2S_MODE_SLAVE = I2S_CONFIG_MODE_MODE_Slave } |
I2S modes of operation. More... | |
enum | nrf_i2s_mck_t { NRF_I2S_MCK_DISABLED = 0, NRF_I2S_MCK_32MDIV2 = (int)I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2, NRF_I2S_MCK_32MDIV3 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3, NRF_I2S_MCK_32MDIV4 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4, NRF_I2S_MCK_32MDIV5 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5, NRF_I2S_MCK_32MDIV6 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6, NRF_I2S_MCK_32MDIV8 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8, NRF_I2S_MCK_32MDIV10 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10, NRF_I2S_MCK_32MDIV11 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11, NRF_I2S_MCK_32MDIV15 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15, NRF_I2S_MCK_32MDIV16 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16, NRF_I2S_MCK_32MDIV21 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21, NRF_I2S_MCK_32MDIV23 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23, NRF_I2S_MCK_32MDIV31 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31, NRF_I2S_MCK_32MDIV42 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42, NRF_I2S_MCK_32MDIV63 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63, NRF_I2S_MCK_32MDIV125 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125 } |
I2S master clock generator settings. More... | |
enum | nrf_i2s_ratio_t { NRF_I2S_RATIO_32X = I2S_CONFIG_RATIO_RATIO_32X, NRF_I2S_RATIO_48X = I2S_CONFIG_RATIO_RATIO_48X, NRF_I2S_RATIO_64X = I2S_CONFIG_RATIO_RATIO_64X, NRF_I2S_RATIO_96X = I2S_CONFIG_RATIO_RATIO_96X, NRF_I2S_RATIO_128X = I2S_CONFIG_RATIO_RATIO_128X, NRF_I2S_RATIO_192X = I2S_CONFIG_RATIO_RATIO_192X, NRF_I2S_RATIO_256X = I2S_CONFIG_RATIO_RATIO_256X, NRF_I2S_RATIO_384X = I2S_CONFIG_RATIO_RATIO_384X, NRF_I2S_RATIO_512X = I2S_CONFIG_RATIO_RATIO_512X } |
I2S MCK/LRCK ratios. More... | |
enum | nrf_i2s_swidth_t { NRF_I2S_SWIDTH_8BIT = I2S_CONFIG_SWIDTH_SWIDTH_8Bit, NRF_I2S_SWIDTH_16BIT = I2S_CONFIG_SWIDTH_SWIDTH_16Bit, NRF_I2S_SWIDTH_24BIT = I2S_CONFIG_SWIDTH_SWIDTH_24Bit } |
I2S sample widths. More... | |
enum | nrf_i2s_align_t { NRF_I2S_ALIGN_LEFT = I2S_CONFIG_ALIGN_ALIGN_Left, NRF_I2S_ALIGN_RIGHT = I2S_CONFIG_ALIGN_ALIGN_Right } |
I2S alignments of sample within a frame. More... | |
enum | nrf_i2s_format_t { NRF_I2S_FORMAT_I2S = I2S_CONFIG_FORMAT_FORMAT_I2S, NRF_I2S_FORMAT_ALIGNED = I2S_CONFIG_FORMAT_FORMAT_Aligned } |
I2S frame formats. More... | |
enum | nrf_i2s_channels_t { NRF_I2S_CHANNELS_STEREO = I2S_CONFIG_CHANNELS_CHANNELS_Stereo, NRF_I2S_CHANNELS_LEFT = I2S_CONFIG_CHANNELS_CHANNELS_Left, NRF_I2S_CHANNELS_RIGHT = I2S_CONFIG_CHANNELS_CHANNELS_Right } |
I2S enabled channels. More... | |
Functions | |
__STATIC_INLINE void | nrf_i2s_task_trigger (NRF_I2S_Type *p_i2s, nrf_i2s_task_t task) |
Function for activating a specific I2S task. More... | |
__STATIC_INLINE uint32_t | nrf_i2s_task_address_get (NRF_I2S_Type const *p_i2s, nrf_i2s_task_t task) |
Function for getting the address of a specific I2S task register. More... | |
__STATIC_INLINE void | nrf_i2s_event_clear (NRF_I2S_Type *p_i2s, nrf_i2s_event_t event) |
Function for clearing a specific I2S event. More... | |
__STATIC_INLINE bool | nrf_i2s_event_check (NRF_I2S_Type const *p_i2s, nrf_i2s_event_t event) |
Function for checking the state of a specific I2S event. More... | |
__STATIC_INLINE uint32_t | nrf_i2s_event_address_get (NRF_I2S_Type const *p_i2s, nrf_i2s_event_t event) |
Function for getting the address of a specific I2S event register. More... | |
__STATIC_INLINE void | nrf_i2s_int_enable (NRF_I2S_Type *p_i2s, uint32_t mask) |
Function for enabling specified interrupts. More... | |
__STATIC_INLINE void | nrf_i2s_int_disable (NRF_I2S_Type *p_i2s, uint32_t mask) |
Function for disabling specified interrupts. More... | |
__STATIC_INLINE bool | nrf_i2s_int_enable_check (NRF_I2S_Type const *p_i2s, nrf_i2s_int_mask_t i2s_int) |
Function for retrieving the state of a given interrupt. More... | |
__STATIC_INLINE void | nrf_i2s_enable (NRF_I2S_Type *p_i2s) |
Function for enabling the I2S peripheral. More... | |
__STATIC_INLINE void | nrf_i2s_disable (NRF_I2S_Type *p_i2s) |
Function for disabling the I2S peripheral. More... | |
__STATIC_INLINE void | nrf_i2s_pins_set (NRF_I2S_Type *p_i2s, uint32_t sck_pin, uint32_t lrck_pin, uint32_t mck_pin, uint32_t sdout_pin, uint32_t sdin_pin) |
Function for configuring I2S pins. More... | |
__STATIC_INLINE bool | nrf_i2s_configure (NRF_I2S_Type *p_i2s, nrf_i2s_mode_t mode, nrf_i2s_format_t format, nrf_i2s_align_t alignment, nrf_i2s_swidth_t sample_width, nrf_i2s_channels_t channels, nrf_i2s_mck_t mck_setup, nrf_i2s_ratio_t ratio) |
Function for setting the I2S peripheral configuration. More... | |
__STATIC_INLINE void | nrf_i2s_transfer_set (NRF_I2S_Type *p_i2s, uint16_t size, uint32_t *p_rx_buffer, uint32_t const *p_tx_buffer) |
Function for setting up the I2S transfer. More... | |
__STATIC_INLINE void | nrf_i2s_rx_buffer_set (NRF_I2S_Type *p_i2s, uint32_t *p_buffer) |
Function for setting the pointer to the receive buffer. More... | |
__STATIC_INLINE uint32_t * | nrf_i2s_rx_buffer_get (NRF_I2S_Type const *p_i2s) |
Function for getting the pointer to the receive buffer. More... | |
__STATIC_INLINE void | nrf_i2s_tx_buffer_set (NRF_I2S_Type *p_i2s, uint32_t const *p_buffer) |
Function for setting the pointer to the transmit buffer. More... | |
__STATIC_INLINE uint32_t * | nrf_i2s_tx_buffer_get (NRF_I2S_Type const *p_i2s) |
Function for getting the pointer to the transmit buffer. More... | |
nRF52 Series only: Hardware access layer for managing the Inter-IC Sound (I2S) peripheral.
enum nrf_i2s_align_t |
enum nrf_i2s_channels_t |
enum nrf_i2s_event_t |
enum nrf_i2s_format_t |
enum nrf_i2s_int_mask_t |
enum nrf_i2s_mck_t |
I2S master clock generator settings.
enum nrf_i2s_mode_t |
enum nrf_i2s_ratio_t |
I2S MCK/LRCK ratios.
enum nrf_i2s_swidth_t |
enum nrf_i2s_task_t |
__STATIC_INLINE bool nrf_i2s_configure | ( | NRF_I2S_Type * | p_i2s, |
nrf_i2s_mode_t | mode, | ||
nrf_i2s_format_t | format, | ||
nrf_i2s_align_t | alignment, | ||
nrf_i2s_swidth_t | sample_width, | ||
nrf_i2s_channels_t | channels, | ||
nrf_i2s_mck_t | mck_setup, | ||
nrf_i2s_ratio_t | ratio | ||
) |
Function for setting the I2S peripheral configuration.
[in] | p_i2s | I2S instance. |
[in] | mode | Mode of operation (master or slave). |
[in] | format | I2S frame format. |
[in] | alignment | Alignment of sample within a frame. |
[in] | sample_width | Sample width. |
[in] | channels | Enabled channels. |
[in] | mck_setup | Master clock generator setup. |
[in] | ratio | MCK/LRCK ratio. |
true | If the configuration has been set successfully. |
false | If the requested configuration is not allowed. |
__STATIC_INLINE void nrf_i2s_disable | ( | NRF_I2S_Type * | p_i2s | ) |
Function for disabling the I2S peripheral.
[in] | p_i2s | I2S instance. |
__STATIC_INLINE void nrf_i2s_enable | ( | NRF_I2S_Type * | p_i2s | ) |
Function for enabling the I2S peripheral.
[in] | p_i2s | I2S instance. |
__STATIC_INLINE uint32_t nrf_i2s_event_address_get | ( | NRF_I2S_Type const * | p_i2s, |
nrf_i2s_event_t | event | ||
) |
Function for getting the address of a specific I2S event register.
[in] | p_i2s | I2S instance. |
[in] | event | Requested event. |
__STATIC_INLINE bool nrf_i2s_event_check | ( | NRF_I2S_Type const * | p_i2s, |
nrf_i2s_event_t | event | ||
) |
Function for checking the state of a specific I2S event.
[in] | p_i2s | I2S instance. |
[in] | event | Event to check. |
true | If the event is set. |
false | If the event is not set. |
__STATIC_INLINE void nrf_i2s_event_clear | ( | NRF_I2S_Type * | p_i2s, |
nrf_i2s_event_t | event | ||
) |
Function for clearing a specific I2S event.
[in] | p_i2s | I2S instance. |
[in] | event | Event to clear. |
__STATIC_INLINE void nrf_i2s_int_disable | ( | NRF_I2S_Type * | p_i2s, |
uint32_t | mask | ||
) |
Function for disabling specified interrupts.
[in] | p_i2s | I2S instance. |
[in] | mask | Interrupts to disable. |
__STATIC_INLINE void nrf_i2s_int_enable | ( | NRF_I2S_Type * | p_i2s, |
uint32_t | mask | ||
) |
Function for enabling specified interrupts.
[in] | p_i2s | I2S instance. |
[in] | mask | Interrupts to enable. |
__STATIC_INLINE bool nrf_i2s_int_enable_check | ( | NRF_I2S_Type const * | p_i2s, |
nrf_i2s_int_mask_t | i2s_int | ||
) |
Function for retrieving the state of a given interrupt.
[in] | p_i2s | I2S instance. |
[in] | i2s_int | Interrupt to check. |
true | If the interrupt is enabled. |
false | If the interrupt is not enabled. |
__STATIC_INLINE void nrf_i2s_pins_set | ( | NRF_I2S_Type * | p_i2s, |
uint32_t | sck_pin, | ||
uint32_t | lrck_pin, | ||
uint32_t | mck_pin, | ||
uint32_t | sdout_pin, | ||
uint32_t | sdin_pin | ||
) |
Function for configuring I2S pins.
Usage of the SDOUT, SDIN, and MCK signals is optional. If a given signal is not needed, pass the NRF_I2S_PIN_NOT_CONNECTED value instead of its pin number.
[in] | p_i2s | I2S instance. |
[in] | sck_pin | SCK pin number. |
[in] | lrck_pin | LRCK pin number. |
[in] | mck_pin | MCK pin number. |
[in] | sdout_pin | SDOUT pin number. |
[in] | sdin_pin | SDIN pin number. |
__STATIC_INLINE uint32_t* nrf_i2s_rx_buffer_get | ( | NRF_I2S_Type const * | p_i2s | ) |
Function for getting the pointer to the receive buffer.
[in] | p_i2s | I2S instance. |
__STATIC_INLINE void nrf_i2s_rx_buffer_set | ( | NRF_I2S_Type * | p_i2s, |
uint32_t * | p_buffer | ||
) |
Function for setting the pointer to the receive buffer.
[in] | p_i2s | I2S instance. |
[in] | p_buffer | Pointer to the receive buffer. |
__STATIC_INLINE uint32_t nrf_i2s_task_address_get | ( | NRF_I2S_Type const * | p_i2s, |
nrf_i2s_task_t | task | ||
) |
Function for getting the address of a specific I2S task register.
[in] | p_i2s | I2S instance. |
[in] | task | Requested task. |
__STATIC_INLINE void nrf_i2s_task_trigger | ( | NRF_I2S_Type * | p_i2s, |
nrf_i2s_task_t | task | ||
) |
Function for activating a specific I2S task.
[in] | p_i2s | I2S instance. |
[in] | task | Task to activate. |
__STATIC_INLINE void nrf_i2s_transfer_set | ( | NRF_I2S_Type * | p_i2s, |
uint16_t | size, | ||
uint32_t * | p_rx_buffer, | ||
uint32_t const * | p_tx_buffer | ||
) |
Function for setting up the I2S transfer.
This function sets up the RX and TX buffers and enables reception and/or transmission accordingly. If the transfer in a given direction is not required, pass NULL instead of the pointer to the corresponding buffer.
[in] | p_i2s | I2S instance. |
[in] | size | Size of the buffers (in 32-bit words). |
[in] | p_rx_buffer | Pointer to the receive buffer. Pass NULL to disable reception. |
[in] | p_tx_buffer | Pointer to the transmit buffer. Pass NULL to disable transmission. |
__STATIC_INLINE uint32_t* nrf_i2s_tx_buffer_get | ( | NRF_I2S_Type const * | p_i2s | ) |
Function for getting the pointer to the transmit buffer.
[in] | p_i2s | I2S instance. |
__STATIC_INLINE void nrf_i2s_tx_buffer_set | ( | NRF_I2S_Type * | p_i2s, |
uint32_t const * | p_buffer | ||
) |
Function for setting the pointer to the transmit buffer.
[in] | p_i2s | I2S instance. |
[in] | p_buffer | Pointer to the transmit buffer. |