2 more files removed

This commit is contained in:
bsongis
2014-03-05 14:24:51 +01:00
parent 3b1ac9f5d8
commit 7f6a137ce8
16 changed files with 432 additions and 768 deletions
+3 -126
View File
@@ -21,137 +21,14 @@
#include <stdint.h>
#include <stdlib.h>
#ifdef PCBSKY
#include "radio.h"
#include "drivers.h"
#endif
#include "../src/opentx.h"
#ifdef PCBTARANIS
#include "radio.h"
#include "hal.h"
#include "stm32f2xx.h"
#include "stm32f2xx_gpio.h"
#include "stm32f2xx_rcc.h"
#endif
#include "drivers.h"
#include "logicio.h"
#ifdef EVT_KEY_MASK
#undef EVT_KEY_MASK
#endif
#define EVT_KEY_MASK 0x0f
void b_putEvent( register uint8_t evt) ;
void per10ms( void ) ;
uint8_t getEvent( void ) ;
void pauseEvents(uint8_t event) ;
void killEvents(uint8_t event) ;
uint8_t s_evt;
void b_putEvent( uint8_t evt)
{
s_evt = evt;
}
uint8_t getEvent()
{
register uint8_t evt = s_evt;
s_evt=0;
return evt;
}
Key keys[NUM_KEYS] ;
void Key::input(bool val, EnumKeys enuk)
{
// uint8_t old=m_vals;
m_vals <<= 1; if(val) m_vals |= 1; //portbit einschieben
m_cnt++;
if(m_state && m_vals==0){ //gerade eben sprung auf 0
if(m_state!=KSTATE_KILLED) {
b_putEvent(EVT_KEY_BREAK(enuk));
}
m_cnt = 0;
m_state = KSTATE_OFF;
}
switch(m_state){
case KSTATE_OFF:
if(m_vals==FFVAL){ //gerade eben sprung auf ff
m_state = KSTATE_START;
m_cnt = 0;
}
break;
//fallthrough
case KSTATE_START:
b_putEvent(EVT_KEY_FIRST(enuk));
#ifdef KSTATE_RPTDELAY
m_state = KSTATE_RPTDELAY;
#else
m_state = 16;
#endif
m_cnt = 0;
break;
#ifdef KSTATE_RPTDELAY
case KSTATE_RPTDELAY: // gruvin: longer delay before first key repeat
if(m_cnt == 32) b_putEvent(EVT_KEY_LONG(enuk)); // need to catch this inside RPTDELAY time
if (m_cnt == 40) {
m_state = 16;
m_cnt = 0;
}
break;
#endif
case 16:
#ifndef KSTATE_RPTDELAY
if(m_cnt == 32) b_putEvent(EVT_KEY_LONG(enuk));
//fallthrough
#endif
case 8:
case 4:
case 2:
if(m_cnt >= 48) { //3 6 12 24 48 pulses in every 480ms
m_state >>= 1;
m_cnt = 0;
}
//fallthrough
case 1:
if( (m_cnt & (m_state-1)) == 0) b_putEvent(EVT_KEY_REPT(enuk));
break;
case KSTATE_PAUSE: //pause
if(m_cnt >= 64) {
m_state = 8;
m_cnt = 0;
}
break;
case KSTATE_KILLED: //killed
break;
}
}
void b_pauseEvents(uint8_t event)
{
event=event & EVT_KEY_MASK;
if(event < (int)DIM(keys)) keys[event].pauseEvents();
}
void killEvents(uint8_t event)
{
event=event & EVT_KEY_MASK;
if(event < (int)DIM(keys)) keys[event].killEvents();
}
void per10ms()
void per10ms(void)
{
register uint32_t i ;
uint8_t enuk = KEY_MENU;
uint8_t in = ~read_keys() ;
uint8_t in = ~readKeys() ;
// Bits 3-6 are down, up, right and left
// Try to only allow one at a
#ifdef REVX