mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
402:09075a3b15e3
Parent:
334:c5736b48acaf
Child:
414:4ec4c5b614b0
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogin_api.c	Fri Nov 14 08:45:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogin_api.c	Fri Nov 14 09:00:07 2014 +0000
@@ -58,7 +58,8 @@
 
 int adc_inited = 0;
 
-void analogin_init(analogin_t *obj, PinName pin) {
+void analogin_init(analogin_t *obj, PinName pin)
+{
     // Get the peripheral name from the pin and assign it to the object
     obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
     MBED_ASSERT(obj->adc != (ADCName)NC);
@@ -96,15 +97,16 @@
         AdcHandle.Init.LowPowerFrequencyMode = DISABLE; // To be enabled only if ADC clock < 2.8 MHz
         AdcHandle.Init.LowPowerAutoOff       = DISABLE;
         HAL_ADC_Init(&AdcHandle);
-        
+
         // Calibration
         HAL_ADCEx_Calibration_Start(&AdcHandle, ADC_SINGLE_ENDED);
-        
+
         __HAL_ADC_ENABLE(&AdcHandle);
     }
 }
 
-static inline uint16_t adc_read(analogin_t *obj) {
+static inline uint16_t adc_read(analogin_t *obj)
+{
     ADC_ChannelConfTypeDef sConfig;
 
     AdcHandle.Instance = (ADC_TypeDef *)(obj->adc);
@@ -176,14 +178,16 @@
     }
 }
 
-uint16_t analogin_read_u16(analogin_t *obj) {
+uint16_t analogin_read_u16(analogin_t *obj)
+{
     uint16_t value = adc_read(obj);
     // 12-bit to 16-bit conversion
     value = ((value << 4) & (uint16_t)0xFFF0) | ((value >> 8) & (uint16_t)0x000F);
     return value;
 }
 
-float analogin_read(analogin_t *obj) {
+float analogin_read(analogin_t *obj)
+{
     uint16_t value = adc_read(obj);
     return (float)value * (1.0f / (float)0xFFF); // 12 bits range
 }