Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
timer.h File Reference

Fixed timer/channel PWM with one shared base configuration. More...

Go to the source code of this file.

Data Structures

struct  nx_pwm_state_t
 PWM counts refer to the fixed declared post-prescaler timer clock. More...
struct  nx_pwm_ops_t
 Shared read-only methods using one provider state. More...
struct  nx_pwm_port
 Immutable interface pointing to caller-owned state. More...

Typedefs

typedef struct nx_pwm_port nx_pwm_port_t

Functions

nx_result_t nx_pwm_port_set (const nx_pwm_port_t *port, uint32_t period_ticks, uint32_t duty_ticks)
 Atomically stage a reviewed fixed-base PWM duty.
nx_result_t nx_pwm_port_start (const nx_pwm_port_t *port)
 Enable a previously configured fixed PWM output.
nx_result_t nx_pwm_port_stop (const nx_pwm_port_t *port)
 Stop PWM at its declared Board inactive electrical level.
nx_result_t nx_pwm_port_state (const nx_pwm_port_t *port, nx_pwm_state_t *state)
 Query staged PWM counts and selected timer clock.

Detailed Description

Fixed timer/channel PWM with one shared base configuration.

Author
Nexus Team

Definition in file timer.h.

Typedef Documentation

◆ nx_pwm_port_t

typedef struct nx_pwm_port nx_pwm_port_t

Definition at line 15 of file timer.h.

Function Documentation

◆ nx_pwm_port_set()

nx_result_t nx_pwm_port_set ( const nx_pwm_port_t * port,
uint32_t period_ticks,
uint32_t duty_ticks )

Atomically stage a reviewed fixed-base PWM duty.

Parameters
[in,out]portFixed timer/channel with one serialized writer.
[in]period_ticksPositive maintained shared-base period.
[in]duty_ticksZero through period_ticks, inclusive.
Returns
Success or INVALID/STATE/BUSY. Zero/100 percent are explicit constant levels. Shared channels must use one PSC/ARR/base; changing another channel's base is rejected by configuration.
Note
Shadow update becomes effective at next update event; do not infer immediate electrical change from successful staging.

◆ nx_pwm_port_start()

nx_result_t nx_pwm_port_start ( const nx_pwm_port_t * port)

Enable a previously configured fixed PWM output.

Parameters
[in,out]portExecution owner after Board inactive level setup.
Returns
Success or INVALID/STATE.

◆ nx_pwm_port_state()

nx_result_t nx_pwm_port_state ( const nx_pwm_port_t * port,
nx_pwm_state_t * state )

Query staged PWM counts and selected timer clock.

Parameters
[in]portFixed initialized channel.
[out]stateStaged counts, clock and running state.
Returns
Success or INVALID.

◆ nx_pwm_port_stop()

nx_result_t nx_pwm_port_stop ( const nx_pwm_port_t * port)

Stop PWM at its declared Board inactive electrical level.

Parameters
[in,out]portQuiesced execution owner; no concurrent set/start.
Returns
Success or INVALID; no advanced break/capture promise.