mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/analogin_api.c
- Revision:
- 298:7557d401dbc3
- Parent:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/analogin_api.c Wed Aug 27 03:30:08 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/analogin_api.c Wed Aug 27 03:45:07 2014 +0100 @@ -170,7 +170,10 @@ } uint16_t analogin_read_u16(analogin_t *obj) { - return (adc_read(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) {