Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
# 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:
-
obj The 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:
-
obj The analogin object to initialize pin The analogin pin name
void analogin_init_direct | ( | analogin_t * | obj, |
const PinMap * | pinmap | ||
) |
Initialize the analogin peripheral.
Configures the pin used by analogin.
- Parameters:
-
obj The analogin object to initialize pinmap pointer 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:
-
obj The 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:
-
obj The analogin object
- Returns:
- An unsigned 16bit value representing the current input voltage
Generated on Tue Jul 12 2022 13:55:24 by
