From b434793baf146ba9bdba25f0c6d661dacc996852 Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 26 Oct 2020 15:45:59 +0100 Subject: [PATCH] Add linux implementation of the platform API --- platform/targets/linux/hwconfig.h | 21 +++++++++- platform/targets/linux/platform.c | 67 +++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/platform/targets/linux/hwconfig.h b/platform/targets/linux/hwconfig.h index 0ce2ca8d..12870098 100644 --- a/platform/targets/linux/hwconfig.h +++ b/platform/targets/linux/hwconfig.h @@ -26,4 +26,23 @@ #define GPIOH "PH" #define GPIOI "PI" #define GPIOJ "PJ" -#define GPIOK "PK" \ No newline at end of file +#define GPIOK "PK" + +/* Signalling LEDs */ +#define GREEN_LED "GREEN_LED",0 +#define RED_LED "RED_LED",1 + +/* Analog inputs */ +#define AIN_VOLUME "AIN_VOLUME",0 +#define AIN_VBAT "AIN_VBAT",1 +#define AIN_MIC "AIN_MIC",3 +#define AIN_RSSI "AIN_RSSI",0 + +/* Channel selection rotary encoder */ +#define CH_SELECTOR_0 "CH_SELECTOR_0",14 +#define CH_SELECTOR_1 "CH_SELECTOR_1",15 +#define CH_SELECTOR_2 "CH_SELECTOR_2",10 +#define CH_SELECTOR_3 "CH_SELECTOR_3",11 + +/* Push-to-talk switch */ +#define PTT_SW "PTT_SW",11 diff --git a/platform/targets/linux/platform.c b/platform/targets/linux/platform.c index 7062a71a..d5c4aace 100644 --- a/platform/targets/linux/platform.c +++ b/platform/targets/linux/platform.c @@ -33,3 +33,70 @@ void platform_setBacklightLevel(uint8_t level) { printf("platform_setBacklightLevel(%u)\n", level); } + + +float platform_getVbat(){ + printf("platform_getVbat()\n"); + return 0.69; +} + + +float platform_getMicLevel(){ + printf("platform_getMicLevel()\n"); + return 0.69; +} + + +float platform_getVolumeLevel(){ + printf("platform_getVolumeLevel()\n"); + return 0.69; +} + + +uint8_t platform_getChSelector(){ + printf("platform_getChSelector()\n"); + return 42; +} + + +bool platform_getPttStatus(){ + printf("platform_getVbat()\n"); + return true; +} + + +void platform_ledOn(led_t led){ + char* str; + + switch(led){ + case 0: + str = "GREEN"; + break; + case 1: + str = "RED"; + break; + case 2: + str = "YELLOW"; + break; + case 3: + str = "WHITE"; + break; + } + + printf("platform_ledOn(%s)\n", str); +} + + +void platform_ledOff(led_t led){ + printf("platform_ledOff()\n"); +} + + +void platform_beepStart(uint16_t freq){ + printf("platform_beepStart(%u)\n", freq); +} + + +void platform_beepStop(){ + printf("platform_beepStop()\n"); +}