[all] Files movements...
[X9D] Switches driver added
This commit is contained in:
+6
-6
@@ -470,7 +470,7 @@ ifeq ($(PCB), ACT)
|
||||
CPPDEFS += -DPCBACT -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1 -DLCD260 -DSTM32F10X_LD
|
||||
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
|
||||
EXTRAINCDIRS += act/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/inc act/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x
|
||||
BOARDSRC = board_x9d.cpp
|
||||
BOARDSRC = x9d/board_x9d.cpp
|
||||
EXTRABOARDSRC += x9d/lcd_driver.cpp
|
||||
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
|
||||
EEPROMSRC = eeprom_arm.cpp eeprom_conversions.cpp
|
||||
@@ -486,7 +486,7 @@ ifeq ($(PCB), X9D)
|
||||
CPPDEFS += -DPCBX9D -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1 -DLCD212
|
||||
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
|
||||
EXTRAINCDIRS += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include
|
||||
BOARDSRC = board_x9d.cpp
|
||||
BOARDSRC = x9d/board_x9d.cpp
|
||||
EXTRABOARDSRC += x9d/lcd_driver.cpp x9d/aspi.cpp
|
||||
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
|
||||
EEPROMSRC = eeprom_arm.cpp eeprom_conversions.cpp
|
||||
@@ -516,7 +516,7 @@ ifeq ($(PCB), SKY9X)
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = board_sky9x.cpp
|
||||
BOARDSRC = sky9x/board_sky9x.cpp
|
||||
EXTRABOARDSRC += sky9x/lcd_driver.cpp
|
||||
SRC += sky9x/core_cm3.c sky9x/board_lowlevel.c sky9x/crt.c sky9x/vectors_sam3s.c
|
||||
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
|
||||
@@ -556,7 +556,7 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBGRUVIN9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DROTARY_ENCODERS=2
|
||||
EXTRAINCDIRS += gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC += board_gruvin9x.cpp
|
||||
BOARDSRC += gruvin9x/board_gruvin9x.cpp
|
||||
EXTRABOARDSRC += stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_avr.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
@@ -583,7 +583,7 @@ ifeq ($(PCB), STD128)
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=0x8000
|
||||
EXTRAINCDIRS += stock
|
||||
BOARDSRC = board_stock.cpp
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC += stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_avr.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
@@ -619,7 +619,7 @@ ifeq ($(PCB), STD)
|
||||
OPT = s
|
||||
EXTRAINCDIRS += stock
|
||||
CPPDEFS += -DPCBSTD -DCPUM64 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
BOARDSRC = board_stock.cpp
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC += stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_avr.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - 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"
|
||||
|
||||
uint16_t Analog_values[NUMBER_ANALOG] ;
|
||||
uint8_t temperature = 0; // Raw temp reading
|
||||
uint8_t maxTemperature = 0 ; // Raw temp reading
|
||||
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
|
||||
|
||||
void keysInit();
|
||||
void pwrInit();
|
||||
|
||||
uint8_t getTemperature()
|
||||
{
|
||||
return temperature + g_eeGeneral.temperatureCalib;
|
||||
}
|
||||
|
||||
uint32_t keyState(EnumKeys enuk)
|
||||
{
|
||||
register uint32_t a = GPIOB->IDR;
|
||||
|
||||
register uint32_t xxx = 0;
|
||||
|
||||
if (enuk < (int) DIM(keys)) return keys[enuk].state() ? 1 : 0;
|
||||
|
||||
switch ((uint8_t) enuk) {
|
||||
case SW_SA0:
|
||||
xxx = ~a & (1<<31);
|
||||
break;
|
||||
case SW_SA2:
|
||||
xxx = a & (1<<31);
|
||||
break;
|
||||
|
||||
case SW_SB0:
|
||||
xxx = !(a & ((1<<26) | (1<<27)));
|
||||
break;
|
||||
case SW_SB1:
|
||||
xxx = (a & (1<<27)) && (~a & (1<<26));
|
||||
break;
|
||||
case SW_SB2:
|
||||
xxx = (~a & (1<<27)) && (a & (1<<26));
|
||||
break;
|
||||
|
||||
case SW_SC0:
|
||||
xxx = !(a & ((1<<22) | (1<<23)));
|
||||
break;
|
||||
case SW_SC1:
|
||||
xxx = (a & (1<<23)) && (~a & (1<<22));
|
||||
break;
|
||||
case SW_SC2:
|
||||
xxx = (~a & (1<<23)) && (a & (1<<22));
|
||||
break;
|
||||
|
||||
case SW_SD0:
|
||||
xxx = !(a & ((1<<20) | (1<<21)));
|
||||
break;
|
||||
case SW_SD1:
|
||||
xxx = (a & (1<<21)) && (~a & (1<<20));
|
||||
break;
|
||||
case SW_SD2:
|
||||
xxx = (~a & (1<<21)) && (a & (1<<20));
|
||||
break;
|
||||
|
||||
case SW_SE0:
|
||||
xxx = !(a & ((1<<18) | (1<<19)));
|
||||
break;
|
||||
case SW_SE1:
|
||||
xxx = (a & (1<<19)) && (~a & (1<<18));
|
||||
break;
|
||||
case SW_SE2:
|
||||
xxx = (~a & (1<<19)) && (a & (1<<18));
|
||||
break;
|
||||
|
||||
case SW_SF0:
|
||||
xxx = !(a & ((1<<16) | (1<<17)));
|
||||
break;
|
||||
case SW_SF1:
|
||||
xxx = (a & (1<<17)) && (~a & (1<<16));
|
||||
break;
|
||||
case SW_SF2:
|
||||
xxx = (~a & (1<<17)) && (a & (1<<16));
|
||||
break;
|
||||
|
||||
case SW_SG0:
|
||||
xxx = !(a & ((1<<14) | (1<<15)));
|
||||
break;
|
||||
case SW_SG1:
|
||||
xxx = (a & (1<<15)) && (~a & (1<<14));
|
||||
break;
|
||||
case SW_SG2:
|
||||
xxx = (~a & (1<<15)) && (a & (1<<14));
|
||||
break;
|
||||
|
||||
case SW_SH0:
|
||||
xxx = ~a & (1<<13);
|
||||
break;
|
||||
case SW_SH2:
|
||||
xxx = a & (1<<13);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (xxx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO change this function!
|
||||
void read_9_adc()
|
||||
{
|
||||
}
|
||||
|
||||
void start_ppm_capture()
|
||||
{
|
||||
}
|
||||
|
||||
void usbBootloader()
|
||||
{
|
||||
}
|
||||
|
||||
void usbMassStorage()
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
void boardInit()
|
||||
{
|
||||
pwrInit();
|
||||
keysInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+5
-5
@@ -154,15 +154,15 @@
|
||||
#define HAPTIC_VARIANT 0x0100 */
|
||||
|
||||
#if defined(PCBACT)
|
||||
#include "board_act.h"
|
||||
#include "act/board_act.h"
|
||||
#elif defined(PCBX9D)
|
||||
#include "board_x9d.h"
|
||||
#include "x9d/board_x9d.h"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "board_sky9x.h"
|
||||
#include "sky9x/board_sky9x.h"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "board_gruvin9x.h"
|
||||
#include "gruvin9x/board_gruvin9x.h"
|
||||
#else
|
||||
#include "board_stock.h"
|
||||
#include "stock/board_stock.h"
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
|
||||
+41
-40
@@ -44,6 +44,7 @@ const char *eepromFile = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
GPIO_TypeDef gpioa;
|
||||
GPIO_TypeDef gpiob;
|
||||
GPIO_TypeDef gpioc;
|
||||
GPIO_TypeDef gpiod;
|
||||
@@ -96,88 +97,88 @@ void setSwitch(int8_t swtch)
|
||||
switch (swtch) {
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
case DSW(SW_SA0):
|
||||
GPIOB->IDR &= ~(1<<31);
|
||||
GPIOE->IDR &= ~PIN_SW_A_L;
|
||||
break;
|
||||
case DSW(SW_SA2):
|
||||
GPIOB->IDR |= (1<<31);
|
||||
GPIOE->IDR |= PIN_SW_A_L;
|
||||
break;
|
||||
case DSW(SW_SB0):
|
||||
GPIOB->IDR &= ~(1<<26);
|
||||
GPIOB->IDR &= ~(1<<27);
|
||||
GPIOB->IDR &= ~PIN_SW_B_L;
|
||||
GPIOB->IDR &= ~PIN_SW_B_H;
|
||||
break;
|
||||
case DSW(SW_SB1):
|
||||
GPIOB->IDR |= (1<<27);
|
||||
GPIOB->IDR &= ~(1<<26);
|
||||
GPIOB->IDR |= PIN_SW_B_H;
|
||||
GPIOB->IDR &= ~PIN_SW_B_L;
|
||||
break;
|
||||
case DSW(SW_SB2):
|
||||
GPIOB->IDR |= (1<<26);
|
||||
GPIOB->IDR &= ~(1<<27);
|
||||
GPIOB->IDR |= PIN_SW_B_L;
|
||||
GPIOB->IDR &= ~PIN_SW_B_H;
|
||||
break;
|
||||
case DSW(SW_SC0):
|
||||
GPIOB->IDR &= ~(1<<22);
|
||||
GPIOB->IDR &= ~(1<<23);
|
||||
GPIOB->IDR &= ~PIN_SW_C_L;
|
||||
GPIOB->IDR &= ~PIN_SW_C_H;
|
||||
break;
|
||||
case DSW(SW_SC1):
|
||||
GPIOB->IDR |= (1<<23);
|
||||
GPIOB->IDR &= ~(1<<22);
|
||||
GPIOB->IDR |= PIN_SW_C_H;
|
||||
GPIOB->IDR &= ~PIN_SW_C_L;
|
||||
break;
|
||||
case DSW(SW_SC2):
|
||||
GPIOB->IDR |= (1<<22);
|
||||
GPIOB->IDR &= ~(1<<23);
|
||||
GPIOB->IDR |= PIN_SW_C_L;
|
||||
GPIOB->IDR &= ~PIN_SW_C_H;
|
||||
break;
|
||||
case DSW(SW_SD0):
|
||||
GPIOB->IDR &= ~(1<<20);
|
||||
GPIOB->IDR &= ~(1<<21);
|
||||
GPIOE->IDR &= ~PIN_SW_D_L;
|
||||
GPIOB->IDR &= ~PIN_SW_D_H;
|
||||
break;
|
||||
case DSW(SW_SD1):
|
||||
GPIOB->IDR |= (1<<21);
|
||||
GPIOB->IDR &= ~(1<<20);
|
||||
GPIOB->IDR |= PIN_SW_D_H;
|
||||
GPIOE->IDR &= ~PIN_SW_D_L;
|
||||
break;
|
||||
case DSW(SW_SD2):
|
||||
GPIOB->IDR |= (1<<20);
|
||||
GPIOB->IDR &= ~(1<<21);
|
||||
GPIOE->IDR |= PIN_SW_D_L;
|
||||
GPIOB->IDR &= ~PIN_SW_D_H;
|
||||
break;
|
||||
case DSW(SW_SE0):
|
||||
GPIOB->IDR &= ~(1<<18);
|
||||
GPIOB->IDR &= ~(1<<19);
|
||||
GPIOA->IDR &= ~PIN_SW_E_L;
|
||||
GPIOB->IDR &= ~PIN_SW_E_H;
|
||||
break;
|
||||
case DSW(SW_SE1):
|
||||
GPIOB->IDR |= (1<<19);
|
||||
GPIOB->IDR &= ~(1<<18);
|
||||
GPIOB->IDR |= PIN_SW_E_H;
|
||||
GPIOA->IDR &= ~PIN_SW_E_L;
|
||||
break;
|
||||
case DSW(SW_SE2):
|
||||
GPIOB->IDR |= (1<<18);
|
||||
GPIOB->IDR &= ~(1<<19);
|
||||
GPIOA->IDR |= PIN_SW_E_L;
|
||||
GPIOB->IDR &= ~PIN_SW_E_H;
|
||||
break;
|
||||
case DSW(SW_SF0):
|
||||
GPIOB->IDR &= ~(1<<16);
|
||||
GPIOB->IDR &= ~(1<<17);
|
||||
GPIOB->IDR &= ~PIN_SW_F_L;
|
||||
GPIOE->IDR &= ~PIN_SW_F_H;
|
||||
break;
|
||||
case DSW(SW_SF1):
|
||||
GPIOB->IDR |= (1<<17);
|
||||
GPIOB->IDR &= ~(1<<16);
|
||||
GPIOE->IDR |= PIN_SW_F_H;
|
||||
GPIOB->IDR &= ~PIN_SW_F_L;
|
||||
break;
|
||||
case DSW(SW_SF2):
|
||||
GPIOB->IDR |= (1<<16);
|
||||
GPIOB->IDR &= ~(1<<17);
|
||||
GPIOB->IDR |= PIN_SW_F_L;
|
||||
GPIOE->IDR &= ~PIN_SW_F_H;
|
||||
break;
|
||||
case DSW(SW_SG0):
|
||||
GPIOB->IDR &= ~(1<<14);
|
||||
GPIOB->IDR &= ~(1<<15);
|
||||
GPIOE->IDR &= ~PIN_SW_G_L;
|
||||
GPIOE->IDR &= ~PIN_SW_G_H;
|
||||
break;
|
||||
case DSW(SW_SG1):
|
||||
GPIOB->IDR |= (1<<15);
|
||||
GPIOB->IDR &= ~(1<<14);
|
||||
GPIOE->IDR |= PIN_SW_G_H;
|
||||
GPIOE->IDR &= ~PIN_SW_G_L;
|
||||
break;
|
||||
case DSW(SW_SG2):
|
||||
GPIOB->IDR |= (1<<14);
|
||||
GPIOB->IDR &= ~(1<<15);
|
||||
GPIOE->IDR |= PIN_SW_G_L;
|
||||
GPIOE->IDR &= ~PIN_SW_G_H;
|
||||
break;
|
||||
case DSW(SW_SH0):
|
||||
GPIOB->IDR &= ~(1<<13);
|
||||
GPIOE->IDR &= ~PIN_SW_H_L;
|
||||
break;
|
||||
case DSW(SW_SH2):
|
||||
GPIOB->IDR |= (1<<13);
|
||||
GPIOE->IDR |= PIN_SW_H_L;
|
||||
break;
|
||||
#elif defined(PCBSKY9X)
|
||||
case DSW(SW_ID0):
|
||||
|
||||
@@ -96,6 +96,9 @@ typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
extern GPIO_TypeDef gpioa;
|
||||
#undef GPIOA
|
||||
#define GPIOA (&gpioa)
|
||||
extern GPIO_TypeDef gpiob;
|
||||
#undef GPIOB
|
||||
#define GPIOB (&gpiob)
|
||||
|
||||
+4
-1
@@ -323,7 +323,10 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
ERSKY9X_RIGHT_PIO |= ERSKY9X_DOWN_MASK | ERSKY9X_UP_MASK | ERSKY9X_RIGHT_MASK | ERSKY9X_LEFT_MASK ;
|
||||
ERSKY9X_UP_PIO |= ERSKY9X_UP_MASK;
|
||||
ERSKY9X_DOWN_PIO |= ERSKY9X_DOWN_MASK;
|
||||
ERSKY9X_LEFT_PIO |= ERSKY9X_LEFT_MASK;
|
||||
ERSKY9X_RIGHT_PIO |= ERSKY9X_RIGHT_MASK;
|
||||
ERSKY9X_EXIT_PIO |= ERSKY9X_EXIT_MASK;
|
||||
ERSKY9X_RETURN_PIO |= ERSKY9X_RETURN_MASK;
|
||||
#if defined(PCBX9D)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - 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"
|
||||
|
||||
uint16_t Analog_values[NUMBER_ANALOG] ;
|
||||
uint8_t temperature = 0; // Raw temp reading
|
||||
uint8_t maxTemperature = 0 ; // Raw temp reading
|
||||
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
|
||||
|
||||
void keysInit();
|
||||
void pwrInit();
|
||||
|
||||
uint8_t getTemperature()
|
||||
{
|
||||
return temperature + g_eeGeneral.temperatureCalib;
|
||||
}
|
||||
|
||||
// TODO change this function!
|
||||
void read_9_adc()
|
||||
{
|
||||
}
|
||||
|
||||
void start_ppm_capture()
|
||||
{
|
||||
}
|
||||
|
||||
void usbBootloader()
|
||||
{
|
||||
}
|
||||
|
||||
void usbMassStorage()
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
void boardInit()
|
||||
{
|
||||
pwrInit();
|
||||
keysInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -112,6 +112,102 @@ void readKeysAndTrims()
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t keyState(EnumKeys enuk)
|
||||
{
|
||||
register uint32_t a = GPIOA->IDR;
|
||||
register uint32_t b = GPIOB->IDR;
|
||||
register uint32_t e = GPIOE->IDR;
|
||||
|
||||
register uint32_t xxx = 0;
|
||||
|
||||
if (enuk < (int) DIM(keys)) return keys[enuk].state() ? 1 : 0;
|
||||
|
||||
switch ((uint8_t) enuk) {
|
||||
case SW_SA0:
|
||||
xxx = ~e & PIN_SW_A_L;
|
||||
break;
|
||||
case SW_SA2:
|
||||
xxx = e & PIN_SW_A_L;
|
||||
break;
|
||||
|
||||
case SW_SB0:
|
||||
xxx = !(b & (PIN_SW_B_L | PIN_SW_B_H));
|
||||
break;
|
||||
case SW_SB1:
|
||||
xxx = (b & PIN_SW_B_H) && (~b & PIN_SW_B_L);
|
||||
break;
|
||||
case SW_SB2:
|
||||
xxx = (~b & PIN_SW_B_H) && (b & PIN_SW_B_L);
|
||||
break;
|
||||
|
||||
case SW_SC0:
|
||||
xxx = !(b & (PIN_SW_C_L | PIN_SW_C_H));
|
||||
break;
|
||||
case SW_SC1:
|
||||
xxx = (b & PIN_SW_C_H) && (~b & PIN_SW_C_L);
|
||||
break;
|
||||
case SW_SC2:
|
||||
xxx = (~b & PIN_SW_C_H) && (b & PIN_SW_C_L);
|
||||
break;
|
||||
|
||||
case SW_SD0:
|
||||
xxx = (~e & PIN_SW_D_L) && (~b & PIN_SW_D_H);
|
||||
break;
|
||||
case SW_SD1:
|
||||
xxx = (b & PIN_SW_D_H) && (~e & PIN_SW_D_L);
|
||||
break;
|
||||
case SW_SD2:
|
||||
xxx = (~b & PIN_SW_D_H) && (e & PIN_SW_D_L);
|
||||
break;
|
||||
|
||||
case SW_SE0:
|
||||
xxx = (~a & PIN_SW_E_L) && (~b & PIN_SW_E_H);
|
||||
break;
|
||||
case SW_SE1:
|
||||
xxx = (b & PIN_SW_E_H) && (~a & PIN_SW_E_L);
|
||||
break;
|
||||
case SW_SE2:
|
||||
xxx = (~b & PIN_SW_E_H) && (a & PIN_SW_E_L);
|
||||
break;
|
||||
|
||||
case SW_SF0:
|
||||
xxx = (~b & PIN_SW_F_L) && (~e & PIN_SW_F_H);
|
||||
break;
|
||||
case SW_SF1:
|
||||
xxx = (e & PIN_SW_F_H) && (~b & PIN_SW_F_L);
|
||||
break;
|
||||
case SW_SF2:
|
||||
xxx = (~e & PIN_SW_F_H) && (b & PIN_SW_F_L);
|
||||
break;
|
||||
|
||||
case SW_SG0:
|
||||
xxx = !(e & (PIN_SW_G_L | PIN_SW_G_H));
|
||||
break;
|
||||
case SW_SG1:
|
||||
xxx = (e & PIN_SW_G_H) && (~e & PIN_SW_G_L);
|
||||
break;
|
||||
case SW_SG2:
|
||||
xxx = (~e & PIN_SW_G_H) && (e & PIN_SW_G_L);
|
||||
break;
|
||||
|
||||
case SW_SH0:
|
||||
xxx = ~e & PIN_SW_H_L;
|
||||
break;
|
||||
case SW_SH2:
|
||||
xxx = e & PIN_SW_H_L;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (xxx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
void keysInit()
|
||||
{
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - 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"
|
||||
|
||||
uint32_t keyState(EnumKeys enuk)
|
||||
{
|
||||
register uint32_t e = GPIOE->IDR;
|
||||
register uint32_t b = GPIOB->IDR;
|
||||
|
||||
register uint32_t xxx = 0;
|
||||
|
||||
if (enuk < (int) DIM(keys)) return keys[enuk].state() ? 1 : 0;
|
||||
|
||||
switch ((uint8_t) enuk) {
|
||||
case SW_SA0:
|
||||
xxx = ~e & PIN_SW_A_L;
|
||||
break;
|
||||
case SW_SA2:
|
||||
xxx = e & PIN_SW_A_L;
|
||||
break;
|
||||
|
||||
case SW_SB0:
|
||||
xxx = !(b & (PIN_SW_B_L | PIN_SW_B_H));
|
||||
break;
|
||||
case SW_SB1:
|
||||
xxx = (b & PIN_SW_B_H) && (~a & PIN_SW_B_L);
|
||||
break;
|
||||
case SW_SB2:
|
||||
xxx = (~b & PIN_SW_B_H) && (a & PIN_SW_B_L);
|
||||
break;
|
||||
|
||||
case SW_SC0:
|
||||
xxx = !(b & (PIN_SW_C_L | PIN_SW_C_H));
|
||||
break;
|
||||
case SW_SC1:
|
||||
xxx = (b & PIN_SW_C_H) && (~b & PIN_SW_C_L);
|
||||
break;
|
||||
case SW_SC2:
|
||||
xxx = (~b & PIN_SW_C_H) && (b & PIN_SW_C_L);
|
||||
break;
|
||||
|
||||
case SW_SD0:
|
||||
xxx = (~a & PIN_SW_D_L) && (~e & PIN_SW_D_H);
|
||||
break;
|
||||
case SW_SD1:
|
||||
xxx = (b & PIN_SW_D_H) && (~e & PIN_SW_D_L);
|
||||
break;
|
||||
case SW_SD2:
|
||||
xxx = (~b & PIN_SW_D_H) && (e & PIN_SW_D_L);
|
||||
break;
|
||||
|
||||
case SW_SE0:
|
||||
xxx = !(a & ((1<<18) | (1<<19)));
|
||||
break;
|
||||
case SW_SE1:
|
||||
xxx = (a & (1<<19)) && (~a & (1<<18));
|
||||
break;
|
||||
case SW_SE2:
|
||||
xxx = (~a & (1<<19)) && (a & (1<<18));
|
||||
break;
|
||||
|
||||
case SW_SF0:
|
||||
xxx = !(a & ((1<<16) | (1<<17)));
|
||||
break;
|
||||
case SW_SF1:
|
||||
xxx = (a & (1<<17)) && (~a & (1<<16));
|
||||
break;
|
||||
case SW_SF2:
|
||||
xxx = (~a & (1<<17)) && (a & (1<<16));
|
||||
break;
|
||||
|
||||
case SW_SG0:
|
||||
xxx = !(a & ((1<<14) | (1<<15)));
|
||||
break;
|
||||
case SW_SG1:
|
||||
xxx = (a & (1<<15)) && (~a & (1<<14));
|
||||
break;
|
||||
case SW_SG2:
|
||||
xxx = (~a & (1<<15)) && (a & (1<<14));
|
||||
break;
|
||||
|
||||
case SW_SH0:
|
||||
xxx = ~a & (1<<13);
|
||||
break;
|
||||
case SW_SH2:
|
||||
xxx = a & (1<<13);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (xxx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user