Digital-to-Analog Converter.
More...
|
enum | dac_result_t {
DAC_RESULT_OK
,
DAC_RESULT_INVALID
,
DAC_RESULT_UNSUPPORTED
,
DAC_RESULT_OVERFLOW
,
DAC_RESULT_BUSY
,
DAC_RESULT_ERR
,
TOTAL_DAC_RESULT
} |
|
enum | dac_resolution_t {
DAC_RESOLUTION_6_BITS
,
DAC_RESOLUTION_8_BITS
,
DAC_RESOLUTION_10_BITS
,
DAC_RESOLUTION_12_BITS
,
DAC_RESOLUTION_16_BITS
,
DAC_RESOLUTION_24_BITS
,
TOTAL_DAC_RESOLUTION
} |
|
Digital-to-Analog Converter.
◆ dac_resolution_t
#include <dac/public_inc/hal_dac.h>
Enumerator |
---|
DAC_RESOLUTION_6_BITS | |
DAC_RESOLUTION_8_BITS | |
DAC_RESOLUTION_10_BITS | |
DAC_RESOLUTION_12_BITS | |
DAC_RESOLUTION_16_BITS | |
DAC_RESOLUTION_24_BITS | |
TOTAL_DAC_RESOLUTION | |
◆ dac_result_t
#include <dac/public_inc/hal_dac.h>
Enumerator |
---|
DAC_RESULT_OK | No error.
|
DAC_RESULT_INVALID | Operation invalid.
|
DAC_RESULT_UNSUPPORTED | Operation not supported.
|
DAC_RESULT_OVERFLOW | Overflow occurred.
|
DAC_RESULT_BUSY | DAC busy.
|
DAC_RESULT_ERR | Error occurred.
|
TOTAL_DAC_RESULT | |
◆ hal_dac_calibrate()
#include <dac/public_inc/hal_dac.h>
Calibrate DAC reference voltage.
dac_result_t hal_dac_calibrate(const float vref)
Calibrate DAC reference voltage.
dac_result_t
Definition hal_dac.h:39
- Parameters
-
[in] | vref | Actual measured DAC reference voltage |
- Return values
-
DAC_RESULT_OK | Success calibrate DAC channel |
DAC_RESULT_INVALID | Reference voltage invalid |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed calibrate DAC channel |
◆ hal_dac_init()
#include <dac/public_inc/hal_dac.h>
Configure DAC channel.
.low_power_enable = false
};
dac_result_t hal_dac_init(const dac_channel_attr_t attr)
Configure DAC channel.
@ DAC_RESOLUTION_12_BITS
Definition hal_dac.h:55
gpio_pin_t pin
Definition hal_dac.h:64
- Parameters
-
[in] | attr | DAC channel configuration |
- Return values
-
DAC_RESULT_OK | Success configure DAC channel |
DAC_RESULT_INVALID | Configuration attributes invalid |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed configure DAC channel |
◆ hal_dac_mutex_give()
#include <dac/public_inc/hal_dac.h>
Release RTOS mutex for specified pin.
dac_result_t hal_dac_mutex_give(const gpio_pin_t pin)
Release RTOS mutex for specified pin.
- Parameters
-
[in] | pin | DAC pin's mutex to be released |
- Return values
-
DAC_RESULT_OK | Success release mutex |
DAC_RESULT_INVALID | Invalid pin |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed release mutex |
◆ hal_dac_mutex_take()
#include <dac/public_inc/hal_dac.h>
Try acquire RTOS mutex for specified pin.
dac_result_t hal_dac_mutex_take(const gpio_pin_t pin, const uint32_t timeout_ms)
Try acquire RTOS mutex for specified pin.
- Parameters
-
[in] | pin | DAC pin's mutex to be locked |
[in] | timeout_ms | Mutex acquiring timeout in milliseconds |
- Return values
-
DAC_RESULT_OK | Success acquire mutex |
DAC_RESULT_INVALID | Invalid pin |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed acquire mutex |
◆ hal_dac_write()
#include <dac/public_inc/hal_dac.h>
Write DAC value to pin.
dac_result_t hal_dac_write(const gpio_pin_t pin, const uint32_t value)
Write DAC value to pin.
- Parameters
-
[in] | pin | Pin number |
[in] | value | DAC value to be written |
- Return values
-
DAC_RESULT_OK | Success write value to DAC pin |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed write value to DAC pin |
◆ hal_dac_write_volt()
#include <dac/public_inc/hal_dac.h>
Write DAC value in voltage to pin.
dac_result_t hal_dac_write_volt(const gpio_pin_t pin, const float volt)
Write DAC value in voltage to pin.
- Parameters
-
[in] | pin | Pin number |
[in] | volt | Voltage to be set |
- Return values
-
DAC_RESULT_OK | Success write voltage to DAC pin |
DAC_RESULT_UNSUPPORTED | Operation not supported |
DAC_RESULT_ERR | Failed write voltage to DAC pin |