From b80ddc114523740beabc30921a28b51b6dc20632 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Sat, 10 Jul 2021 21:52:11 +0200 Subject: [PATCH] Implemented reading of PTT status from external microphone on MD-3x0 and MD-UV3x0 --- platform/targets/MD-3x0/hwconfig.h | 3 ++- platform/targets/MD-3x0/platform.c | 7 +++++-- platform/targets/MD-UV3x0/hwconfig.h | 3 ++- platform/targets/MD-UV3x0/platform.c | 7 +++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/targets/MD-3x0/hwconfig.h b/platform/targets/MD-3x0/hwconfig.h index 7c22eae9..3cf558db 100644 --- a/platform/targets/MD-3x0/hwconfig.h +++ b/platform/targets/MD-3x0/hwconfig.h @@ -80,7 +80,8 @@ #define CH_SELECTOR_3 GPIOB,11 /* Push-to-talk switch */ -#define PTT_SW GPIOE,11 +#define PTT_SW GPIOE,11 +#define PTT_EXT GPIOE,12 /* * Keyboard. Here we define only rows, since coloumn lines are the same as diff --git a/platform/targets/MD-3x0/platform.c b/platform/targets/MD-3x0/platform.c index bf198d5f..1fd45728 100644 --- a/platform/targets/MD-3x0/platform.c +++ b/platform/targets/MD-3x0/platform.c @@ -46,7 +46,8 @@ void platform_init() gpio_setMode(CH_SELECTOR_2, INPUT); gpio_setMode(CH_SELECTOR_3, INPUT); - gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PTT_EXT, INPUT); gpio_setMode(PWR_SW, OUTPUT); @@ -122,7 +123,9 @@ int8_t platform_getChSelector() bool platform_getPttStatus() { /* PTT line has a pullup resistor with PTT switch closing to ground */ - return (gpio_readPin(PTT_SW) == 0) ? true : false; + uint8_t intPttStatus = gpio_readPin(PTT_SW); + uint8_t extPttStatus = gpio_readPin(PTT_EXT); + return ((intPttStatus == 0) || (extPttStatus == 0)) ? true : false; } bool platform_pwrButtonStatus() diff --git a/platform/targets/MD-UV3x0/hwconfig.h b/platform/targets/MD-UV3x0/hwconfig.h index a2ab3af9..5d532d9f 100644 --- a/platform/targets/MD-UV3x0/hwconfig.h +++ b/platform/targets/MD-UV3x0/hwconfig.h @@ -74,7 +74,8 @@ #define CH_SELECTOR_1 GPIOB,11 /* Push-to-talk switch */ -#define PTT_SW GPIOE,11 +#define PTT_SW GPIOE,11 +#define PTT_EXT GPIOE,12 /* * Keyboard. Here we define only rows, since coloumn lines are the same as diff --git a/platform/targets/MD-UV3x0/platform.c b/platform/targets/MD-UV3x0/platform.c index 67c6ca7d..6107b42c 100644 --- a/platform/targets/MD-UV3x0/platform.c +++ b/platform/targets/MD-UV3x0/platform.c @@ -43,7 +43,8 @@ void platform_init() gpio_setMode(PTT_SW, INPUT_PULL_UP); - gpio_setMode(PWR_SW, OUTPUT); + gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PTT_EXT, INPUT); /* * Initialise ADC1, for vbat, RSSI, ... @@ -116,7 +117,9 @@ float platform_getVolumeLevel() bool platform_getPttStatus() { /* PTT line has a pullup resistor with PTT switch closing to ground */ - return (gpio_readPin(PTT_SW) == 0) ? true : false; + uint8_t intPttStatus = gpio_readPin(PTT_SW); + uint8_t extPttStatus = gpio_readPin(PTT_EXT); + return ((intPttStatus == 0) || (extPttStatus == 0)) ? true : false; } bool platform_pwrButtonStatus()