Reorganised and cleaned up GD77 BSP files

replace/6d459eb7af1d92b6dd19c686b7ca908147af1f15
Silvano Seva 2020-12-18 18:28:00 +01:00
rodzic 98cd741c88
commit 1f8840b3ca
3 zmienionych plików z 87 dodań i 25 usunięć

Wyświetl plik

@ -0,0 +1,72 @@
/***************************************************************************
* Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* 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 <os.h>
#include "rtc.h"
/*
* NOTE: even if the MK22FN512 MCU has an RTC, it is unusable in GDx platforms
* because they lacks of the proper hardware necessary to run the RTC also when
* the MCU is powered off.
* We thus provide a stub implementation of the RTC API to avoid cluttering the
* main code with #ifdefs checking wheter or not the RTC can be actually used.
*/
void rtc_init() { }
void rtc_shutdown() { }
void rtc_setTime(curTime_t t)
{
(void) t;
}
void rtc_setHour(uint8_t hours, uint8_t minutes, uint8_t seconds)
{
(void) hours;
(void) minutes;
(void) seconds;
}
void rtc_setDate(uint8_t date, uint8_t month, uint8_t year)
{
(void) date;
(void) month;
(void) year;
}
curTime_t rtc_getTime()
{
curTime_t t;
t.hour = 12;
t.minute = 12;
t.second = 12;
t.year = 20;
t.day = 4;
t.month = 12;
t.date = 12;
return t;
}
void rtc_dstSet() { }
void rtc_dstClear() { }

Wyświetl plik

@ -23,10 +23,6 @@
#include "MK22F51212.h"
/* Signalling LEDs */
#define GREEN_LED GPIOB,18
#define RED_LED GPIOC,14
/* Screen dimensions */
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
@ -42,6 +38,10 @@
#define LCD_CLK GPIOC,11
#define LCD_DAT GPIOC,12
/* Signalling LEDs */
#define GREEN_LED GPIOB,18
#define RED_LED GPIOC,14
/* Keyboard */
#define KB_ROW0 GPIOB,19
#define KB_ROW1 GPIOB,20

Wyświetl plik

@ -21,35 +21,24 @@
#include <platform.h>
#include <gpio.h>
#include "hwconfig.h"
#include "rtc.h"
curTime_t rtc_getTime()
{
/* TODO */
curTime_t t;
t.hour = 12;
t.minute = 12;
t.second = 12;
t.year = 20;
t.day = 4;
t.month = 12;
t.date = 12;
return t;
}
void platform_init()
{
/* Configure GPIOs */
gpio_setMode(GREEN_LED, OUTPUT);
gpio_setMode(RED_LED, OUTPUT);
gpio_setMode(RED_LED, OUTPUT);
gpio_setMode(LCD_BKLIGHT, OUTPUT);
gpio_clearPin(LCD_BKLIGHT);
gpio_setMode(PTT_SW, INPUT);
}
void platform_terminate()
{
/* TODO */
gpio_clearPin(LCD_BKLIGHT);
gpio_clearPin(RED_LED);
gpio_clearPin(GREEN_LED);
}
float platform_getVbat()
@ -72,14 +61,14 @@ float platform_getVolumeLevel()
uint8_t platform_getChSelector()
{
/* TODO */
/* GD77 does not have a channel selector */
return 0;
}
bool platform_getPttStatus()
{
/* TODO */
return false;
/* PTT line has a pullup resistor with PTT switch closing to ground */
return (gpio_readPin(PTT_SW) == 0) ? true : false;
}
void platform_ledOn(led_t led)
@ -119,6 +108,7 @@ void platform_ledOff(led_t led)
void platform_beepStart(uint16_t freq)
{
/* TODO */
(void) freq;
}
@ -129,7 +119,7 @@ void platform_beepStop()
void platform_setBacklightLevel(uint8_t level)
{
/* TODO */
/* TODO: backlight dimming */
if(level > 1)
{
gpio_setPin(LCD_BKLIGHT);