[ion] Remove a warning about an unused variable (m_index in ADC)

Change-Id: I678147f682a3f132991a9fa2ca8586c458ceb6de
This commit is contained in:
Romain Goyet
2016-09-15 20:47:22 +02:00
parent c2781748fd
commit b5ec82b488
2 changed files with 7 additions and 8 deletions

View File

@@ -10,10 +10,10 @@ bool isCharging() {
}
float voltage() {
ADC1.CR2()->setSWSTART(true);
while (ADC1.SR()->getEOC() != true) {
ADC.CR2()->setSWSTART(true);
while (ADC.SR()->getEOC() != true) {
}
uint16_t value = ADC1.DR()->get();
uint16_t value = ADC.DR()->get();
// The ADC is 12 bits by default
return Device::ADCDividerBridgeRatio*(Device::ADCReferenceVoltage * value)/0xFFF;
@@ -41,12 +41,12 @@ void initGPIO() {
ChargingGPIO.PUPDR()->setPull(ChargingPin, GPIO::PUPDR::Pull::Up);
/* The BAT_SNS pin is connected to Vbat through a divider bridge. It therefore
* has a voltage of Vbat/2. We'll measure this using ADC1 channel 0. */
* has a voltage of Vbat/2. We'll measure this using ADC channel 0. */
ADCGPIO.MODER()->setMode(ADCPin, GPIO::MODER::Mode::Analog);
}
void initADC() {
ADC1.CR2()->setADON(true);
ADC.CR2()->setADON(true);
}
}

View File

@@ -46,7 +46,7 @@ public:
class DR : public Register16 {
};
constexpr ADC(int i) : m_index(i) {}
constexpr ADC() {};
REGS_REGISTER_AT(SR, 0x0);
REGS_REGISTER_AT(CR2, 0x08);
REGS_REGISTER_AT(DR, 0x4C);
@@ -54,9 +54,8 @@ private:
constexpr uint32_t Base() const {
return 0x40012000;
};
int m_index;
};
constexpr ADC ADC1(1);
constexpr ADC ADC;
#endif