Tone generator and GPIO for audio control on MD-UV380 platform

replace/9f69e121d1cb3e6165c18056e5cc86d25b14c709
Silvano Seva 2021-01-04 20:53:42 +01:00
rodzic 41e6c1d1e6
commit 8010302d4d
3 zmienionych plików z 64 dodań i 8 usunięć

Wyświetl plik

@ -221,6 +221,7 @@ mduv380_src = src + stm32f405_src + ['platform/drivers/display/HX83XX_MDx.c',
'platform/drivers/NVM/spiFlash_MDx.c',
'platform/drivers/NVM/nvmem_MDUV3x0.c',
'platform/drivers/ADC/ADC1_MDx.c',
'platform/drivers/tones/toneGenerator_MDx.c',
'platform/drivers/baseband/rtx_UV3x0.c',
'platform/targets/MD-UV380/platform.c']
@ -228,6 +229,14 @@ mduv380_inc = inc + stm32f405_inc + ['platform/targets/MD-UV380']
mduv380_def = def + stm32f405_def + {'PLATFORM_MDUV380': ''}
## TYT MD-9600
md9600_src = src + stm32f405_src + ['platform/targets/MD-9600/platform.c',
'platform/drivers/tones/toneGenerator_MDx.c']
md9600_inc = inc + stm32f405_inc + ['platform/targets/MD-9600']
md9600_def = def + stm32f405_def + {'PLATFORM_MD9600': ''}
## Radioddity GD77
gd77_src = src + mk22fn512_src + ['platform/targets/GD77/platform.c',
'platform/drivers/display/UC1701_GD77.c',
@ -257,14 +266,6 @@ dm1801_src = src + mk22fn512_src + ['platform/targets/DM-1801/platform.c',
dm1801_inc = inc + mk22fn512_inc + ['platform/targets/DM-1801']
dm1801_def = def + mk22fn512_def + {'PLATFORM_DM1801': ''}
## TYT MD-9600
md9600_src = src + stm32f405_src + ['platform/targets/MD-9600/platform.c']
md9600_inc = inc + stm32f405_inc + ['platform/targets/MD-9600']
md9600_def = def + stm32f405_def + {'PLATFORM_MD9600': ''}
##
## Compilation defines
##

Wyświetl plik

@ -89,12 +89,20 @@
#define MONI_SW LCD_D6
#define FUNC_SW LCD_D7
/* Tone generator */
#define CTCSS_OUT GPIOC,7 /* System "beep" */
#define BEEP_OUT GPIOC,8 /* CTCSS tone */
/* External flash */
#define FLASH_CS GPIOD,7
#define FLASH_CLK GPIOB,3
#define FLASH_SDO GPIOB,4
#define FLASH_SDI GPIOB,5
/* Audio control */
#define AMP_EN GPIOB,9
#define SPK_MUTE GPIOB,8
/*
* To enable pwm for display backlight dimming uncomment this directive.
*

Wyświetl plik

@ -0,0 +1,47 @@
/***************************************************************************
* Copyright (C) 2020 by Federico Izzo IU2NUO, Niccolò Izzo IU2KIN and *
* 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 <stdint.h>
#include <stdio.h>
#include "stm32f4xx.h"
#include "gpio.h"
#include "delays.h"
#include "toneGenerator_MDx.h"
#include "hwconfig.h"
int main()
{
gpio_setMode(SPK_MUTE, OUTPUT); // Turn on speaker
gpio_clearPin(SPK_MUTE);
gpio_setMode(AMP_EN, OUTPUT); // Turn on audio amplifier
gpio_setPin(AMP_EN);
toneGen_init();
toneGen_setBeepFreq(440.0f);
while(1)
{
toneGen_beepOn();
delayMs(500);
toneGen_beepOff();
delayMs(500);
}
return 0;
}