-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpwmModule.h
34 lines (24 loc) · 1.02 KB
/
pwmModule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ************************************************************
// pwmModule.h
// Helicopter project
// Group: A03 Group 10
// Created by P.J. Bones UCECE
// Last edited: 23-04-2018 by Thomas M
//
// Purpose: Generates multiple PWM outputs, with variable
// duty cycle, to control the main and tail rotor.
// ************************************************************
#ifndef PWM_MODULE_H_
#define PWM_MODULE_H_
// two PWM channels are defined
typedef enum pwm_channel {
MAIN_ROTOR, TAIL_ROTOR
} pwm_channel_t;
void pwmInit(void);
// take a duty cycle, as a percentage from 0 to 100, a precision multiplier (i.e. a multiplier of 100 means
// the supplied duty cycle is a factor of 100 larger than needs and should be divided down), and an enum
// with the name of the channel to change the pwm duty cycle of.
void pwmSetDuty(uint32_t dutyPercent, uint32_t precision, pwm_channel_t channel);
// enable or disable output from a given channel.
void pwmSetOutputState(bool state, pwm_channel_t channel);
#endif /*PWM_MODULE_H_*/