Fix styling and fix mbed_lib.json syntax error

pull/12471/head
George Beckstein 2020-02-19 14:00:49 -05:00
parent b76300f57c
commit 7b70843632
2 changed files with 9 additions and 6 deletions

View File

@ -44,6 +44,7 @@
}, },
"default-adc-vref": { "default-adc-vref": {
"help": "Default reference voltage for ADC (float)", "help": "Default reference voltage for ADC (float)",
"value": 3.3f "value": "3.3f"
}
} }
} }

View File

@ -54,16 +54,18 @@ unsigned short AnalogIn::read_u16()
return ret; return ret;
} }
float AnalogIn::read_volts() { float AnalogIn::read_volts()
float ret = this->read(); {
return (ret*this->vref); return (this->read() * this->vref);
} }
void AnalogIn::set_reference_voltage(float vref) { void AnalogIn::set_reference_voltage(float vref)
{
this->vref = vref; this->vref = vref;
} }
float AnalogIn::get_reference_voltage(void) { float AnalogIn::get_reference_voltage(void)
{
return this->vref; return this->vref;
} }