energia / msp432-core

MSP432 Core and Framework
14 stars 10 forks source link

MSP432: make analogReadResolution() compatible with Arduino #23

Closed robertinant closed 7 years ago

robertinant commented 7 years ago

From @rei-vilo on August 4, 2015 14:52

The MSP432 data sheet stipulated 14-bit ADC.

However, maximum value for analogRead() gives 1023, or 10-bit.

How to use the 14-bit resolution?

Copied from original issue: energia/Energia#692

robertinant commented 7 years ago

You can set it with analogReadResolution(). The implementation is however not entirely compatible with the Arduino API. The Arduino API allows it to be set to any int value. It is then mapped accordingly during an analogRead(). The msp432 implementation only allows for 8, 10, 12 and 14. Any other value will result in the resolution to be set to 14 bits. I'll look into what it takes to get this changed to behave the same as the Arduino API.

robertinant commented 7 years ago

From @rei-vilo on August 4, 2015 16:0

Ok, thanks!

It works, so I changed the question to MSP432: make analogReadResolution() compatible with Arduino.

robertinant commented 7 years ago

From @rei-vilo on September 7, 2015 21:25

See application for bb1c141c08 Added analogReadResolution() for MSP432

robertinant commented 7 years ago

Reviewing the analogReadResolution() API documentation, the implementation in EMT matches that of Arduino.