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:
630:825f75ca301e
Parent:
469:fc4922e0c183
--- a/targets/hal/TARGET_STM/TARGET_STM32F0/analogout_api.c	Mon Sep 28 10:30:09 2015 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32F0/analogout_api.c	Mon Sep 28 10:45:10 2015 +0100
@@ -39,8 +39,7 @@
 
 static DAC_HandleTypeDef DacHandle;
 
-void analogout_init(dac_t *obj, PinName pin)
-{
+void analogout_init(dac_t *obj, PinName pin) {
     DAC_ChannelConfTypeDef sConfig;
 
     DacHandle.Instance = DAC;
@@ -71,8 +70,7 @@
     analogout_write_u16(obj, 0);
 }
 
-void analogout_free(dac_t *obj)
-{
+void analogout_free(dac_t *obj) {
     // Reset DAC and disable clock
     __DAC1_FORCE_RESET();
     __DAC1_RELEASE_RESET();
@@ -82,8 +80,7 @@
     pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
 }
 
-static inline void dac_write(dac_t *obj, uint16_t value)
-{
+static inline void dac_write(dac_t *obj, uint16_t value) {
     if (obj->pin == PA_4) {
         HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_1, DAC_ALIGN_12B_R, value);
         HAL_DAC_Start(&DacHandle, DAC_CHANNEL_1);
@@ -93,8 +90,7 @@
     }
 }
 
-static inline int dac_read(dac_t *obj)
-{
+static inline int dac_read(dac_t *obj) {
     if (obj->pin == PA_4) {
         return (int)HAL_DAC_GetValue(&DacHandle, DAC_CHANNEL_1);
     } else { // PA_5
@@ -102,8 +98,7 @@
     }
 }
 
-void analogout_write(dac_t *obj, float value)
-{
+void analogout_write(dac_t *obj, float value) {
     if (value < 0.0f) {
         dac_write(obj, 0); // Min value
     } else if (value > 1.0f) {
@@ -113,8 +108,7 @@
     }
 }
 
-void analogout_write_u16(dac_t *obj, uint16_t value)
-{
+void analogout_write_u16(dac_t *obj, uint16_t value) {
     if (value > (uint16_t)DAC_RANGE) {
         dac_write(obj, (uint16_t)DAC_RANGE); // Max value
     } else {
@@ -122,14 +116,12 @@
     }
 }
 
-float analogout_read(dac_t *obj)
-{
+float analogout_read(dac_t *obj) {
     uint32_t value = dac_read(obj);
     return (float)((float)value * (1.0f / (float)DAC_RANGE));
 }
 
-uint16_t analogout_read_u16(dac_t *obj)
-{
+uint16_t analogout_read_u16(dac_t *obj) {
     return (uint16_t)dac_read(obj);
 }