[all] Files movements...

[X9D] Switches driver added
This commit is contained in:
bsongis
2012-12-22 18:04:32 +00:00
parent e534c2c7ea
commit 618d7f924f
17 changed files with 229 additions and 349 deletions
+74
View File
@@ -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
+111
View File
@@ -0,0 +1,111 @@
/*
* 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.
*
*/
#ifndef board_x9d_h
#define board_x9d_h
#include <stdio.h>
#include "stm32f2xx_rcc.h"
#include "stm32f2xx_gpio.h"
#include "stm32f2xx.h"
#include "x9d/hal.h"
#include "x9d/aspi.h"
#include "x9d/audio_driver.h"
// TODO elsewhere
#if !defined(SIMU)
#define SD_IS_HC() (1)
#endif
extern "C" {
extern void init_SDcard();
extern void sdInit();
}
#define sdPoll10ms()
void usbMassStorage();
void setVolume( register uint8_t volume );
#define JACK_PPM_OUT()
#define JACK_PPM_IN()
void configure_pins( uint32_t pins, uint16_t config );
uint16_t getCurrent();
extern uint8_t temperature ; // Raw temp reading
extern uint8_t maxTemperature ; // Raw temp reading
uint8_t getTemperature();
extern int32_t Card_state;
extern volatile uint32_t Card_initialized;
#define SD_ST_DATA 9
#define SD_ST_MOUNTED 10
#define SD_GET_SIZE_MB() (0)
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SPEED() (0)
void soft_power_off();
#define strcpy_P strcpy
#define strcat_P strcat
extern uint32_t readKeys();
#define KEYS_PRESSED() (~readKeys())
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & (0x20 + 0x40)) == (0x20 + 0x40))
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & (0x10 + 0x08)) == (0x10 + 0x08))
#define DBLKEYS_PRESSED_RGT_UP(i) ((in & (0x20 + 0x10)) == (0x20 + 0x10))
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & (0x40 + 0x08)) == (0x40 + 0x08))
extern uint16_t sessionTimer;
#define BOOTLOADER_REQUEST() (0/*usbPlugged()*/)
#define SLAVE_MODE() (0/*check_soft_power() == e_power_trainer*/)
#if !defined(SIMU)
#define wdt_disable()
#define wdt_enable(x)
#define wdt_reset()
#endif
#define setBacklight(xx)
uint32_t check_soft_power();
#endif
+96
View File
@@ -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()
{
-129
View File
@@ -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;
}