| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Macros | Typedefs | Enumerations | Functions
Peripheral drivers common module
Peripheral drivers

Offset of event registers in every peripheral instance. More...

## Modules
| Peripheral drivers common module configuration

## Macros
#define | NRF_DRV_COMMON_EVREGS_OFFSET 0x100U

## Typedefs
typedef void(* | nrf_drv_irq_handler_t )(void)
| IRQ handler type.

## Enumerations
enum | nrf_drv_state_t { NRF_DRV_STATE_UNINITIALIZED, NRF_DRV_STATE_INITIALIZED, NRF_DRV_STATE_POWERED_ON }
| Driver state. More...
enum | nrf_drv_pwr_ctrl_t { NRF_DRV_PWR_CTRL_ON, NRF_DRV_PWR_CTRL_OFF }
| Driver power state selection. More...

## Functions
void | nrf_drv_common_irq_enable (IRQn_Type IRQn, uint8_t priority)
| Function sets priority and enables NVIC interrupt. More...
__STATIC_INLINE void | nrf_drv_common_irq_disable (IRQn_Type IRQn)
| Function disables NVIC interrupt. More...
__STATIC_INLINE uint32_t | nrf_drv_bitpos_to_event (uint32_t bit)
| Convert bit position to event code. More...
__STATIC_INLINE uint32_t | nrf_drv_event_to_bitpos (uint32_t event)
| Convert event code to bit position. More...
__STATIC_INLINE IRQn_Type | nrf_drv_get_IRQn (void const *const pinst)
| Get interrupt number connected with given instance. More...
__STATIC_INLINE bool | nrf_drv_is_in_RAM (void const *const ptr)
| Check if given object is in RAM. More...

## Detailed Description

Offset of event registers in every peripheral instance.

This is the offset where event registers start in every peripheral.

## Enumeration Type Documentation

enum nrf_drv_pwr_ctrl_t

Driver power state selection.

Enumerator
NRF_DRV_PWR_CTRL_ON | Power on request.
NRF_DRV_PWR_CTRL_OFF | Power off request.

enum nrf_drv_state_t

Driver state.

Enumerator
NRF_DRV_STATE_UNINITIALIZED | Uninitialized.
NRF_DRV_STATE_INITIALIZED | Initialized but powered off.

## Function Documentation

__STATIC_INLINE uint32_t nrf_drv_bitpos_to_event | ( | uint32_t | bit | ) |

Convert bit position to event code.

Function for converting the bit position in INTEN register to event code that is equivalent to the offset of the event register from the beginning of peripheral instance.

For example the result of this function can be casted directly to the types like nrf_twis_event_t or nrf_rng_event_t

Parameters

  bit | Bit position in INTEN register

Returns
  Event code to be casted to the right enum type or to be used in functions like nrf_rng_event_get

See Also
  nrf_drv_event_to_bitpos

__STATIC_INLINE void nrf_drv_common_irq_disable | ( | IRQn_Type | IRQn | ) |

Function disables NVIC interrupt.

Parameters

  [in] | IRQn | Interrupt id

void nrf_drv_common_irq_enable | ( | IRQn_Type | IRQn,
|  | uint8_t | priority
| ) |  |

Function sets priority and enables NVIC interrupt.

Note
  Function checks if correct priority is used when softdevice is present

Parameters

  [in] | IRQn | Interrupt id
  [in] | priority | Interrupt priority

__STATIC_INLINE uint32_t nrf_drv_event_to_bitpos | ( | uint32_t | event | ) |

Convert event code to bit position.

This function can be used to get bit position in INTEN register from event code.

Parameters

  event | Event code that may be casted from enum values from types like nrf_twis_event_t or nrf_rng_event_t

Returns
  Bit position in INTEN register that corresponds to the given code.

See Also
  nrf_drv_bitpos_to_event

__STATIC_INLINE IRQn_Type nrf_drv_get_IRQn | ( | void const *const | pinst | ) |

Get interrupt number connected with given instance.

Function returns interrupt number for a given instance of any peripheral.

Parameters

  [in] | pinst | Pointer to peripheral registry

Returns
  Interrupt number

__STATIC_INLINE bool nrf_drv_is_in_RAM | ( | void const *const | ptr | ) |

Check if given object is in RAM.

Function for analyzing if given location is placed in RAM. This function is used to determine if we have address that can be supported by EasyDMA.

Parameters

  [in] | ptr | Pointer to the object

Return values

  true | Object is located in RAM
  false | Object is not located in RAM