|
hal
Hardware Abstraction Layer
|
Control for a PWM signal generated by the micro. More...


Go to the source code of this file.
Functions | |
| hal_status_t | hal_pwm_init (uint32_t pwm_frequency_hz) |
| Initializes all the hardware (GPIO, TIMER, and CHANNEL) to deliver a PWM signal. More... | |
| void | hal_pwm_enable (bool enable) |
| enable or disable the pwm signal. If disabled, nothing will show up on pins. More... | |
| void | hal_pwm_set_duty_cycle (uint8_t percent) |
| Sets the duty cycle 0% - 100% for the PWM signal. More... | |
| void | hal_pwm_set_frequency (uint32_t pwm_frequency_hz) |
| Sets the PWM signal frequency to a new value after the driver has already been initialized. More... | |
Control for a PWM signal generated by the micro.
At this point a PWM signal of your chosen frequency and duty cycle is being output to pin.
Copyright (c) 2025 Cory McKiel. Licensed under the MIT License. See LICENSE file in the project root.
| void hal_pwm_enable | ( | bool | enable | ) |
enable or disable the pwm signal. If disabled, nothing will show up on pins.
| enable | true to enable the driver, false to disable. |
| hal_status_t hal_pwm_init | ( | uint32_t | pwm_frequency_hz | ) |
Initializes all the hardware (GPIO, TIMER, and CHANNEL) to deliver a PWM signal.
| pwm_frequency_hz | The frequency of the PWM signal you would like generated in Hz. eg for 20kHz -> 20,000. |
| void hal_pwm_set_duty_cycle | ( | uint8_t | percent | ) |
Sets the duty cycle 0% - 100% for the PWM signal.
| percent | Takes the values 0 through 100 as integers to express the desired DC. |
| void hal_pwm_set_frequency | ( | uint32_t | pwm_frequency_hz | ) |
Sets the PWM signal frequency to a new value after the driver has already been initialized.
| pwm_frequency_hz | The frequency of the PWM signal you would like generated in Hz. eg for 20kHz -> 20,000. |