File syn_dac.c¶
FileList > drivers > syn_dac.c
Go to the source code of this file
DAC driver implementation.
#include "../util/syn_assert.h"#include "syn_dac.h"
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_dac_init (SYN_DAC * dac, uint8_t channel) Initialize a DAC channel. |
| uint16_t | syn_dac_max_raw (const SYN_DAC * dac) Return the maximum raw value for this DAC (2^resolution - 1). |
| SYN_Status | syn_dac_write_mv (const SYN_DAC * dac, uint16_t mv) Write a millivolt target to the DAC. |
| SYN_Status | syn_dac_write_percent (const SYN_DAC * dac, uint8_t percent) Write a percentage of full scale to the DAC. |
| SYN_Status | syn_dac_write_raw (const SYN_DAC * dac, uint16_t raw) Write a raw count value to the DAC. |
Public Functions Documentation¶
function syn_dac_init¶
Initialize a DAC channel.
Parameters:
dacHandle to initialize. Must not be NULL.channelPlatform DAC channel index.
Returns:
SYN_OK on success, SYN_ERROR on hardware failure.
function syn_dac_max_raw¶
Return the maximum raw value for this DAC (2^resolution - 1).
Parameters:
dacInitialized DAC handle (channel field used to query port).
Returns:
Maximum raw count (e.g. 4095 for 12-bit).
function syn_dac_write_mv¶
Write a millivolt target to the DAC.
Clamps to the reference voltage automatically.
Parameters:
dacInitialized DAC handle.mvDesired output voltage in millivolts.
Returns:
SYN_OK on success.
function syn_dac_write_percent¶
Write a percentage of full scale to the DAC.
Parameters:
dacInitialized DAC handle.percent0 = 0 V, 100 = full reference voltage. Values > 100 are clamped to 100.
Returns:
SYN_OK on success.
function syn_dac_write_raw¶
Write a raw count value to the DAC.
Parameters:
dacInitialized DAC handle.rawValue in range [0, syn_dac_max_raw(dac)].
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_dac.c