From 828147c263d7752444b84b19c5ed1f0e5998c0ff Mon Sep 17 00:00:00 2001
From: swym <0xfd000000@gmail.com>
Date: Wed, 28 Aug 2019 00:08:47 +0200
Subject: [PATCH] gpio: document mode.ADC, move comment out of clang-tidy's
 reach

---
 Documentation/pycardium/gpio.rst | 8 +++++++-
 epicardium/modules/gpio.c        | 7 +++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/pycardium/gpio.rst b/Documentation/pycardium/gpio.rst
index 51c7d5f90..7d17b3fdf 100644
--- a/Documentation/pycardium/gpio.rst
+++ b/Documentation/pycardium/gpio.rst
@@ -25,7 +25,10 @@ output in your scripts.
    :param int pin: ID of the pin to be configured.
    :param int mode: An integer with the bits for the wanted mode set. Create your
       integer by ORing :py:data:`gpio.mode.OUTPUT`, :py:data:`gpio.mode.INPUT`,
-      :py:data:`gpio.mode.PULL_UP`, :py:data:`gpio.mode.PULL_DOWN`.
+      :py:data:`gpio.mode.ADC`, :py:data:`gpio.mode.PULL_UP`,
+      :py:data:`gpio.mode.PULL_DOWN`.
+
+   .. note:: On WRISTBAND_3, there is no ADC functionality available
 
 .. py:function:: get_mode(pin)
 
@@ -47,6 +50,9 @@ output in your scripts.
 
    :param int pin: ID of the pin of to get the mode of.
    :returns: Current value of the GPIO pin.
+      If the pin is configured as ADC, the value returned
+      will be between 0 and 1000, representing voltages from
+      0V to 3.3V
 
 .. py:data:: WRISTBAND_1
 
diff --git a/epicardium/modules/gpio.c b/epicardium/modules/gpio.c
index 68271cb93..6b6977391 100644
--- a/epicardium/modules/gpio.c
+++ b/epicardium/modules/gpio.c
@@ -33,8 +33,11 @@ static gpio_cfg_t gpio_configs[] = {
 static int s_adc_channels[] = {
 	[EPIC_GPIO_WRISTBAND_1] = ADC_CH_5,
 	[EPIC_GPIO_WRISTBAND_2] = ADC_CH_6,
-	[EPIC_GPIO_WRISTBAND_3] =
-		-1, //AFAICT on P0.29, there is no ADC available
+	/* on P0.29, there is no ADC available
+	 * see GPIO matrix in MAX32665-MAX32668.pdf,
+	 * pages 32,33
+	 */
+	[EPIC_GPIO_WRISTBAND_3] = -1,
 	[EPIC_GPIO_WRISTBAND_4] = ADC_CH_4,
 };
 
-- 
GitLab