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;
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
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 void dacStartConversion(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Starts a DAC conversion.
size_t depth
Samples buffer size.
#define dac_lld_config_fields
Low level fields of the DAC configuration structure.
dacstate_t state
Driver state.
msg_t dacConvert(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Performs a DAC conversion.
void dacInit(void)
DAC Driver initialization.
uint32_t dacchannel_t
Type of a DAC channel index.
dacstate_t
Driver state machine possible states.
Driver configuration structure.
void dacObjectInit(DACDriver *dacp)
Initializes the standard part of a DACDriver structure.
void dacStartConversionI(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Starts a DAC conversion.
mutex_t mutex
Mutex protecting the bus.
DAC Conversion group structure.
dacerrorcallback_t error_cb
Error handling callback or NULL.
int32_t msg_t
Type of a message.
Structure representing a DAC driver.
void dacAcquireBus(DACDriver *dacp)
Gains exclusive access to the DAC bus.
void dacReleaseBus(DACDriver *dacp)
Releases exclusive access to the DAC bus.
const DACConversionGroup * grpp
Conversion group.
void(* dacerrorcallback_t)(DACDriver *dacp, dacerror_t err)
DAC error callback type.
void * thread_reference_t
Type of a thread reference.
uint32_t num_channels
Number of DAC channels.
void dacStop(DACDriver *dacp)
Deactivates the DAC peripheral.
daccallback_t end_cb
Operation complete callback or NULL.
const DACConfig * config
Current configuration data.
dacerror_t
Possible DAC failure causes.
dacsample_t * samples
Samples buffer pointer.
void dacPutChannelX(DACDriver *dacp, dacchannel_t channel, dacsample_t sample)
Outputs a value directly on a DAC channel.
void dacStopConversion(DACDriver *dacp)
Stops an ongoing conversion.
uint32_t mutex_t
Type of a mutex.
void dacStopConversionI(DACDriver *dacp)
Stops an ongoing conversion.
void(* daccallback_t)(DACDriver *dacp)
DAC notification callback type.
void dacStart(DACDriver *dacp, const DACConfig *config)
Configures and activates the DAC peripheral.
thread_reference_t thread
Waiting thread.
uint16_t dacsample_t
Type representing a DAC sample.
#define dac_lld_driver_fields
Low level fields of the DAC driver structure.
PLATFORM DAC subsystem low level driver header.