Cleanup of half_bridge driver
Variables are now named same as registers to avoid confusion between duty cycle as a value between 0 and 1 or as the capture/compare register value.
This commit is contained in:
+24
-14
@@ -1,19 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Copyright (c) 2016 Martin Jäger / Libre Solar
|
||||
*/
|
||||
|
||||
#ifndef HALF_BRIDGE_H
|
||||
#define HALF_BRIDGE_H
|
||||
#ifndef HALF_BRIDGE_H_
|
||||
#define HALF_BRIDGE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
/** @file
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief PWM timer functions for half bridge of DC/DC converter
|
||||
*/
|
||||
|
||||
/** Initiatializes the registers to generate the PWM signal and sets duty
|
||||
* cycle limits
|
||||
/**
|
||||
* Initiatializes the registers to generate the PWM signal and sets duty
|
||||
* cycle limits
|
||||
*
|
||||
* @param freq_kHz Switching frequency in kHz
|
||||
* @param deadtime_ns Deadtime in ns between switching the two FETs on/off
|
||||
@@ -22,38 +26,44 @@
|
||||
*/
|
||||
void half_bridge_init(int freq_kHz, int deadtime_ns, float min_duty, float max_duty);
|
||||
|
||||
/** Start the PWM generation
|
||||
/**
|
||||
* Start the PWM generation
|
||||
*
|
||||
* @param pwm_duty Duty cycle between 0.0 and 1.0
|
||||
*/
|
||||
void half_bridge_start(float pwm_duty);
|
||||
|
||||
/** Stop the PWM generation
|
||||
/**
|
||||
* Stop the PWM generation
|
||||
*/
|
||||
void half_bridge_stop();
|
||||
|
||||
/** Get status of the PWM output
|
||||
/**
|
||||
* Get status of the PWM output
|
||||
*
|
||||
* @returns True if PWM output enabled
|
||||
*/
|
||||
bool half_bridge_enabled();
|
||||
|
||||
/** Set the duty cycle of the PWM signal
|
||||
/**
|
||||
* Set the duty cycle of the PWM signal
|
||||
*
|
||||
* @param duty Duty cycle between 0.0 and 1.0
|
||||
*/
|
||||
void half_bridge_set_duty_cycle(float duty);
|
||||
|
||||
/** Adjust the duty cycle with minimum step size
|
||||
/**
|
||||
* Adjust the duty cycle with minimum step size
|
||||
*
|
||||
* @param delta Number of steps (positive or negative)
|
||||
*/
|
||||
void half_bridge_duty_cycle_step(int delta);
|
||||
|
||||
/** Read the currently set duty cycle
|
||||
/**
|
||||
* Read the currently set duty cycle
|
||||
*
|
||||
* @returns Duty cycle between 0.0 and 1.0
|
||||
*/
|
||||
float half_bridge_get_duty_cycle();
|
||||
|
||||
#endif /* HALF_BRIDGE_H */
|
||||
#endif /* HALF_BRIDGE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user