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 89 #if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__) 102 #define _dac_wait_s(dacp) osalThreadSuspendS(&(dacp)->thread) 111 #define _dac_reset_i(dacp) osalThreadResumeI(&(dacp)->thread, MSG_RESET) 120 #define _dac_reset_s(dacp) osalThreadResumeS(&(dacp)->thread, MSG_RESET) 129 #define _dac_wakeup_isr(dacp) { \ 130 osalSysLockFromISR(); \ 131 osalThreadResumeI(&(dacp)->thread, MSG_OK); \ 132 osalSysUnlockFromISR(); \ 142 #define _dac_timeout_isr(dacp) { \ 143 osalSysLockFromISR(); \ 144 osalThreadResumeI(&(dacp)->thread, MSG_TIMEOUT); \ 145 osalSysUnlockFromISR(); \ 149 #define _dac_wait_s(dacp) 150 #define _dac_reset_i(dacp) 151 #define _dac_reset_s(dacp) 152 #define _dac_wakeup_isr(dacp) 153 #define _dac_timeout_isr(dacp) 168 #define _dac_isr_half_code(dacp) { \ 169 if ((dacp)->grpp->end_cb != NULL) { \ 170 (dacp)->grpp->end_cb(dacp, (dacp)->samples, (dacp)->depth / 2); \ 188 #define _dac_isr_full_code(dacp) { \ 189 if ((dacp)->grpp->end_cb != NULL) { \ 190 if ((dacp)->depth > 1) { \ 192 size_t half = (dacp)->depth / 2; \ 193 size_t half_index = half * (dacp)->grpp->num_channels; \ 194 (dacp)->grpp->end_cb(dacp, (dacp)->samples + half_index, half); \ 198 (dacp)->grpp->end_cb(dacp, (dacp)->samples, (dacp)->depth); \ 218 #define _dac_isr_error_code(dacp, err) { \ 219 dac_lld_stop_conversion(dacp); \ 220 if ((dacp)->grpp->error_cb != NULL) { \ 221 (dacp)->state = DAC_ERROR; \ 222 (dacp)->grpp->error_cb(dacp, err); \ 223 if ((dacp)->state == DAC_ERROR) \ 224 (dacp)->state = DAC_READY; \ 226 (dacp)->grpp = NULL; \ 227 _dac_timeout_isr(dacp); \ 255 #if DAC_USE_MUTUAL_EXCLUSION void dacStartConversion(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Starts a DAC conversion.
msg_t dacConvert(DACDriver *dacp, const DACConversionGroup *grpp, dacsample_t *samples, size_t depth)
Performs a DAC conversion.
Driver configuration structure.
void dacInit(void)
DAC Driver initialization.
uint32_t dacchannel_t
Type of a DAC channel index.
dacstate_t
Driver state machine possible states.
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.
int32_t msg_t
Type of a message.
void dacAcquireBus(DACDriver *dacp)
Gains exclusive access to the DAC bus.
void dacReleaseBus(DACDriver *dacp)
Releases exclusive access to the DAC bus.
Structure representing a DAC driver.
DAC Conversion group structure.
void dacStop(DACDriver *dacp)
Deactivates the DAC peripheral.
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.
void dacStopConversionI(DACDriver *dacp)
Stops an ongoing conversion.
void dacStart(DACDriver *dacp, const DACConfig *config)
Configures and activates the DAC peripheral.
uint16_t dacsample_t
Type representing a DAC sample.
PLATFORM DAC subsystem low level driver header.