From 7b4b9a94d63ce4623ef10e22b1f94309f21f90e5 Mon Sep 17 00:00:00 2001 From: Timothy Parez Date: Thu, 12 May 2022 21:20:11 +0800 Subject: [PATCH 1/2] Add support for ADC on GPIO35 on the M5Core2 Make it so that `M5Core2.GetAdcGpio` accepts value 35 , configures the `pin function` and opens the correct adc channel Partial Fix #1037 Signed-off-by: Timothy Parez --- nanoFramework.M5Core2/M5Core2.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nanoFramework.M5Core2/M5Core2.cs b/nanoFramework.M5Core2/M5Core2.cs index 49fe15c8..150cd75e 100644 --- a/nanoFramework.M5Core2/M5Core2.cs +++ b/nanoFramework.M5Core2/M5Core2.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Iot.Device.Axp192; @@ -333,6 +333,9 @@ public static AdcChannel GetAdcGpio(int gpioNumber) switch (gpioNumber) { + case 35: + Configuration.SetPinFunction(11, DeviceFunction.ADC1_CH7); + return _adc.OpenChannel(7); case 32: Configuration.SetPinFunction(32, DeviceFunction.ADC1_CH4); return _adc.OpenChannel(4); From 19c884ebcaa141a812fef5ed675af3b3d5746828 Mon Sep 17 00:00:00 2001 From: Timothy Parez Date: Thu, 12 May 2022 21:27:35 +0800 Subject: [PATCH 2/2] Add support for ADC on GPIO36 on the M5Core2 Make it so that `M5Core2.GetAdcGpio` accepts value 36 , configures the `pin function` and opens the correct adc channel Partial Fix #1037 Signed-off-by: Timothy Parez --- nanoFramework.M5Core2/M5Core2.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nanoFramework.M5Core2/M5Core2.cs b/nanoFramework.M5Core2/M5Core2.cs index 150cd75e..230ee28f 100644 --- a/nanoFramework.M5Core2/M5Core2.cs +++ b/nanoFramework.M5Core2/M5Core2.cs @@ -336,6 +336,9 @@ public static AdcChannel GetAdcGpio(int gpioNumber) case 35: Configuration.SetPinFunction(11, DeviceFunction.ADC1_CH7); return _adc.OpenChannel(7); + case 36: + Configuration.SetPinFunction(5, DeviceFunction.ADC1_CH0); + return _adc.OpenChannel(0); case 32: Configuration.SetPinFunction(32, DeviceFunction.ADC1_CH4); return _adc.OpenChannel(4);