Fix ADC based VCC detection

* we need to actually return the voltage
* we need to use the correct register name for the CIDR
This commit is contained in:
Harald Welte committed 2016-03-20 18:19:18 +01:00
1 parent 3bafe43376
commit 622b6be774
1 file changed
+3 -2
+3 -2
View File
@@ -228,8 +228,8 @@ static int adc_sam3s_reva_errata = 0;
static int card_vcc_adc_init(void)
{
uint32_t chip_arch = CHIPID->CIDR & CHIPID_CIDR_ARCH_Msk;
uint32_t chip_ver = CHIPID->CIDR & CHIPID_CIDR_VERSION_Msk;
uint32_t chip_arch = CHIPID->CHIPID_CIDR & CHIPID_CIDR_ARCH_Msk;
uint32_t chip_ver = CHIPID->CHIPID_CIDR & CHIPID_CIDR_VERSION_Msk;
PMC_EnablePeripheral(ID_ADC);
@@ -293,6 +293,7 @@ static void process_vcc_adc(struct cardem_inst *ci)
static uint32_t adc2uv(uint16_t adc)
{
uint32_t uv = (uint32_t) adc * UV_PER_LSB;
return uv;
}
void ADC_IrqHandler(void)