nrfx 2.5
Data Structures | Macros | Typedefs | Enumerations | Functions
PWM HAL

Hardware access layer for managing the Pulse Width Modulation (PWM) peripheral. More...

Data Structures

struct  nrf_pwm_values_grouped_t
 Structure for defining duty cycle values for a sequence loaded in NRF_PWM_LOAD_GROUPED mode. More...
 
struct  nrf_pwm_values_individual_t
 Structure for defining duty cycle values for a sequence loaded in NRF_PWM_LOAD_INDIVIDUAL mode. More...
 
struct  nrf_pwm_values_wave_form_t
 Structure for defining duty cycle values for a sequence loaded in NRF_PWM_LOAD_WAVE_FORM mode. More...
 
union  nrf_pwm_values_t
 Union grouping pointers to arrays of duty cycle values applicable to various loading modes. More...
 
struct  nrf_pwm_sequence_t
 Structure for defining a sequence of PWM duty cycles. More...
 

Macros

#define NRF_PWM_PIN_NOT_CONNECTED   0xFFFFFFFF
 This value can be provided as a parameter for the nrf_pwm_pins_set function call to specify that a given output channel shall not be connected to a physical pin.
 
#define NRF_PWM_CHANNEL_COUNT   4
 Number of channels in each PWM instance.
 
#define NRF_PWM_VALUES_LENGTH(array)   (sizeof(array) / sizeof(uint16_t))
 Helper macro for calculating the number of 16-bit values in the specified array of duty cycle values.
 

Typedefs

typedef uint16_t nrf_pwm_values_common_t
 Type used for defining duty cycle values for a sequence loaded in NRF_PWM_LOAD_COMMON mode.
 

Enumerations

enum  nrf_pwm_task_t {
  NRF_PWM_TASK_STOP = offsetof(NRF_PWM_Type, TASKS_STOP),
  NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]),
  NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]),
  NRF_PWM_TASK_NEXTSTEP = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP)
}
 PWM tasks. More...
 
enum  nrf_pwm_event_t {
  NRF_PWM_EVENT_STOPPED = offsetof(NRF_PWM_Type, EVENTS_STOPPED),
  NRF_PWM_EVENT_SEQSTARTED0 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[0]),
  NRF_PWM_EVENT_SEQSTARTED1 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[1]),
  NRF_PWM_EVENT_SEQEND0 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]),
  NRF_PWM_EVENT_SEQEND1 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]),
  NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type, EVENTS_PWMPERIODEND),
  NRF_PWM_EVENT_LOOPSDONE = offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE)
}
 PWM events. More...
 
enum  nrf_pwm_int_mask_t {
  NRF_PWM_INT_STOPPED_MASK = PWM_INTENSET_STOPPED_Msk,
  NRF_PWM_INT_SEQSTARTED0_MASK = PWM_INTENSET_SEQSTARTED0_Msk,
  NRF_PWM_INT_SEQSTARTED1_MASK = PWM_INTENSET_SEQSTARTED1_Msk,
  NRF_PWM_INT_SEQEND0_MASK = PWM_INTENSET_SEQEND0_Msk,
  NRF_PWM_INT_SEQEND1_MASK = PWM_INTENSET_SEQEND1_Msk,
  NRF_PWM_INT_PWMPERIODEND_MASK = PWM_INTENSET_PWMPERIODEND_Msk,
  NRF_PWM_INT_LOOPSDONE_MASK = PWM_INTENSET_LOOPSDONE_Msk
}
 PWM interrupts. More...
 
enum  nrf_pwm_short_mask_t {
  NRF_PWM_SHORT_SEQEND0_STOP_MASK = PWM_SHORTS_SEQEND0_STOP_Msk,
  NRF_PWM_SHORT_SEQEND1_STOP_MASK = PWM_SHORTS_SEQEND1_STOP_Msk,
  NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk,
  NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk,
  NRF_PWM_SHORT_LOOPSDONE_STOP_MASK = PWM_SHORTS_LOOPSDONE_STOP_Msk
}
 PWM shortcuts. More...
 
enum  nrf_pwm_mode_t {
  NRF_PWM_MODE_UP = PWM_MODE_UPDOWN_Up,
  NRF_PWM_MODE_UP_AND_DOWN = PWM_MODE_UPDOWN_UpAndDown
}
 PWM modes of operation. More...
 
enum  nrf_pwm_clk_t {
  NRF_PWM_CLK_16MHz = PWM_PRESCALER_PRESCALER_DIV_1,
  NRF_PWM_CLK_8MHz = PWM_PRESCALER_PRESCALER_DIV_2,
  NRF_PWM_CLK_4MHz = PWM_PRESCALER_PRESCALER_DIV_4,
  NRF_PWM_CLK_2MHz = PWM_PRESCALER_PRESCALER_DIV_8,
  NRF_PWM_CLK_1MHz = PWM_PRESCALER_PRESCALER_DIV_16,
  NRF_PWM_CLK_500kHz = PWM_PRESCALER_PRESCALER_DIV_32,
  NRF_PWM_CLK_250kHz = PWM_PRESCALER_PRESCALER_DIV_64,
  NRF_PWM_CLK_125kHz = PWM_PRESCALER_PRESCALER_DIV_128
}
 PWM base clock frequencies. More...
 
enum  nrf_pwm_dec_load_t {
  NRF_PWM_LOAD_COMMON = PWM_DECODER_LOAD_Common,
  NRF_PWM_LOAD_GROUPED = PWM_DECODER_LOAD_Grouped,
  NRF_PWM_LOAD_INDIVIDUAL = PWM_DECODER_LOAD_Individual,
  NRF_PWM_LOAD_WAVE_FORM = PWM_DECODER_LOAD_WaveForm
}
 PWM decoder load modes. More...
 
enum  nrf_pwm_dec_step_t {
  NRF_PWM_STEP_AUTO = PWM_DECODER_MODE_RefreshCount,
  NRF_PWM_STEP_TRIGGERED = PWM_DECODER_MODE_NextStep
}
 PWM decoder next step modes. More...
 

Functions

NRF_STATIC_INLINE void nrf_pwm_task_trigger (NRF_PWM_Type *p_reg, nrf_pwm_task_t task)
 Function for activating the specified PWM task. More...
 
NRF_STATIC_INLINE uint32_t nrf_pwm_task_address_get (NRF_PWM_Type const *p_reg, nrf_pwm_task_t task)
 Function for getting the address of the specified PWM task register. More...
 
NRF_STATIC_INLINE void nrf_pwm_event_clear (NRF_PWM_Type *p_reg, nrf_pwm_event_t event)
 Function for clearing the specified PWM event. More...
 
NRF_STATIC_INLINE bool nrf_pwm_event_check (NRF_PWM_Type const *p_reg, nrf_pwm_event_t event)
 Function for retrieving the state of the PWM event. More...
 
NRF_STATIC_INLINE uint32_t nrf_pwm_event_address_get (NRF_PWM_Type const *p_reg, nrf_pwm_event_t event)
 Function for getting the address of the specified PWM event register. More...
 
NRF_STATIC_INLINE void nrf_pwm_shorts_enable (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for enabling the specified shortcuts. More...
 
NRF_STATIC_INLINE void nrf_pwm_shorts_disable (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for disabling the specified shortcuts. More...
 
NRF_STATIC_INLINE void nrf_pwm_shorts_set (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for setting the configuration of PWM shortcuts. More...
 
NRF_STATIC_INLINE void nrf_pwm_int_enable (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for enabling specified interrupts. More...
 
NRF_STATIC_INLINE void nrf_pwm_int_disable (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for disabling specified interrupts. More...
 
NRF_STATIC_INLINE void nrf_pwm_int_set (NRF_PWM_Type *p_reg, uint32_t mask)
 Function for setting the configuration of PWM interrupts. More...
 
NRF_STATIC_INLINE uint32_t nrf_pwm_int_enable_check (NRF_PWM_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled. More...
 
NRF_STATIC_INLINE void nrf_pwm_subscribe_set (NRF_PWM_Type *p_reg, nrf_pwm_task_t task, uint8_t channel)
 Function for setting the subscribe configuration for a given PWM task. More...
 
NRF_STATIC_INLINE void nrf_pwm_subscribe_clear (NRF_PWM_Type *p_reg, nrf_pwm_task_t task)
 Function for clearing the subscribe configuration for a given PWM task. More...
 
NRF_STATIC_INLINE void nrf_pwm_publish_set (NRF_PWM_Type *p_reg, nrf_pwm_event_t event, uint8_t channel)
 Function for setting the publish configuration for a given PWM event. More...
 
NRF_STATIC_INLINE void nrf_pwm_publish_clear (NRF_PWM_Type *p_reg, nrf_pwm_event_t event)
 Function for clearing the publish configuration for a given PWM event. More...
 
NRF_STATIC_INLINE void nrf_pwm_enable (NRF_PWM_Type *p_reg)
 Function for enabling the PWM peripheral. More...
 
NRF_STATIC_INLINE void nrf_pwm_disable (NRF_PWM_Type *p_reg)
 Function for disabling the PWM peripheral. More...
 
NRF_STATIC_INLINE void nrf_pwm_pins_set (NRF_PWM_Type *p_reg, uint32_t out_pins[4])
 Function for assigning pins to PWM output channels. More...
 
NRF_STATIC_INLINE uint32_t nrf_pwm_pin_get (NRF_PWM_Type const *p_reg, uint8_t channel)
 Function for getting pin selection associated with specified PWM output channel. More...
 
NRF_STATIC_INLINE void nrf_pwm_configure (NRF_PWM_Type *p_reg, nrf_pwm_clk_t base_clock, nrf_pwm_mode_t mode, uint16_t top_value)
 Function for configuring the PWM peripheral. More...
 
NRF_STATIC_INLINE void nrf_pwm_sequence_set (NRF_PWM_Type *p_reg, uint8_t seq_id, nrf_pwm_sequence_t const *p_seq)
 Function for defining a sequence of PWM duty cycles. More...
 
NRF_STATIC_INLINE void nrf_pwm_seq_ptr_set (NRF_PWM_Type *p_reg, uint8_t seq_id, uint16_t const *p_values)
 Function for modifying the pointer to the duty cycle values in the specified sequence. More...
 
NRF_STATIC_INLINE void nrf_pwm_seq_cnt_set (NRF_PWM_Type *p_reg, uint8_t seq_id, uint16_t length)
 Function for modifying the total number of duty cycle values in the specified sequence. More...
 
NRF_STATIC_INLINE void nrf_pwm_seq_refresh_set (NRF_PWM_Type *p_reg, uint8_t seq_id, uint32_t refresh)
 Function for modifying the additional number of PWM periods spent on each duty cycle value in the specified sequence. More...
 
NRF_STATIC_INLINE void nrf_pwm_seq_end_delay_set (NRF_PWM_Type *p_reg, uint8_t seq_id, uint32_t end_delay)
 Function for modifying the additional time added after the sequence is played. More...
 
NRF_STATIC_INLINE void nrf_pwm_decoder_set (NRF_PWM_Type *p_reg, nrf_pwm_dec_load_t dec_load, nrf_pwm_dec_step_t dec_step)
 Function for setting the mode of loading sequence data from RAM and advancing the sequence. More...
 
NRF_STATIC_INLINE void nrf_pwm_loop_set (NRF_PWM_Type *p_reg, uint16_t loop_count)
 Function for setting the number of times the sequence playback should be performed. More...
 

Detailed Description

Hardware access layer for managing the Pulse Width Modulation (PWM) peripheral.

Enumeration Type Documentation

◆ nrf_pwm_clk_t

PWM base clock frequencies.

Enumerator
NRF_PWM_CLK_16MHz 

16 MHz / 1 = 16 MHz.

NRF_PWM_CLK_8MHz 

16 MHz / 2 = 8 MHz.

NRF_PWM_CLK_4MHz 

16 MHz / 4 = 4 MHz.

NRF_PWM_CLK_2MHz 

16 MHz / 8 = 2 MHz.

NRF_PWM_CLK_1MHz 

16 MHz / 16 = 1 MHz.

NRF_PWM_CLK_500kHz 

16 MHz / 32 = 500 kHz.

NRF_PWM_CLK_250kHz 

16 MHz / 64 = 250 kHz.

NRF_PWM_CLK_125kHz 

16 MHz / 128 = 125 kHz.

◆ nrf_pwm_dec_load_t

PWM decoder load modes.

The selected mode determines how the sequence data is read from RAM and spread to the compare registers.

Enumerator
NRF_PWM_LOAD_COMMON 

1st half word (16-bit) used in all PWM channels (0-3).

NRF_PWM_LOAD_GROUPED 

1st half word (16-bit) used in channels 0 and 1; 2nd word in channels 2 and 3.

NRF_PWM_LOAD_INDIVIDUAL 

1st half word (16-bit) used in channel 0; 2nd in channel 1; 3rd in channel 2; 4th in channel 3.

NRF_PWM_LOAD_WAVE_FORM 

1st half word (16-bit) used in channel 0; 2nd in channel 1; ... ; 4th as the top value for the pulse generator counter.

◆ nrf_pwm_dec_step_t

PWM decoder next step modes.

The selected mode determines when the next value from the active sequence is loaded.

Enumerator
NRF_PWM_STEP_AUTO 

Automatically after the current value is played and repeated the requested number of times.

NRF_PWM_STEP_TRIGGERED 

When the NRF_PWM_TASK_NEXTSTEP task is triggered.

◆ nrf_pwm_event_t

PWM events.

Enumerator
NRF_PWM_EVENT_STOPPED 

Response to STOP task, emitted when PWM pulses are no longer generated.

NRF_PWM_EVENT_SEQSTARTED0 

First PWM period started on sequence 0.

NRF_PWM_EVENT_SEQSTARTED1 

First PWM period started on sequence 1.

NRF_PWM_EVENT_SEQEND0 

Emitted at the end of every sequence 0 when its last value has been read from RAM.

NRF_PWM_EVENT_SEQEND1 

Emitted at the end of every sequence 1 when its last value has been read from RAM.

NRF_PWM_EVENT_PWMPERIODEND 

Emitted at the end of each PWM period.

NRF_PWM_EVENT_LOOPSDONE 

Concatenated sequences have been played the specified number of times.

◆ nrf_pwm_int_mask_t

PWM interrupts.

Enumerator
NRF_PWM_INT_STOPPED_MASK 

Interrupt on STOPPED event.

NRF_PWM_INT_SEQSTARTED0_MASK 

Interrupt on SEQSTARTED[0] event.

NRF_PWM_INT_SEQSTARTED1_MASK 

Interrupt on SEQSTARTED[1] event.

NRF_PWM_INT_SEQEND0_MASK 

Interrupt on SEQEND[0] event.

NRF_PWM_INT_SEQEND1_MASK 

Interrupt on SEQEND[1] event.

NRF_PWM_INT_PWMPERIODEND_MASK 

Interrupt on PWMPERIODEND event.

NRF_PWM_INT_LOOPSDONE_MASK 

Interrupt on LOOPSDONE event.

◆ nrf_pwm_mode_t

PWM modes of operation.

Enumerator
NRF_PWM_MODE_UP 

Up counter (edge-aligned PWM duty cycle).

NRF_PWM_MODE_UP_AND_DOWN 

Up and down counter (center-aligned PWM duty cycle).

◆ nrf_pwm_short_mask_t

PWM shortcuts.

Enumerator
NRF_PWM_SHORT_SEQEND0_STOP_MASK 

Shortcut between SEQEND[0] event and STOP task.

NRF_PWM_SHORT_SEQEND1_STOP_MASK 

Shortcut between SEQEND[1] event and STOP task.

NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK 

Shortcut between LOOPSDONE event and SEQSTART[0] task.

NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK 

Shortcut between LOOPSDONE event and SEQSTART[1] task.

NRF_PWM_SHORT_LOOPSDONE_STOP_MASK 

Shortcut between LOOPSDONE event and STOP task.

◆ nrf_pwm_task_t

PWM tasks.

Enumerator
NRF_PWM_TASK_STOP 

Stops PWM pulse generation on all channels at the end of the current PWM period, and stops the sequence playback.

NRF_PWM_TASK_SEQSTART0 

Starts playback of sequence 0.

NRF_PWM_TASK_SEQSTART1 

Starts playback of sequence 1.

NRF_PWM_TASK_NEXTSTEP 

Steps by one value in the current sequence if the decoder is set to NRF_PWM_STEP_TRIGGERED mode.

Function Documentation

◆ nrf_pwm_configure()

NRF_STATIC_INLINE void nrf_pwm_configure ( NRF_PWM_Type *  p_reg,
nrf_pwm_clk_t  base_clock,
nrf_pwm_mode_t  mode,
uint16_t  top_value 
)

Function for configuring the PWM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]base_clockBase clock frequency.
[in]modeOperating mode of the pulse generator counter.
[in]top_valueValue up to which the pulse generator counter counts.

◆ nrf_pwm_decoder_set()

NRF_STATIC_INLINE void nrf_pwm_decoder_set ( NRF_PWM_Type *  p_reg,
nrf_pwm_dec_load_t  dec_load,
nrf_pwm_dec_step_t  dec_step 
)

Function for setting the mode of loading sequence data from RAM and advancing the sequence.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]dec_loadMode of loading sequence data from RAM.
[in]dec_stepMode of advancing the active sequence.

◆ nrf_pwm_disable()

NRF_STATIC_INLINE void nrf_pwm_disable ( NRF_PWM_Type *  p_reg)

Function for disabling the PWM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_pwm_enable()

NRF_STATIC_INLINE void nrf_pwm_enable ( NRF_PWM_Type *  p_reg)

Function for enabling the PWM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_pwm_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_pwm_event_address_get ( NRF_PWM_Type const *  p_reg,
nrf_pwm_event_t  event 
)

Function for getting the address of the specified PWM event register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventPWM event.
Returns
Address of the specified event register.

◆ nrf_pwm_event_check()

NRF_STATIC_INLINE bool nrf_pwm_event_check ( NRF_PWM_Type const *  p_reg,
nrf_pwm_event_t  event 
)

Function for retrieving the state of the PWM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_pwm_event_clear()

NRF_STATIC_INLINE void nrf_pwm_event_clear ( NRF_PWM_Type *  p_reg,
nrf_pwm_event_t  event 
)

Function for clearing the specified PWM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to clear.

◆ nrf_pwm_int_disable()

NRF_STATIC_INLINE void nrf_pwm_int_disable ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for disabling specified interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled.

◆ nrf_pwm_int_enable()

NRF_STATIC_INLINE void nrf_pwm_int_enable ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for enabling specified interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled.

◆ nrf_pwm_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_pwm_int_enable_check ( NRF_PWM_Type const *  p_reg,
uint32_t  mask 
)

Function for checking if the specified interrupts are enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked.
Returns
Mask of enabled interrupts.

◆ nrf_pwm_int_set()

NRF_STATIC_INLINE void nrf_pwm_int_set ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for setting the configuration of PWM interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be set.

◆ nrf_pwm_loop_set()

NRF_STATIC_INLINE void nrf_pwm_loop_set ( NRF_PWM_Type *  p_reg,
uint16_t  loop_count 
)

Function for setting the number of times the sequence playback should be performed.

This function applies to two-sequence playback (concatenated sequence 0 and 1). A single sequence can be played back only once.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]loop_countNumber of times to perform the sequence playback.

◆ nrf_pwm_pin_get()

NRF_STATIC_INLINE uint32_t nrf_pwm_pin_get ( NRF_PWM_Type const *  p_reg,
uint8_t  channel 
)

Function for getting pin selection associated with specified PWM output channel.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelPWM output channel.
Returns
Pin selection associated with specified PWM output channel.

◆ nrf_pwm_pins_set()

NRF_STATIC_INLINE void nrf_pwm_pins_set ( NRF_PWM_Type *  p_reg,
uint32_t  out_pins[4] 
)

Function for assigning pins to PWM output channels.

Usage of all PWM output channels is optional. If a given channel is not needed, pass the NRF_PWM_PIN_NOT_CONNECTED value instead of its pin number.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]out_pinsArray with pin numbers for individual PWM output channels.

◆ nrf_pwm_publish_clear()

NRF_STATIC_INLINE void nrf_pwm_publish_clear ( NRF_PWM_Type *  p_reg,
nrf_pwm_event_t  event 
)

Function for clearing the publish configuration for a given PWM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrf_pwm_publish_set()

NRF_STATIC_INLINE void nrf_pwm_publish_set ( NRF_PWM_Type *  p_reg,
nrf_pwm_event_t  event,
uint8_t  channel 
)

Function for setting the publish configuration for a given PWM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrf_pwm_seq_cnt_set()

NRF_STATIC_INLINE void nrf_pwm_seq_cnt_set ( NRF_PWM_Type *  p_reg,
uint8_t  seq_id,
uint16_t  length 
)

Function for modifying the total number of duty cycle values in the specified sequence.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]seq_idIdentifier of the sequence (0 or 1).
[in]lengthNumber of duty cycle values.

◆ nrf_pwm_seq_end_delay_set()

NRF_STATIC_INLINE void nrf_pwm_seq_end_delay_set ( NRF_PWM_Type *  p_reg,
uint8_t  seq_id,
uint32_t  end_delay 
)

Function for modifying the additional time added after the sequence is played.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]seq_idIdentifier of the sequence (0 or 1).
[in]end_delayNumber of PWM periods added at the end of the sequence.

◆ nrf_pwm_seq_ptr_set()

NRF_STATIC_INLINE void nrf_pwm_seq_ptr_set ( NRF_PWM_Type *  p_reg,
uint8_t  seq_id,
uint16_t const *  p_values 
)

Function for modifying the pointer to the duty cycle values in the specified sequence.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]seq_idIdentifier of the sequence (0 or 1).
[in]p_valuesPointer to an array with duty cycle values.

◆ nrf_pwm_seq_refresh_set()

NRF_STATIC_INLINE void nrf_pwm_seq_refresh_set ( NRF_PWM_Type *  p_reg,
uint8_t  seq_id,
uint32_t  refresh 
)

Function for modifying the additional number of PWM periods spent on each duty cycle value in the specified sequence.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]seq_idIdentifier of the sequence (0 or 1).
[in]refreshNumber of additional PWM periods for each duty cycle value.

◆ nrf_pwm_sequence_set()

NRF_STATIC_INLINE void nrf_pwm_sequence_set ( NRF_PWM_Type *  p_reg,
uint8_t  seq_id,
nrf_pwm_sequence_t const *  p_seq 
)

Function for defining a sequence of PWM duty cycles.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]seq_idIdentifier of the sequence (0 or 1).
[in]p_seqPointer to the sequence definition.

◆ nrf_pwm_shorts_disable()

NRF_STATIC_INLINE void nrf_pwm_shorts_disable ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for disabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of shortcuts to be disabled.

◆ nrf_pwm_shorts_enable()

NRF_STATIC_INLINE void nrf_pwm_shorts_enable ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for enabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of shortcuts to be enabled.

◆ nrf_pwm_shorts_set()

NRF_STATIC_INLINE void nrf_pwm_shorts_set ( NRF_PWM_Type *  p_reg,
uint32_t  mask 
)

Function for setting the configuration of PWM shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts configuration to be set.

◆ nrf_pwm_subscribe_clear()

NRF_STATIC_INLINE void nrf_pwm_subscribe_clear ( NRF_PWM_Type *  p_reg,
nrf_pwm_task_t  task 
)

Function for clearing the subscribe configuration for a given PWM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrf_pwm_subscribe_set()

NRF_STATIC_INLINE void nrf_pwm_subscribe_set ( NRF_PWM_Type *  p_reg,
nrf_pwm_task_t  task,
uint8_t  channel 
)

Function for setting the subscribe configuration for a given PWM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrf_pwm_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_pwm_task_address_get ( NRF_PWM_Type const *  p_reg,
nrf_pwm_task_t  task 
)

Function for getting the address of the specified PWM task register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskPWM task.
Returns
Address of the specified task register.

◆ nrf_pwm_task_trigger()

NRF_STATIC_INLINE void nrf_pwm_task_trigger ( NRF_PWM_Type *  p_reg,
nrf_pwm_task_t  task 
)

Function for activating the specified PWM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.

Documentation feedback | Developer Zone | Subscribe | Updated