OpenRTX/platform/targets/MD-UV380/platform.c

120 lines
2.8 KiB
C

/***************************************************************************
* Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <platform.h>
#include <gpio.h>
#include "hwconfig.h"
void platform_init()
{
/* Configure GPIOs */
gpio_setMode(GREEN_LED, OUTPUT);
gpio_setMode(RED_LED, OUTPUT);
gpio_setMode(LCD_BKLIGHT, OUTPUT);
gpio_clearPin(LCD_BKLIGHT);
}
void platform_terminate()
{
/* Shut down backlight */
gpio_clearPin(LCD_BKLIGHT);
gpio_clearPin(GREEN_LED);
gpio_clearPin(RED_LED);
RCC->APB2ENR &= ~RCC_APB2ENR_TIM8EN;
}
float platform_getVbat()
{
return 0.0f;
}
float platform_getMicLevel()
{
return 0.0f;
}
float platform_getVolumeLevel()
{
return 0.0f;
}
uint8_t platform_getChSelector()
{
return 0.0f;
}
void platform_ledOn(led_t led)
{
switch(led)
{
case GREEN:
gpio_setPin(GREEN_LED);
break;
case RED:
gpio_setPin(RED_LED);
break;
default:
break;
}
}
void platform_ledOff(led_t led)
{
switch(led)
{
case GREEN:
gpio_clearPin(GREEN_LED);
break;
case RED:
gpio_clearPin(RED_LED);
break;
default:
break;
}
}
void platform_beepStart(uint16_t freq)
{
(void) freq;
}
void platform_beepStop()
{
}
void platform_setBacklightLevel(uint8_t level)
{
if(level > 0)
{
gpio_setPin(LCD_BKLIGHT);
}
else
{
gpio_clearPin(LCD_BKLIGHT);
}
}