CCAux  2.20.0.0
CCAux API reference
PWMOut.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 2023 CrossControl AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; with
8  * version 2.1 of the License.
9  */
10 /*
11  * File description:
12  * PWM Output
13  *
14  * Use the function GetPWMOut() to get a handle to pass on to the other functions.
15  * Use the method PWMOut_release(PWMOUTHANDLE) to release the handle.
16  *
17  * Note: The rise and fall times of the hardware limits the signal's usefulness in high frequencies.
18  * The duty cycle of the PWM signal affects the maximum attainable frequency: at 50% duty cycle, the attainable
19  * frequecy is at it's maximum. If the duty cycle is near 0 or 100%, the rise/fall times of the signal means that the
20  * maximum attainable frequency is significantly lower. A PWM signal is generated when both the frequency and the duty
21  * cycle of a channel is not zero.
22  *
23  * Example Usage:
24  * @include pwmout_example.cpp
25  *
26  ************************************************/
27 #ifndef CC_PWMOUT_H
28 #define CC_PWMOUT_H
29 
30 #include "CCAuxErrors.h"
31 #include "CCPlatform.h"
32 
33 #ifdef __cplusplus
34 namespace CrossControl
35 {
36 #endif
37 
38 typedef void *PWMOUTHANDLE;
39 
59 EXTERN_C
60 CCAUXDLL_API
62 CCAUXDLL_CALLING_CONV
63 GetPWMOut(void);
64 
75 EXTERN_C
76 CCAUXDLL_API
77 void CCAUXDLL_CALLING_CONV PWMOut_release(PWMOUTHANDLE);
78 
92 EXTERN_C
93 CCAUXDLL_API
94 eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputChannelDutyCycle(PWMOUTHANDLE, uint8_t channel, uint16_t duty_cycle);
95 
109 EXTERN_C
110 CCAUXDLL_API
111 eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputChannelFrequency(PWMOUTHANDLE, uint8_t channel, float32_t frequency);
112 
126 EXTERN_C
127 CCAUXDLL_API
128 eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputChannelDutyCycle(PWMOUTHANDLE, uint8_t channel, uint16_t *duty_cycle);
129 
143 EXTERN_C
144 CCAUXDLL_API
145 eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputChannelFrequency(PWMOUTHANDLE, uint8_t channel, float32_t *frequency);
146 
162 EXTERN_C
163 CCAUXDLL_API
164 eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputStatus(PWMOUTHANDLE, uint16_t *status);
186 EXTERN_C
187 CCAUXDLL_API
188 eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputStatus2(PWMOUTHANDLE, uint8_t channel, uint16_t *status);
189 
203 EXTERN_C
204 CCAUXDLL_API
205 eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutOff(PWMOUTHANDLE, uint8_t channel);
206 
219 EXTERN_C
220 CCAUXDLL_API
221 eErr CCAUXDLL_CALLING_CONV PWMOut_getActiveIomcu(PWMOUTHANDLE, uint8_t *ioindex);
222 
235 EXTERN_C
236 CCAUXDLL_API
237 eErr CCAUXDLL_CALLING_CONV PWMOut_setActiveIomcu(PWMOUTHANDLE, uint8_t ioindex);
238 
254 EXTERN_C
255 CCAUXDLL_API
256 eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputPU(PWMOUTHANDLE, uint8_t channel, uint16_t *status);
257 
273 EXTERN_C
274 CCAUXDLL_API
275 eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputPU(PWMOUTHANDLE, uint8_t channel, uint16_t status);
277 #ifdef __cplusplus
278 } /* namespace CrossControl */
279 #endif
280 
281 #endif /* CC_PWMOUT_H */
unsigned short uint16_t
Definition: CCAuxTypes.h:38
float float32_t
Definition: CCAuxTypes.h:15
unsigned char uint8_t
Definition: CCAuxTypes.h:37
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputChannelFrequency(PWMOUTHANDLE, uint8_t channel, float32_t frequency)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputChannelDutyCycle(PWMOUTHANDLE, uint8_t channel, uint16_t duty_cycle)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputStatus2(PWMOUTHANDLE, uint8_t channel, uint16_t *status)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputChannelFrequency(PWMOUTHANDLE, uint8_t channel, float32_t *frequency)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputChannelDutyCycle(PWMOUTHANDLE, uint8_t channel, uint16_t *duty_cycle)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputPU(PWMOUTHANDLE, uint8_t channel, uint16_t *status)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getActiveIomcu(PWMOUTHANDLE, uint8_t *ioindex)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_getPWMOutputStatus(PWMOUTHANDLE, uint16_t *status)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutputPU(PWMOUTHANDLE, uint8_t channel, uint16_t status)
EXTERN_C CCAUXDLL_API PWMOUTHANDLE CCAUXDLL_CALLING_CONV GetPWMOut(void)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV PWMOut_release(PWMOUTHANDLE)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_setPWMOutOff(PWMOUTHANDLE, uint8_t channel)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PWMOut_setActiveIomcu(PWMOUTHANDLE, uint8_t ioindex)
Definition: About.h:30
void * PWMOUTHANDLE
Definition: PWMOut.h:38
eErr
Definition: CCAuxTypes.h:162