Skip to content

Analog Write

Simplified API for converting digital values to analog voltages.

While a possible future version of the OS will have a more complex analog API, at the moment the analog APIs are only meant to provide a quick means for reading e.g. a battery voltage or providing a controllable voltage reference for an external analog circuitry. If your application needs to e.g. gather high frequency analog samples from a microphone a vendor-specific implementation for the analog peripheral has to be written in application code.

Sysprops

Sysprops for the ADC are driver dependent. Please refer to the documentation of the specific hardware driver you're using.

Functions Overview

Name
CW_DRIVER_FUNCdac_convert(int hDev, uint32_t val)

Function Details

function dac_convert

cpp
CW_DRIVER_FUNC dac_convert(
    int hDev,
    uint32_t val
)

Parameters:

  • hDev device handle as returned by open(const char*)
  • val set the value according to the HAL peripheral drivers translation function. for a 12bit DAC e.g passing 4095 will output the max voltage vRef.