| BLDC control on ATAVRMC303 with ATxMega128A1

awex_driver.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
60 #ifndef __AWEX_DRIVER_H__
61 #define __AWEX_DRIVER_H__
62
63 #include "avr_compiler.h"
64
65 /* Definition of macros */
66
71 #define AWEX_EnableCommonWaveformChannelMode( _awex ) \
72 ( _awex.CTRL |= AWEX_CWCM_bm )
73
78 #define AWEX_DisableCommonWaveformChannelMode( _awex ) \
79 ( _awex->CTRL &= ~AWEX_CWCM_bm )
80
85 #define AWEX_EnablePatternGenerationMode( _awex ) \
86 ( _awex->CTRL |= AWEX_PGM_bm )
87
92 #define AWEX_DisablePatternGenerationMode( _awex ) \
93 ( _awex->CTRL &= ~AWEX_PGM_bm )
94
100 #define AWEX_SetOutputOverrideValue( _awex, _overrideValue ) \
101 ( _awex.OUTOVEN = _overrideValue )
102
109 #define AWEX_IsFaultDetected( _awex ) ( _awex->STATUS & AWEX_FDF_bm )
110
118 #define AWEX_ClearFaultFlag( _awex ) ( _awex->STATUS = AWEX_FDF_bm )
119
127 #define AWEX_IsDeadTimeBufferHighSideValid( _awex ) \
128 ( _awex->STATUS & AWEX_DTHSBUFV_bm )
129
137 #define AWEX_DeadTimeBufferLowSideValid( _awex ) \
138 ( _awex->STATUS & AWEX_DTLSBUFV_bm )
139
147 #define AWEX_SetDeadTimesSymmetricalUnbuffered( _awex, _deadTime ) \
148 ( _awex.DTBOTH = _deadTime )
149
158 #define AWEX_SetDeadTimeAsymmetricalUnbuffered( _awex, _deadTimeLow, _deadTimeHigh ) \
159 ( _awex->DTLS = _deadTimeLow; \
160 _awex->DTHS = _deadTimeHigh )
161
170 #define AWEX_SetDeadTimesSymmetricalBuffered( _awex, _deadTime ) \
171 ( _awex.DTBOTHBUF = _deadTime )
172
182 #define AWEX_SetDeadTimeAsymmetricalBuffered( _awex, _deadTimeLow, _deadTimeHigh ) \
183 ( _awex->DTLSBUF = _deadTimeLow; \
184 _awex->DTHSBUF = _deadTimeHigh )
185
186
187 /* Prototyping of functions. */
188
189 void AWEX_EnableDeadTimeInsertion( AWEX_t * awex,
190 uint8_t enableMask );
191 void AWEX_DisableDeadTimeInsertion( AWEX_t * awex,
192 uint8_t disableMask );
193 void AWEX_ConfigureFaultDetection( AWEX_t * awex,
194 AWEX_FDACT_t faultAction,
195 uint8_t eventMask );
196
197 #endif
avr_compiler.h
This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code ba...
AWEX_EnableDeadTimeInsertion
void AWEX_EnableDeadTimeInsertion(AWEX_t *awex, uint8_t enableMask)
Enable Dead Time Insertion.
Definition: awex_driver.c:73
AWEX_DisableDeadTimeInsertion
void AWEX_DisableDeadTimeInsertion(AWEX_t *awex, uint8_t disableMask)
Disable Dead Time Insertion.
Definition: awex_driver.c:98
AWEX_ConfigureFaultDetection
void AWEX_ConfigureFaultDetection(AWEX_t *awex, AWEX_FDACT_t faultAction, uint8_t eventMask)
This function configures the Fault Detection function for this AWEX.
Definition: awex_driver.c:117