Go to the documentation of this file.
28 #if (HAL_USE_DAC == TRUE) || defined(__DOXYGEN__)
46 #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
47 #define DAC_USE_WAIT TRUE
54 #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
55 #define DAC_USE_MUTUAL_EXCLUSION TRUE
131 dac_lld_conversion_group_fields;
139 dac_lld_config_fields;
166 #if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
172 #if (DAC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
178 #if defined(DAC_DRIVER_EXT_FIELDS)
179 DAC_DRIVER_EXT_FIELDS
182 dac_lld_driver_fields;
206 #define dacIsBufferComplete(dacp) ((bool)((dacp)->state == DAC_COMPLETE))
208 #if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
221 #define _dac_wait_s(dacp) osalThreadSuspendS(&(dacp)->thread)
230 #define _dac_reset_i(dacp) osalThreadResumeI(&(dacp)->thread, MSG_RESET)
239 #define _dac_reset_s(dacp) osalThreadResumeS(&(dacp)->thread, MSG_RESET)
248 #define _dac_wakeup_isr(dacp) { \
249 osalSysLockFromISR(); \
250 osalThreadResumeI(&(dacp)->thread, MSG_OK); \
251 osalSysUnlockFromISR(); \
261 #define _dac_timeout_isr(dacp) { \
262 osalSysLockFromISR(); \
263 osalThreadResumeI(&(dacp)->thread, MSG_TIMEOUT); \
264 osalSysUnlockFromISR(); \
268 #define _dac_wait_s(dacp)
269 #define _dac_reset_i(dacp)
270 #define _dac_reset_s(dacp)
271 #define _dac_wakeup_isr(dacp)
272 #define _dac_timeout_isr(dacp)
287 #define _dac_isr_half_code(dacp) { \
288 if ((dacp)->grpp->end_cb != NULL) { \
289 (dacp)->grpp->end_cb(dacp); \
306 #define _dac_isr_full_code(dacp) { \
307 if ((dacp)->grpp->end_cb) { \
308 (dacp)->state = DAC_COMPLETE; \
309 (dacp)->grpp->end_cb(dacp); \
310 if ((dacp)->state == DAC_COMPLETE) \
311 (dacp)->state = DAC_ACTIVE; \
330 #define _dac_isr_error_code(dacp, err) { \
331 dac_lld_stop_conversion(dacp); \
332 if ((dacp)->grpp->error_cb != NULL) { \
333 (dacp)->state = DAC_ERROR; \
334 (dacp)->grpp->error_cb(dacp, err); \
335 if ((dacp)->state == DAC_ERROR) \
336 (dacp)->state = DAC_READY; \
338 (dacp)->grpp = NULL; \
339 _dac_timeout_isr(dacp); \
367 #if DAC_USE_MUTUAL_EXCLUSION
msg_t dacConvert(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Performs a DAC conversion.
uint32_t dacchannel_t
Type of a DAC channel index.
void dacStartConversion(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Starts a DAC conversion.
dacstate_t
Driver state machine possible states.
void dacPutChannelX(DACDriver *dacp, dacchannel_t channel, dacsample_t sample)
Outputs a value directly on a DAC channel.
void dacObjectInit(DACDriver *dacp)
Initializes the standard part of a DACDriver structure.
void dacAcquireBus(DACDriver *dacp)
Gains exclusive access to the DAC bus.
PLATFORM DAC subsystem low level driver header.
Structure representing a thread.
const DACConversionGroup * grpp
Conversion group.
void(* dacerrorcallback_t)(DACDriver *dacp, dacerror_t err)
DAC error callback type.
mutex_t mutex
Mutex protecting the bus.
void dacReleaseBus(DACDriver *dacp)
Releases exclusive access to the DAC bus.
void dacStopConversion(DACDriver *dacp)
Stops an ongoing conversion.
uint32_t num_channels
Number of DAC channels.
dacerrorcallback_t error_cb
Error handling callback or NULL.
void dacInit(void)
DAC Driver initialization.
DAC Conversion group structure.
dacsample_t * samples
Samples buffer pointer.
void dacStop(DACDriver *dacp)
Deactivates the DAC peripheral.
void(* daccallback_t)(DACDriver *dacp)
DAC notification callback type.
thread_reference_t thread
Waiting thread.
dacerror_t
Possible DAC failure causes.
Driver configuration structure.
const DACConfig * config
Current configuration data.
Structure representing a DAC driver.
void dacStopConversionI(DACDriver *dacp)
Stops an ongoing conversion.
dacstate_t state
Driver state.
void dacStart(DACDriver *dacp, const DACConfig *config)
Configures and activates the DAC peripheral.
uint16_t dacsample_t
Type representing a DAC sample.
void dacStartConversionI(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Starts a DAC conversion.
size_t depth
Samples buffer size.
daccallback_t end_cb
Operation complete callback or NULL.