Taranis X9E Simulator - with rotary encoder

This commit is contained in:
bsongis
2014-12-01 22:08:19 +01:00
parent de43ce71df
commit fa963041ef
29 changed files with 465 additions and 50 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
#ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -73,7 +73,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
#define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
+2 -2
View File
@@ -17,7 +17,7 @@
#ifndef _FATFS
#define _FATFS 80376 /* Revision ID */
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
@@ -334,7 +334,7 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
#endif
#ifdef __cplusplus
#if defined(__cplusplus)
}
#endif
+2 -2
View File
@@ -61,13 +61,13 @@ extern uint8_t g_ms100; // global to allow time set function to reset to zero
void rtcInit();
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
void rtcSetTime(struct gtm * tm);
void gettime(struct gtm * tm);
gtime_t gmktime (struct gtm *tm);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
+10 -10
View File
@@ -290,16 +290,16 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
SWITCH_KEY(F, 5, 3);
SWITCH_KEY(G, 6, 3);
SWITCH_KEY(H, 7, 3);
SWITCH_KEY(I, 8, 3);
SWITCH_KEY(J, 9, 3);
SWITCH_KEY(K, 10, 3);
SWITCH_KEY(L, 11, 3);
SWITCH_KEY(M, 12, 3);
SWITCH_KEY(N, 13, 3);
SWITCH_KEY(O, 14, 3);
SWITCH_KEY(P, 15, 3);
SWITCH_KEY(Q, 16, 3);
SWITCH_KEY(R, 17, 3);
// SWITCH_KEY(I, 8, 3);
// SWITCH_KEY(J, 9, 3);
// SWITCH_KEY(K, 10, 3);
// SWITCH_KEY(L, 11, 3);
// SWITCH_KEY(M, 12, 3);
// SWITCH_KEY(N, 13, 3);
// SWITCH_KEY(O, 14, 3);
// SWITCH_KEY(P, 15, 3);
// SWITCH_KEY(Q, 16, 3);
// SWITCH_KEY(R, 17, 3);
#elif defined(PCBTARANIS)
SWITCH_KEY(A, 0, 3);
SWITCH_KEY(B, 1, 3);
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_GPIO_H
#define __STM32F2xx_GPIO_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -394,7 +394,7 @@ void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
/* GPIO Alternate functions configuration function ****************************/
void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_I2C_H
#define __STM32F2xx_I2C_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -681,7 +681,7 @@ void I2C_ClearFlag(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_PWR_H
#define __STM32F2xx_PWR_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -149,7 +149,7 @@ void PWR_EnterSTANDBYMode(void);
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
void PWR_ClearFlag(uint32_t PWR_FLAG);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -29,7 +29,7 @@
#ifndef __STM32F2xx_RCC_H
#define __STM32F2xx_RCC_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -498,7 +498,7 @@ void RCC_ClearFlag(void);
ITStatus RCC_GetITStatus(uint8_t RCC_IT);
void RCC_ClearITPendingBit(uint8_t RCC_IT);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_RTC_H
#define __STM32F2xx_RTC_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -633,7 +633,7 @@ void RTC_ClearFlag(uint32_t RTC_FLAG);
ITStatus RTC_GetITStatus(uint32_t RTC_IT);
void RTC_ClearITPendingBit(uint32_t RTC_IT);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_SPI_H
#define __STM32F2xx_SPI_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -509,7 +509,7 @@ void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -30,7 +30,7 @@
#ifndef __STM32F2xx_USART_H
#define __STM32F2xx_USART_H
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -412,7 +412,7 @@ void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG);
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT);
void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
+2 -2
View File
@@ -11,7 +11,7 @@
#ifndef _ASPI_H_
#define _ASPI_H_
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -37,7 +37,7 @@ extern "C" {
void AspiCmd(u8 Command_Byte);
void AspiData(u8 Para_data);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
+1 -1
View File
@@ -139,7 +139,7 @@ void audioEnd()
NVIC_DisableIRQ(DMA1_Stream5_IRQn) ;
}
#ifndef SIMU
#if !defined(SIMU)
extern "C" void TIM6_DAC_IRQHandler()
{
DAC->CR &= ~DAC_CR_DMAEN1 ; // Stop DMA requests
+5 -1
View File
@@ -36,11 +36,15 @@
#include "../../opentx.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h"
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
@@ -111,13 +115,13 @@ void interrupt5ms()
#endif
}
#if !defined(SIMU)
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
{
TIM14->SR &= ~TIM_SR_UIF ;
interrupt5ms() ;
}
#if !defined(SIMU)
void boardInit()
{
pwrInit();
+4 -4
View File
@@ -39,7 +39,7 @@
#include "stddef.h"
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -65,7 +65,7 @@ extern "C" {
#include "aspi.h"
#include "i2c.h"
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -197,7 +197,7 @@ extern volatile uint16_t Analog_values[];
#define BATT_SCALE 150
#endif
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -234,7 +234,7 @@ void usbStart(void);
void usbStop(void);
#endif
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
@@ -36,11 +36,15 @@
#include "../../opentx.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h"
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
void configure_pins( uint32_t pins, uint16_t config )
{
+2 -2
View File
@@ -33,7 +33,7 @@
#define WP_H do{I2C_EE_WP_GPIO->BSRRL = I2C_EE_WP;}while(0)
#define WP_L do{I2C_EE_WP_GPIO->BSRRH = I2C_EE_WP;}while(0)
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
@@ -48,7 +48,7 @@ void I2C_EE_WaitEepromStandbyState(void);
void I2C_set_volume(register uint8_t volume);
uint8_t I2C_read_volume(void);
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
+5 -2
View File
@@ -335,6 +335,7 @@ static void disable_pa10_ppm()
INTERNAL_RF_OFF();
}
#if !defined(SIMU)
extern "C" void TIM1_CC_IRQHandler()
{
TIM1->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
@@ -372,8 +373,9 @@ extern "C" void TIM1_UP_TIM10_IRQHandler()
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
}
}
#endif
static void init_pa7_pxx()
void init_pa7_pxx()
{
EXTERNAL_MODULE_ON();
@@ -584,6 +586,7 @@ static void disable_pa7_ppm()
}
}
#if !defined(SIMU)
extern "C" void TIM8_CC_IRQHandler()
{
TIM8->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
@@ -630,4 +633,4 @@ extern "C" void TIM8_UP_TIM13_IRQHandler()
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
}
}
#endif
+1 -1
View File
@@ -34,7 +34,7 @@
*
*/
#include "../opentx.h"
#include "../../opentx.h"
void rotencInit()
{
@@ -109,6 +109,7 @@ void stop_trainer_capture()
NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt
}
#if !defined(SIMU)
extern "C" void TIM3_IRQHandler()
{
uint16_t capture = 0;
@@ -176,6 +177,7 @@ extern "C" void TIM3_IRQHandler()
}
}
}
#endif
void init_cppm_on_heartbeat_capture(void)
{
@@ -253,6 +255,7 @@ void stop_sbus_on_heartbeat_capture(void)
}
}
#if !defined(SIMU)
extern "C" void USART6_IRQHandler()
{
uint32_t status;
@@ -269,3 +272,4 @@ extern "C" void USART6_IRQHandler()
status = USART6->SR;
}
}
#endif
@@ -128,6 +128,7 @@ void uart3Stop()
USART_DeInit(USART3);
}
#if !defined(SIMU)
extern "C" void USART3_IRQHandler(void)
{
// Send
@@ -161,4 +162,5 @@ extern "C" void USART3_IRQHandler(void)
status = USART3->SR;
}
}
#endif
@@ -30,7 +30,9 @@
#include "../../FatFs/diskio.h"
#include "board_taranis.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
#endif
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h"
#include "usbd_msc_mem.h"
#include "usb_conf.h"
@@ -118,7 +120,10 @@ USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops =
USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops;
__IO uint32_t count = 0;
#if defined(__cplusplus) && !defined(SIMU)
}
#endif
int8_t STORAGE_Init (uint8_t lun)
{
+4 -1
View File
@@ -427,7 +427,10 @@
#define LEN_VSWITCHES "\003"
#define LEN_VSRCRAW "\004"
#if defined(PCBTARANIS)
#if defined(PCBTARANIS) && defined(REV9E)
#define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""S3\0 ""LS\0 ""RS\0 "
#define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 ""SI\0 ""SJ\0 ""SK\0 ""SL\0 ""SM\0 ""SN\0 ""SO\0 ""SP\0 ""SQ\0 ""SR\0 "
#elif defined(PCBTARANIS)
#define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""S3\0 ""LS\0 ""RS\0 "
#define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 ""SI\0 ""SJ\0 ""SK\0 ""SL\0 ""SM\0 ""SN\0 "
#elif defined(EXTRA_3POS)