Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Analogin hal functions

Analogin hal functions
[Hal]

# Defined behaviour * The function analogin_init initializes the analogin_t control structure * The function analogin_free returns the pin owned by the Analogin object to its reset state * The function analogin_read reads the input voltage, represented as a float in the range [0.0 (GND), 1.0 (VCC)] * The function analogin_read_u16 reads the value from analogin pin, represented as an unsigned 16bit value [0.0 (GND), MAX_UINT16 (VCC)] * The accuracy of the ADC is +/- 10% * The ADC operations analogin_read, analogin_read_u16 take less than 20us to complete More...

Modules

 Analogin hal tests
 

The Analogin HAL tests ensure driver conformance to defined behaviour.


Functions

void analogin_init_direct (analogin_t *obj, const PinMap *pinmap)
 Initialize the analogin peripheral.
void analogin_init (analogin_t *obj, PinName pin)
 Initialize the analogin peripheral.
void analogin_free (analogin_t *obj)
 Release the analogin peripheral.
float analogin_read (analogin_t *obj)
 Read the input voltage, represented as a float in the range [0.0, 1.0].
uint16_t analogin_read_u16 (analogin_t *obj)
 Read the value from analogin pin, represented as an unsigned 16bit value.
const PinMap * analogin_pinmap (void)
 Get the pins that support analogin.

Detailed Description

# Defined behaviour * The function analogin_init initializes the analogin_t control structure * The function analogin_free returns the pin owned by the Analogin object to its reset state * The function analogin_read reads the input voltage, represented as a float in the range [0.0 (GND), 1.0 (VCC)] * The function analogin_read_u16 reads the value from analogin pin, represented as an unsigned 16bit value [0.0 (GND), MAX_UINT16 (VCC)] * The accuracy of the ADC is +/- 10% * The ADC operations analogin_read, analogin_read_u16 take less than 20us to complete

# Undefined behaviour

* analogin_init is called with invalid pin (which does not support analog input function) * Calling analogin_read, analogin_read_u16 before analogin_init


Function Documentation

void analogin_free ( analogin_t obj )

Release the analogin peripheral.

Releases the pin used by analogin.

Parameters:
objThe analogin object to initialize

Definition at line 40 of file mbed_compat.c.

void analogin_init ( analogin_t obj,
PinName  pin 
)

Initialize the analogin peripheral.

Configures the pin used by analogin.

Parameters:
objThe analogin object to initialize
pinThe analogin pin name
void analogin_init_direct ( analogin_t obj,
const PinMap *  pinmap 
)

Initialize the analogin peripheral.

Configures the pin used by analogin.

Parameters:
objThe analogin object to initialize
pinmappointer to structure which holds static pinmap

Definition at line 43 of file static_pinmap.cpp.

const PinMap* analogin_pinmap ( void   )

Get the pins that support analogin.

Return a PinMap array of pins that support analogin. The array is terminated with {NC, NC, 0}.

Returns:
PinMap array
float analogin_read ( analogin_t obj )

Read the input voltage, represented as a float in the range [0.0, 1.0].

Parameters:
objThe analogin object
Returns:
A floating value representing the current input voltage
uint16_t analogin_read_u16 ( analogin_t obj )

Read the value from analogin pin, represented as an unsigned 16bit value.

Parameters:
objThe analogin object
Returns:
An unsigned 16bit value representing the current input voltage