| 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
Macros | Enumerations | Functions
RNG HAL
RNG HAL and driver

Hardware access layer for managing the random number generator (RNG). More...

## Macros
#define | NRF_RNG_TASK_SET (1UL)
#define | NRF_RNG_EVENT_CLEAR (0UL)

## Enumerations
enum | nrf_rng_task_t { NRF_RNG_TASK_START = offsetof(NRF_RNG_Type, TASKS_START), NRF_RNG_TASK_STOP = offsetof(NRF_RNG_Type, TASKS_STOP) }
| RNG tasks. More...
enum | nrf_rng_event_t { NRF_RNG_EVENT_VALRDY = offsetof(NRF_RNG_Type, EVENTS_VALRDY) }
| RNG events. More...
enum | nrf_rng_int_mask_t { NRF_RNG_INT_VALRDY_MASK = RNG_INTENSET_VALRDY_Msk }
| RNG interrupts. More...
enum | nrf_rng_short_mask_t { NRF_RNG_SHORT_VALRDY_STOP_MASK = RNG_SHORTS_VALRDY_STOP_Msk }
| Types of RNG shortcuts. More...

## Functions
__STATIC_INLINE void | nrf_rng_int_enable (uint32_t rng_int_mask)
| Function for enabling interrupts. More...
__STATIC_INLINE void | nrf_rng_int_disable (uint32_t rng_int_mask)
| Function for disabling interrupts. More...
__STATIC_INLINE bool | nrf_rng_int_get (nrf_rng_int_mask_t rng_int_mask)
| Function for getting the state of a specific interrupt. More...
__STATIC_INLINE uint32_t * | nrf_rng_task_address_get (nrf_rng_task_t rng_task)
| Function for getting the address of a specific task. More...
__STATIC_INLINE void | nrf_rng_task_trigger (nrf_rng_task_t rng_task)
| Function for setting a specific task. More...
__STATIC_INLINE uint32_t * | nrf_rng_event_address_get (nrf_rng_event_t rng_event)
| Function for getting address of a specific event. More...
__STATIC_INLINE void | nrf_rng_event_clear (nrf_rng_event_t rng_event)
| Function for clearing a specific event. More...
__STATIC_INLINE bool | nrf_rng_event_get (nrf_rng_event_t rng_event)
| Function for getting the state of a specific event. More...
__STATIC_INLINE void | nrf_rng_shorts_enable (uint32_t rng_short_mask)
| Function for setting shortcuts. More...
__STATIC_INLINE void | nrf_rng_shorts_disable (uint32_t rng_short_mask)
| Function for clearing shortcuts. More...
__STATIC_INLINE uint8_t | nrf_rng_random_value_get (void)
| Function for getting the previously generated random value. More...
__STATIC_INLINE void | nrf_rng_error_correction_enable (void)
| Function for enabling digital error correction.
__STATIC_INLINE void | nrf_rng_error_correction_disable (void)
| Function for disabling digital error correction.

## Detailed Description

Hardware access layer for managing the random number generator (RNG).

## Enumeration Type Documentation

enum nrf_rng_event_t

RNG events.

Enumerator
NRF_RNG_EVENT_VALRDY | New random number generated event.

enum nrf_rng_int_mask_t

RNG interrupts.

Enumerator
NRF_RNG_INT_VALRDY_MASK | Mask for enabling or disabling an interrupt on VALRDY event.

enum nrf_rng_short_mask_t

Types of RNG shortcuts.

Enumerator
NRF_RNG_SHORT_VALRDY_STOP_MASK | Mask for setting shortcut between EVENT_VALRDY and TASK_STOP.

enum nrf_rng_task_t

RNG tasks.

Enumerator
NRF_RNG_TASK_START | Start the random number generator.
NRF_RNG_TASK_STOP | Stop the random number generator.

## Function Documentation

__STATIC_INLINE uint32_t* nrf_rng_event_address_get | ( | nrf_rng_event_t | rng_event | ) |

Function for getting address of a specific event.

This function can be used by the PPI module.

Parameters

  [in] | rng_event | Event.

__STATIC_INLINE void nrf_rng_event_clear | ( | nrf_rng_event_t | rng_event | ) |

Function for clearing a specific event.

Parameters

  [in] | rng_event | Event.

__STATIC_INLINE bool nrf_rng_event_get | ( | nrf_rng_event_t | rng_event | ) |

Function for getting the state of a specific event.

Parameters

  [in] | rng_event | Event.

Return values

  true | If the event is not set.
  false | If the event is set.

__STATIC_INLINE void nrf_rng_int_disable | ( | uint32_t | rng_int_mask | ) |

Function for disabling interrupts.

Parameters

  [in] | rng_int_mask | Mask of interrupts.

__STATIC_INLINE void nrf_rng_int_enable | ( | uint32_t | rng_int_mask | ) |

Function for enabling interrupts.

Parameters

  [in] | rng_int_mask | Mask of interrupts.

__STATIC_INLINE bool nrf_rng_int_get | ( | nrf_rng_int_mask_t | rng_int_mask | ) |

Function for getting the state of a specific interrupt.

Parameters

  [in] | rng_int_mask | Interrupt.

Return values

  true | If the interrupt is not enabled.
  false | If the interrupt is enabled.

__STATIC_INLINE uint8_t nrf_rng_random_value_get | ( | void |  | ) |

Function for getting the previously generated random value.

Returns
  Previously generated random value.

__STATIC_INLINE void nrf_rng_shorts_disable | ( | uint32_t | rng_short_mask | ) |

Function for clearing shortcuts.

Parameters

  [in] | rng_short_mask | Mask of shortcuts.

__STATIC_INLINE void nrf_rng_shorts_enable | ( | uint32_t | rng_short_mask | ) |

Function for setting shortcuts.

Parameters

  [in] | rng_short_mask | Mask of shortcuts.

__STATIC_INLINE uint32_t* nrf_rng_task_address_get | ( | nrf_rng_task_t | rng_task | ) |

Function for getting the address of a specific task.

This function can be used by the PPI module.

Parameters

  [in] | rng_task | Task.

__STATIC_INLINE void nrf_rng_task_trigger | ( | nrf_rng_task_t | rng_task | ) |

Function for setting a specific task.

Parameters

  [in] | rng_task | Task.