[ACT] Navigation & Menus
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny <shadow@privy.de>
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* open9x is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../open9x.h"
|
||||
|
||||
volatile uint8_t Buzzer_count ;
|
||||
|
||||
// Must NOT be in flash, PDC needs a RAM source.
|
||||
// Amplitude reduced to 30% to allow for voice volume
|
||||
uint16_t Sine_values[] =
|
||||
{
|
||||
2048,2085,2123,2160,2197,2233,2268,2303,2336,2369,
|
||||
2400,2430,2458,2485,2510,2533,2554,2573,2590,2605,
|
||||
2618,2629,2637,2643,2646,2648,2646,2643,2637,2629,
|
||||
2618,2605,2590,2573,2554,2533,2510,2485,2458,2430,
|
||||
2400,2369,2336,2303,2268,2233,2197,2160,2123,2085,
|
||||
2048,2010,1972,1935,1898,1862,1826,1792,1758,1726,
|
||||
1695,1665,1637,1610,1585,1562,1541,1522,1505,1490,
|
||||
1477,1466,1458,1452,1448,1448,1448,1452,1458,1466,
|
||||
1477,1490,1505,1522,1541,1562,1585,1610,1637,1665,
|
||||
1695,1726,1758,1792,1826,1862,1898,1935,1972,2010
|
||||
};
|
||||
|
||||
// Sound routines
|
||||
void startSound()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t currentFrequency = 0;
|
||||
|
||||
uint32_t getFrequency()
|
||||
{
|
||||
return currentFrequency;
|
||||
}
|
||||
|
||||
void setFrequency(uint32_t frequency)
|
||||
{
|
||||
if (currentFrequency != frequency) {
|
||||
currentFrequency = frequency;
|
||||
}
|
||||
}
|
||||
|
||||
// Start TIMER1 at 100000Hz, used for DACC trigger
|
||||
void start_timer1()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Configure DAC0 (or DAC1 for REVA)
|
||||
// Not sure why PB14 has not be allocated to the DAC, although it is an EXTRA function
|
||||
// So maybe it is automatically done
|
||||
void initDac()
|
||||
{
|
||||
}
|
||||
|
||||
void end_sound()
|
||||
{
|
||||
}
|
||||
|
||||
// Set up for volume control (TWI0)
|
||||
// Need PA3 and PA4 set to peripheral A
|
||||
void init_twi()
|
||||
{
|
||||
}
|
||||
|
||||
void setVolume( unsigned char volume )
|
||||
{
|
||||
}
|
||||
+33
-8
@@ -41,14 +41,16 @@
|
||||
#include "stm32f10x.h"
|
||||
|
||||
// Keys
|
||||
#define PIN_BUTTON_PLUS GPIO_Pin_0 //SW3 PE.10
|
||||
#define PIN_BUTTON_ENTER GPIO_Pin_1 //SW2 PE.11
|
||||
#define PIN_BUTTON_MINUS GPIO_Pin_2 //SW1 PE.12
|
||||
#define PIN_BUTTON_MENU GPIO_Pin_11 //SW4 PD.07
|
||||
#define PIN_BUTTON_EXIT GPIO_Pin_12 //SW5 PD.03
|
||||
#define PIN_BUTTON_PAGE GPIO_Pin_10 //SW6 PD.02
|
||||
|
||||
#include "x9d/audio_driver.h"
|
||||
#define GPIO_BUTTON_MENU GPIOC->IDR
|
||||
#define GPIO_BUTTON_EXIT GPIOC->IDR
|
||||
#define GPIO_BUTTON_CLR GPIOC->IDR
|
||||
#define GPIO_BUTTON_PAGE GPIOC->IDR
|
||||
#define GPIO_BUTTON_ENTER GPIOC->IDR
|
||||
#define PIN_BUTTON_MENU GPIO_Pin_11
|
||||
#define PIN_BUTTON_EXIT GPIO_Pin_12
|
||||
#define PIN_BUTTON_CLR GPIO_Pin_13
|
||||
#define PIN_BUTTON_PAGE GPIO_Pin_10
|
||||
#define PIN_BUTTON_ENTER GPIO_Pin_14
|
||||
|
||||
// TODO elsewhere
|
||||
#if !defined(SIMU)
|
||||
@@ -123,4 +125,27 @@ extern uint16_t sessionTimer;
|
||||
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
|
||||
#endif
|
||||
|
||||
#define NUM_VOL_LEVELS 24
|
||||
|
||||
void startSound( void ) ;
|
||||
void setFrequency( uint32_t frequency );
|
||||
uint32_t getFrequency();
|
||||
void start_timer1( void );
|
||||
void initDac( void ) ;
|
||||
void end_sound( void ) ;
|
||||
|
||||
extern uint16_t *nextAudioData;
|
||||
extern uint16_t nextAudioSize;
|
||||
|
||||
inline void toneStart()
|
||||
{
|
||||
}
|
||||
|
||||
inline void toneStop()
|
||||
{
|
||||
}
|
||||
|
||||
extern void init_twi( void ) ;
|
||||
extern void setVolume( register uint8_t volume ) ;
|
||||
|
||||
#endif
|
||||
|
||||
+16
-18
@@ -37,24 +37,20 @@
|
||||
uint32_t readKeys()
|
||||
{
|
||||
register uint32_t x = GPIOC->IDR;
|
||||
register uint32_t y = 0;
|
||||
register uint32_t result = 0;
|
||||
|
||||
if (x & 0x00000020)
|
||||
y |= 0x02 << KEY_ENTER;
|
||||
if (x & 0x00000010)
|
||||
y |= 0x02 << KEY_PLUS;
|
||||
if (x & 0x00000008)
|
||||
y |= 0x02 << KEY_MINUS;
|
||||
if (x & 0x00000002)
|
||||
y |= 0x02 << KEY_MENU;
|
||||
if (x & 0x00000040)
|
||||
y |= 0x02 << KEY_PAGE;
|
||||
if (x & 0x01000000)
|
||||
y |= 0x02 << KEY_EXIT;
|
||||
if (x & PIN_BUTTON_MENU)
|
||||
result |= 0x02 << KEY_MENU;
|
||||
if (x & PIN_BUTTON_EXIT)
|
||||
result |= 0x02 << KEY_EXIT;
|
||||
if (x & PIN_BUTTON_CLR)
|
||||
result |= 0x02 << KEY_CLR;
|
||||
if (x & PIN_BUTTON_PAGE)
|
||||
result |= 0x02 << KEY_PAGE;
|
||||
|
||||
// printf("readKeys(): %x => %x\n", x, y); fflush(stdout);
|
||||
// printf("readKeys(): %x => %x\n", x, result); fflush(stdout);
|
||||
|
||||
return y ;
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t readTrims()
|
||||
@@ -64,7 +60,7 @@ uint32_t readTrims()
|
||||
|
||||
uint8_t keyDown()
|
||||
{
|
||||
return ~readKeys() & 0x6C ;
|
||||
return ~readKeys() & 0x1e ;
|
||||
}
|
||||
|
||||
/* TODO common to ARM */
|
||||
@@ -74,7 +70,7 @@ void readKeysAndTrims()
|
||||
|
||||
uint8_t enuk = KEY_MENU;
|
||||
uint8_t in = ~readKeys();
|
||||
for (i = 1; i < 7; i++) {
|
||||
for (i = 1; i < 5; i++) {
|
||||
keys[enuk].input(in & (1 << i), (EnumKeys) enuk);
|
||||
++enuk;
|
||||
}
|
||||
@@ -85,9 +81,11 @@ void readKeysAndTrims()
|
||||
keys[enuk].input(in & i, (EnumKeys) enuk);
|
||||
++enuk;
|
||||
} */
|
||||
|
||||
keys[BTN_REa].input(!(GPIO_BUTTON_ENTER & PIN_BUTTON_ENTER), BTN_REa);
|
||||
}
|
||||
|
||||
uint32_t keyState(EnumKeys enuk)
|
||||
uint32_t switchState(EnumKeys enuk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user