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

Optional fixed complementary PWM with latched break. More...

Go to the source code of this file.

Data Structures

struct  nx_advanced_pwm_state_t
 Counts use the fixed post-prescaler clock; deadtime uses tDTS. More...
struct  nx_advanced_pwm_ops_t
 Shared immutable controls; configuration is a cold assembly fact. More...
struct  nx_advanced_pwm_t
 Immutable identity; controller state and configuration outlive IRQs. More...

Functions

nx_result_t nx_advanced_pwm_set_duty (const nx_advanced_pwm_t *port, uint32_t duty_ticks)
 Stage duty against the fixed declared PSC/ARR and complementary pair.
nx_result_t nx_advanced_pwm_start (const nx_advanced_pwm_t *port)
 Enable outputs only with inactive break and no latched fault.
nx_result_t nx_advanced_pwm_stop (const nx_advanced_pwm_t *port)
 Disable/read back master output and both channel sources.
nx_result_t nx_advanced_pwm_state (const nx_advanced_pwm_t *port, nx_advanced_pwm_state_t *state)
 Query staged duty, actual enable state and latched break facts.
nx_result_t nx_advanced_pwm_clear_fault (const nx_advanced_pwm_t *port)
 Clear a software fault only while disabled and BKIN is inactive.

Detailed Description

Optional fixed complementary PWM with latched break.

Author
Nexus Team

Definition in file advanced_pwm.h.

Function Documentation

◆ nx_advanced_pwm_clear_fault()

nx_result_t nx_advanced_pwm_clear_fault ( const nx_advanced_pwm_t * port)

Clear a software fault only while disabled and BKIN is inactive.

Parameters
[in]portPrivileged task recovery owner.
Returns
SUCCESS or BUSY/STATE/IO/CONTEXT; does not enable outputs.
Note
Physical input and pending hardware break are rechecked. Application recovery policy and external power safety remain outside Nexus.

◆ nx_advanced_pwm_set_duty()

nx_result_t nx_advanced_pwm_set_duty ( const nx_advanced_pwm_t * port,
uint32_t duty_ticks )

Stage duty against the fixed declared PSC/ARR and complementary pair.

Parameters
[in]portOne serialized privileged task owner.
[in]duty_ticksZero through the maintained period, inclusive.
Returns
SUCCESS or INVALID/STATE/CONTEXT; no base-clock reconfiguration.
Note
Shadow duty becomes effective at the next update. Hardware deadtime encoding must exactly represent the cold-configured tDTS count; PSC does not scale deadtime. This API does not certify pin timing.

◆ nx_advanced_pwm_start()

nx_result_t nx_advanced_pwm_start ( const nx_advanced_pwm_t * port)

Enable outputs only with inactive break and no latched fault.

Parameters
[in]portPrivileged task owner of reviewed pin/clock/vector leases.
Returns
SUCCESS or BUSY/STATE/IO/CONTEXT; failure retains ownership.
Note
Automatic output reenabling and irreversible hardware LOCK are prohibited. A break never silently starts outputs again.

◆ nx_advanced_pwm_state()

nx_result_t nx_advanced_pwm_state ( const nx_advanced_pwm_t * port,
nx_advanced_pwm_state_t * state )

Query staged duty, actual enable state and latched break facts.

Parameters
[in]portPrivileged task owner.
[out]stateSeparate writable snapshot, never provider storage.
Returns
SUCCESS or INVALID/STATE/CONTEXT.

◆ nx_advanced_pwm_stop()

nx_result_t nx_advanced_pwm_stop ( const nx_advanced_pwm_t * port)

Disable/read back master output and both channel sources.

Parameters
[in]portPrivileged task owner, no concurrent duty/lifecycle calls.
Returns
SUCCESS proves output source detachment; BUSY retains responsibility.
Note
Cold assembly keeps the reviewed inactive-pin and shared-vector leases until success and IRQ quiescence. A latched break survives stop.