mirror of https://github.com/ARMmbed/mbed-os.git
Enable ADC scaling and enable internal channels
Increases input range by 2x(now, 0-2.4v)pull/6202/head
parent
992c889b33
commit
dcf3b904d1
|
@ -163,6 +163,10 @@ const PinMap PinMap_ADC[] = {
|
|||
{ AIN_3, ADC, ADC_CH_3 },
|
||||
{ AIN_4, ADC, ADC_CH_0_DIV_5 },
|
||||
{ AIN_5, ADC, ADC_CH_1_DIV_5 },
|
||||
{ AIN_6, ADC, ADC_CH_VDDB_DIV_4 },
|
||||
{ AIN_7, ADC, ADC_CH_VDD18 },
|
||||
{ AIN_8, ADC, ADC_CH_VDD12 },
|
||||
{ AIN_9, ADC, ADC_CH_VRTC_DIV_2 },
|
||||
{ NC, NC, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef enum {
|
|||
P4_0 = (4 << PORT_SHIFT), P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7,
|
||||
|
||||
// Analog input pins
|
||||
AIN_0 = (0xA << PORT_SHIFT), AIN_1, AIN_2, AIN_3, AIN_4, AIN_5,
|
||||
AIN_0 = (0xA << PORT_SHIFT), AIN_1, AIN_2, AIN_3, AIN_4, AIN_5, AIN_6, AIN_7, AIN_8, AIN_9,
|
||||
|
||||
LED_GREEN = P3_1,
|
||||
LED_RED = P3_0,
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef enum {
|
|||
P4_0 = (4 << PORT_SHIFT), P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7,
|
||||
|
||||
// Analog input pins
|
||||
AIN_0 = (0xA << PORT_SHIFT), AIN_1, AIN_2, AIN_3, AIN_4, AIN_5,
|
||||
AIN_0 = (0xA << PORT_SHIFT), AIN_1, AIN_2, AIN_3, AIN_4, AIN_5, AIN_6, AIN_7, AIN_8, AIN_9,
|
||||
|
||||
// LEDs
|
||||
LED1 = P2_4,
|
||||
|
|
|
@ -65,7 +65,7 @@ float analogin_read(analogin_t *obj)
|
|||
float result;
|
||||
|
||||
// Start conversion with no input scaling and no input buffer bypass
|
||||
ADC_StartConvert(obj->channel, 0, 0);
|
||||
ADC_StartConvert(obj->channel, 1, 0);
|
||||
|
||||
if (ADC_GetData(&tmp) == E_OVERFLOW) {
|
||||
result = FLOAT_FULL_SCALE;
|
||||
|
@ -83,7 +83,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
uint16_t result;
|
||||
|
||||
// Start conversion with no input scaling and no input buffer bypass
|
||||
ADC_StartConvert(obj->channel, 0, 0);
|
||||
ADC_StartConvert(obj->channel, 1, 0);
|
||||
|
||||
if (ADC_GetData(&tmp) == E_OVERFLOW) {
|
||||
result = INT_FULL_SCALE;
|
||||
|
|
Loading…
Reference in New Issue