HAL  v0.6.1
Hardware Abstraction Layer
Loading...
Searching...
No Matches
hal_dac.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "hal_gpio.h"
Include dependency graph for hal_dac.h:

Data Structures

struct  dac_channel_attr_t
 

Enumerations

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
}
 

Functions

dac_result_t hal_dac_init (const dac_channel_attr_t attr)
 Configure DAC channel.
 
dac_result_t hal_dac_calibrate (const float vref)
 Calibrate DAC reference voltage.
 
dac_result_t hal_dac_write (const gpio_pin_t pin, const uint32_t value)
 Write DAC value to pin.
 
dac_result_t hal_dac_write_volt (const gpio_pin_t pin, const float volt)
 Write DAC value in voltage to 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.
 
dac_result_t hal_dac_mutex_give (const gpio_pin_t pin)
 Release RTOS mutex for specified pin.