SDK4.0
This document shows Ameba SDK 4.0 APIs
ANALOG_OUT

analog_out functions More...

Ameba1 Only

typedef struct dac_s dac_t
 
void analogout_init (dac_t *obj, PinName pin)
 Initialize DAC. More...
 
void analogout_free (dac_t *obj)
 Free DAC. More...
 
void analogout_write (dac_t *obj, float value)
 Execute analog output obj: dac object define in application software. value: analog ratio value, should be transfered to register value. More...
 
void analogout_write_u16 (dac_t *obj, uint16_t value)
 Execute analog output 16bit obj: dac object define in application software. value: analog ratio value, should be transfered to register value. More...
 

Detailed Description

analog_out functions

Function Documentation

void analogout_free ( dac_t *  obj)

Free DAC.

Parameters
objdac object define in application software.
Return values
none
void analogout_init ( dac_t *  obj,
PinName  pin 
)

Initialize DAC.

Parameters
objdac object define in application software.
pindac PinName according to pinmux spec.
Return values
none
void analogout_write ( dac_t *  obj,
float  value 
)

Execute analog output obj: dac object define in application software. value: analog ratio value, should be transfered to register value.

Return values
none
Note
This function is mainly to execute analog output and the value is a ratio. The upper/lower bound of DAC register input value is defined by DAC_XXXXX_FULL_SCALE. The parameter "value" of this function should be transfered to register value.
void analogout_write_u16 ( dac_t *  obj,
uint16_t  value 
)

Execute analog output 16bit obj: dac object define in application software. value: analog ratio value, should be transfered to register value.

Return values
none
Note
The register value of DAC input is a format of 2's complement. The most maximum value of positive value drives DAC to output a voltage about 3.3V. The most mimimum value of negative value drives DAC to output a voltage about 0. And the middle value of 0x000 will drive DAC to output a voltage of half of max voltage.