Fix incorrect integer division in analogout_read

Replace with multiplication by the floating point reciprocal, to
 produce a floating point result while being more efficient than
 floating point division.
Addresses the issue raised by kjbracey-arm in
https://github.com/ARMmbed/mbed-os/pull/11324#pullrequestreview-282433989
pull/11516/head
Kyle Kearney 2019-09-16 11:04:45 -07:00
parent 83fca603f0
commit 1713e79ccf
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ void analogout_write_u16(dac_t *obj, uint16_t value)
float analogout_read(dac_t *obj)
{
return analogout_read_u16(obj) / UINT16_MAX;
return analogout_read_u16(obj) * (1.0f / UINT16_MAX);
}
uint16_t analogout_read_u16(dac_t *obj)