From 7b708436326e06305131a467a8f334024a83f619 Mon Sep 17 00:00:00 2001 From: George Beckstein Date: Wed, 19 Feb 2020 14:00:49 -0500 Subject: [PATCH] Fix styling and fix mbed_lib.json syntax error --- drivers/mbed_lib.json | 3 ++- drivers/source/AnalogIn.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/mbed_lib.json b/drivers/mbed_lib.json index 6df4df5f63..1e70e5e4c9 100644 --- a/drivers/mbed_lib.json +++ b/drivers/mbed_lib.json @@ -44,6 +44,7 @@ }, "default-adc-vref": { "help": "Default reference voltage for ADC (float)", - "value": 3.3f + "value": "3.3f" + } } } diff --git a/drivers/source/AnalogIn.cpp b/drivers/source/AnalogIn.cpp index df8fa65917..a26b01bdfd 100644 --- a/drivers/source/AnalogIn.cpp +++ b/drivers/source/AnalogIn.cpp @@ -54,16 +54,18 @@ unsigned short AnalogIn::read_u16() return ret; } -float AnalogIn::read_volts() { - float ret = this->read(); - return (ret*this->vref); +float AnalogIn::read_volts() +{ + return (this->read() * this->vref); } -void AnalogIn::set_reference_voltage(float vref) { +void AnalogIn::set_reference_voltage(float vref) +{ this->vref = vref; } -float AnalogIn::get_reference_voltage(void) { +float AnalogIn::get_reference_voltage(void) +{ return this->vref; }