2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file pwm_generator.h
|
|
|
|
*
|
|
|
|
* @date May 28, 2013
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PWM_GENERATOR_H_
|
|
|
|
#define PWM_GENERATOR_H_
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
#include "pwm_generator_logic.h"
|
|
|
|
|
|
|
|
#define DEBUG_PWM FALSE
|
|
|
|
|
2017-04-21 09:06:32 -07:00
|
|
|
#include "efiGpio.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
void initPwmGenerator(void);
|
|
|
|
|
|
|
|
/**
|
2018-01-22 08:22:09 -08:00
|
|
|
* Start a one-channel software PWM driver.
|
|
|
|
*
|
|
|
|
* This method should be called after scheduling layer is started by initSignalExecutor()
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
void startSimplePwm(PwmConfig *state, const char *msg, OutputPin *output,
|
|
|
|
float dutyCycle, float frequency, pwm_gen_callback *stateChangeCallback);
|
|
|
|
|
|
|
|
/**
|
2018-01-22 08:22:09 -08:00
|
|
|
* initialize GPIO pin and start a one-channel software PWM driver.
|
|
|
|
*
|
|
|
|
* This method should be called after scheduling layer is started by initSignalExecutor()
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, OutputPin *output,
|
|
|
|
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* default implementation of pwm_gen_callback which simply toggles the pins
|
|
|
|
*/
|
|
|
|
void applyPinState(PwmConfig *state, int stateIndex);
|
|
|
|
|
|
|
|
#endif /* PWM_GENERATOR_H_ */
|