Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
advanced_pwm.h
Go to the documentation of this file.
1
6#ifndef NEXUS_IO_ADVANCED_PWM_H
7#define NEXUS_IO_ADVANCED_PWM_H
8#include "nexus/core/status.h"
9#ifdef __cplusplus
10extern "C" {
11#endif
13typedef struct {
14 uint32_t period_ticks;
15 uint32_t duty_ticks;
16 uint32_t tick_hz;
18 uint32_t deadtime_hz;
19 bool running;
20 bool fault;
22
23typedef struct {
24 nx_result_t (*set_duty)(void* context, uint32_t duty_ticks);
25 nx_result_t (*start)(void* context);
26 nx_result_t (*stop)(void* context);
28 nx_result_t (*clear_fault)(void* context);
30
32typedef struct {
34 void* context;
36
46 uint32_t duty_ticks);
79#ifdef __cplusplus
80}
81#endif
82#endif
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_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_start(const nx_advanced_pwm_t *port)
Enable outputs only with inactive break and no latched 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.
Small vendor-independent result vocabulary.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
Shared immutable controls; configuration is a cold assembly fact.
nx_result_t(* set_duty)(void *context, uint32_t duty_ticks)
nx_result_t(* clear_fault)(void *context)
nx_result_t(* stop)(void *context)
nx_result_t(* state)(const void *context, nx_advanced_pwm_state_t *state)
nx_result_t(* start)(void *context)
Counts use the fixed post-prescaler clock; deadtime uses tDTS.
Immutable identity; controller state and configuration outlive IRQs.
const nx_advanced_pwm_ops_t * ops