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.
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogin_api.c
- Revision:
- 298:7557d401dbc3
- Parent:
- 291:bdc8a81aee9a
- Child:
- 334:c5736b48acaf
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogin_api.c Wed Aug 27 03:30:08 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogin_api.c Wed Aug 27 03:45:07 2014 +0100 @@ -177,7 +177,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) {