mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-02 13:14:51 +00:00
spring: Configure ADC pins
ADC pins should be configured as analog input pins. Also sets conversion factor to obtain voltage values in mV. BUG=chrome-os-partner:14319 TEST=Manual BRANCH=none Change-Id: I7e084052062c2b669f10da4309e99bf9e2954ded Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40199 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
@@ -106,10 +106,10 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = {
|
||||
* voltage divider, the conversion factor is 6600mV/4096.
|
||||
*/
|
||||
[ADC_CH_USB_VBUS_SNS] = {"USB_VBUS_SNS", 6600, 4096, 0, STM32_AIN(5)},
|
||||
/* Micro USB D+ sense pin. Raw ADC value. */
|
||||
[ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 1, 1, 0, STM32_AIN(2)},
|
||||
/* Micro USB D- sense pin. Raw ADC value. */
|
||||
[ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 1, 1, 0, STM32_AIN(4)},
|
||||
/* Micro USB D+ sense pin. Converted to mV (3300mV/4096). */
|
||||
[ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 3300, 4096, 0, STM32_AIN(2)},
|
||||
/* Micro USB D- sense pin. Converted to mV (3300mV/4096). */
|
||||
[ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 3300, 4096, 0, STM32_AIN(4)},
|
||||
};
|
||||
|
||||
void configure_board(void)
|
||||
@@ -137,6 +137,9 @@ void configure_board(void)
|
||||
STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x3 << 10))
|
||||
| (2 << 10);
|
||||
|
||||
/* Analog input for ADC pins (PA2, PA4, PA5) */
|
||||
STM32_GPIO_CRL_OFF(GPIO_A) &= ~0x00ff0f00;
|
||||
|
||||
/*
|
||||
* Set alternate function for USART1. For alt. function input
|
||||
* the port is configured in either floating or pull-up/down
|
||||
|
||||
Reference in New Issue
Block a user