nRF5 SDK v13.0.0
Modules | Macros | Typedefs | Enumerations | Functions
Peripheral drivers common module

Modules

 Peripheral drivers common module configuration
 

Macros

#define NRF_DRV_COMMON_EVREGS_OFFSET   0x100U
 Offset of event registers in every peripheral instance. More...
 
#define NRF_DRV_COMMON_POWER_CLOCK_ISR   (NRF_MODULE_ENABLED(CLOCK) && NRF_MODULE_ENABLED(POWER))
 The flag that is set when POWER_CLOCK ISR is implemented in common module. More...
 

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 bool nrf_drv_common_irq_enable_check (IRQn_Type IRQn)
 Check if interrupt is enabled. 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

Macro Definition Documentation

#define NRF_DRV_COMMON_EVREGS_OFFSET   0x100U

Offset of event registers in every peripheral instance.

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

#define NRF_DRV_COMMON_POWER_CLOCK_ISR   (NRF_MODULE_ENABLED(CLOCK) && NRF_MODULE_ENABLED(POWER))

The flag that is set when POWER_CLOCK ISR is implemented in common module.

This flag means that the function POWER_CLOCK_IRQHandler is implemented in nrf_drv_common.c file. In the clock and power modules functions nrf_drv_clock_onIRQ nrf_drv_power_onIRQ should be implemented and they would be called from common implementation.

None of the checking is done here. The implementation functions in clock and power are required to handle correctly the case when they are called without any event bit set.

Enumeration Type Documentation

Driver power state selection.

Enumerator
NRF_DRV_PWR_CTRL_ON 

Power on request.

NRF_DRV_PWR_CTRL_OFF 

Power off request.

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
bitBit 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]IRQnInterrupt 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]IRQnInterrupt id
[in]priorityInterrupt priority
__STATIC_INLINE bool nrf_drv_common_irq_enable_check ( IRQn_Type  IRQn)

Check if interrupt is enabled.

Function that checks if selected interrupt is enabled.

Parameters
[in]IRQnInterrupt id
Return values
trueSelected IRQ is enabled.
falseSelected IRQ is disabled.
__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
eventEvent 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]pinstPointer 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]ptrPointer to the object
Return values
trueObject is located in RAM
falseObject is not located in RAM

Documentation feedback | Developer Zone | Subscribe | Updated