Make PCB args are now SKY9X and GRUVIN9X instead of ARM and V4
[sky9x] Temperature calibration [sky9x] RTC modifications
This commit is contained in:
@@ -859,7 +859,7 @@ int main(int argc, char **argv)
|
||||
pMailbox->argument.outputInit.bufferSize = bufferSize;
|
||||
pMailbox->argument.outputInit.memorySize = 128*128 ;
|
||||
// TRACE_INFO("%s blockSize : 0x%lx bufferAddr : 0x%lx\n\r",
|
||||
// "ersky9x", blockSize, pMailbox->argument.outputInit.bufferAddress);
|
||||
// "sky9x", blockSize, pMailbox->argument.outputInit.bufferAddress);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -688,7 +688,7 @@ int main(int argc, char **argv)
|
||||
pMailbox->argument.outputInit.bufferSize = bufferSize;
|
||||
pMailbox->argument.outputInit.memorySize = 128*4096;
|
||||
// TRACE_INFO("%s blockSize : 0x%lx bufferAddr : 0x%lx\n\r",
|
||||
// "ersky9x", blockSize, pMailbox->argument.outputInit.bufferAddress);
|
||||
// "sky9x", blockSize, pMailbox->argument.outputInit.bufferAddress);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
#define BOARD_MAINOSC 12000000
|
||||
|
||||
/** Master clock frequency (when using board_lowlevel.c) */
|
||||
#define BOARD_MCK 64000000
|
||||
// #define BOARD_MCK 64000000
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
||||
+4
-4
@@ -9,7 +9,7 @@
|
||||
#ifndef _FFCONF
|
||||
#define _FFCONF 6502 /* Revision ID */
|
||||
|
||||
#if defined(PCBARM) && !defined(SIMU)
|
||||
#if defined(PCBSKY9X) && !defined(SIMU)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -98,7 +98,7 @@ extern "C" {
|
||||
/ 1 - ASCII only (Valid for non LFN cfg.)
|
||||
*/
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define _USE_LFN 2 /* 0 to 3 */
|
||||
#else
|
||||
#define _USE_LFN 1 /* 0 to 3 */
|
||||
@@ -182,7 +182,7 @@ extern "C" {
|
||||
/* A header file that defines sync object types on the O/S, such as
|
||||
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
|
||||
#else
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
@@ -197,7 +197,7 @@ extern "C" {
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define _FS_SHARE 3 /* 0:Disable or >=1:Enable */
|
||||
#else
|
||||
#define _FS_SHARE 2 /* 0:Disable or >=1:Enable */
|
||||
|
||||
+46
-46
@@ -50,7 +50,7 @@ DELAY = 5
|
||||
#----------- BUILD OPTIONS ---------------------------
|
||||
|
||||
# PCB version
|
||||
# Values: STD, STD128, V4, ARM, X9D
|
||||
# Values: STD, STD128, GRUVIN9X, SKY9X, X9D
|
||||
PCB = STD
|
||||
|
||||
# PCB revision
|
||||
@@ -178,7 +178,7 @@ UNITS = METRIC
|
||||
# Values = YES, NO
|
||||
EEPROM_PROGRESS_BAR = NO
|
||||
|
||||
# Enable extra rotary encoders (V4 board only)
|
||||
# Enable extra rotary encoders (Gruvin9x board only)
|
||||
# Values = YES, NO
|
||||
EXTRA_ROTARY_ENCODERS = NO
|
||||
|
||||
@@ -220,7 +220,7 @@ ifeq ($(PCB), STD128)
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), V4)
|
||||
ifeq ($(PCB), GRUVIN9X)
|
||||
ifeq ($(PCBREV), REV0)
|
||||
CPPDEFS += -DREV0
|
||||
else
|
||||
@@ -231,13 +231,13 @@ ifeq ($(PCB), V4)
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), ARM)
|
||||
ifeq ($(PCB), SKY9X)
|
||||
ifeq ($(PCBREV), REVA)
|
||||
CPPDEFS += -DREVA
|
||||
LDSCRIPT = ersky9x/sam3s2c_flash.ld
|
||||
LDSCRIPT = sky9x/sam3s2c_flash.ld
|
||||
else
|
||||
CPPDEFS += -DREVB
|
||||
LDSCRIPT = ersky9x/sam3s4c_flash.ld
|
||||
LDSCRIPT = sky9x/sam3s4c_flash.ld
|
||||
endif
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m3
|
||||
@@ -245,7 +245,7 @@ endif
|
||||
|
||||
ifeq ($(PCB), X9D)
|
||||
CPPDEFS += -DREVB
|
||||
LDSCRIPT = ersky9x/sam3s4c_flash.ld
|
||||
LDSCRIPT = sky9x/sam3s4c_flash.ld
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m4
|
||||
endif
|
||||
@@ -430,76 +430,76 @@ RUN_FROM_FLASH = 1
|
||||
ifeq ($(PCB), X9D)
|
||||
# X9D, so ...
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBX9D -DPCBARM -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS += ersky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = board_ersky9x.cpp
|
||||
SRC += ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c
|
||||
CPPDEFS += -DPCBX9D -DPCBSKY9X -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = board_sky9x.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
|
||||
SRC += ersky9x/usb/device/core/USBD_UDP.c ersky9x/usb/device/core/USBDDriver.c ersky9x/usb/device/core/USBDCallbacks.c
|
||||
SRC += ersky9x/usb/device/massstorage/MSDDriver.c ersky9x/usb/device/massstorage/MSDDStateMachine.c ersky9x/usb/device/massstorage/MSDLun.c ersky9x/usb/device/massstorage/MSDDriverDescriptors.c ersky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += ersky9x/usb/common/core/USBEndpointDescriptor.c ersky9x/usb/common/core/USBGenericRequest.c ersky9x/usb/common/core/USBFeatureRequest.c ersky9x/usb/common/core/USBInterfaceRequest.c ersky9x/usb/common/core/USBGetDescriptorRequest.c ersky9x/usb/common/core/USBSetAddressRequest.c ersky9x/usb/common/core/USBSetConfigurationRequest.c ersky9x/usb/common/core/USBConfigurationDescriptor.c ersky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += ersky9x/syscalls.c
|
||||
SRC += ersky9x/MEDSdcard.c
|
||||
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
||||
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += sky9x/syscalls.c
|
||||
SRC += sky9x/MEDSdcard.c
|
||||
EEPROMSRC = eeprom_arm.cpp
|
||||
PULSESSRC = pulses_arm.cpp
|
||||
CPPSRC += ersky9x/audio.cpp haptic.cpp
|
||||
CPPSRC += ersky9x/sound_driver.cpp ersky9x/haptic_driver.cpp ersky9x/sdcard_driver.cpp
|
||||
CPPSRC += sky9x/audio.cpp haptic.cpp
|
||||
CPPSRC += sky9x/sound_driver.cpp sky9x/haptic_driver.cpp sky9x/sdcard_driver.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c
|
||||
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c sky9x/diskio.c
|
||||
CPPDEFS += -DVOICE
|
||||
endif
|
||||
|
||||
ifeq ($(BLUETOOTH), YES)
|
||||
MODS:=${MODS}S
|
||||
CPPDEFS += -DBLUETOOTH
|
||||
CPPSRC += ersky9x/bluetooth.cpp
|
||||
CPPSRC += sky9x/bluetooth.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += ersky9x/debug.cpp
|
||||
CPPSRC += sky9x/debug.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), ARM)
|
||||
# ARM, so ...
|
||||
ifeq ($(PCB), SKY9X)
|
||||
# SKY9X, so ...
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBARM -DAUDIO -DHAPTIC -DRTCLOCK -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS += ersky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = board_ersky9x.cpp
|
||||
SRC += ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c
|
||||
CPPDEFS += -DPCBSKY9X -DAUDIO -DHAPTIC -DRTCLOCK -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS += sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = board_sky9x.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
|
||||
SRC += ersky9x/usb/device/core/USBD_UDP.c ersky9x/usb/device/core/USBDDriver.c ersky9x/usb/device/core/USBDCallbacks.c
|
||||
SRC += ersky9x/usb/device/massstorage/MSDDriver.c ersky9x/usb/device/massstorage/MSDDStateMachine.c ersky9x/usb/device/massstorage/MSDLun.c ersky9x/usb/device/massstorage/MSDDriverDescriptors.c ersky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += ersky9x/usb/common/core/USBEndpointDescriptor.c ersky9x/usb/common/core/USBGenericRequest.c ersky9x/usb/common/core/USBFeatureRequest.c ersky9x/usb/common/core/USBInterfaceRequest.c ersky9x/usb/common/core/USBGetDescriptorRequest.c ersky9x/usb/common/core/USBSetAddressRequest.c ersky9x/usb/common/core/USBSetConfigurationRequest.c ersky9x/usb/common/core/USBConfigurationDescriptor.c ersky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += ersky9x/syscalls.c
|
||||
SRC += ersky9x/MEDSdcard.c
|
||||
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
||||
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += sky9x/syscalls.c
|
||||
SRC += sky9x/MEDSdcard.c
|
||||
EEPROMSRC = eeprom_arm.cpp
|
||||
PULSESSRC = pulses_arm.cpp
|
||||
CPPSRC += rtc.cpp ersky9x/rtc_driver.cpp
|
||||
CPPSRC += ersky9x/audio.cpp haptic.cpp
|
||||
CPPSRC += ersky9x/sound_driver.cpp ersky9x/haptic_driver.cpp ersky9x/sdcard_driver.cpp ersky9x/massstorage.cpp
|
||||
CPPSRC += rtc.cpp sky9x/rtc_driver.cpp
|
||||
CPPSRC += sky9x/audio.cpp haptic.cpp
|
||||
CPPSRC += sky9x/sound_driver.cpp sky9x/haptic_driver.cpp sky9x/sdcard_driver.cpp sky9x/massstorage.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c
|
||||
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c sky9x/diskio.c
|
||||
CPPDEFS += -DVOICE
|
||||
endif
|
||||
|
||||
ifeq ($(BLUETOOTH), YES)
|
||||
MODS:=${MODS}S
|
||||
CPPDEFS += -DBLUETOOTH
|
||||
CPPSRC += ersky9x/bluetooth.cpp
|
||||
CPPSRC += sky9x/bluetooth.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += ersky9x/debug.cpp
|
||||
CPPSRC += sky9x/debug.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PCB), V4)
|
||||
# V4 PCB, so ...
|
||||
ifeq ($(PCB), GRUVIN9X)
|
||||
# Gruvin9x PCB, so ...
|
||||
OPT = 2
|
||||
CPPDEFS += -DPCBV4 -DAUDIO -DHAPTIC -DROTARY_ENCODERS=2
|
||||
CPPDEFS += -DPCBGRUVIN9X -DAUDIO -DHAPTIC -DROTARY_ENCODERS=2
|
||||
EXTRAINCDIRS += gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC += board_gruvin9x.cpp
|
||||
EEPROMSRC = eeprom_avr.cpp
|
||||
@@ -693,7 +693,7 @@ MSG_CLEANING = Cleaning project:
|
||||
ARMCPPFLAGS = -c -mcpu=$(MCU) -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=open9x.lst -Dat91sam3s4 -DRUN_FROM_FLASH=1 $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
AVRCPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -fwhole-program
|
||||
|
||||
ifneq ($(PCB), ARM)
|
||||
ifneq ($(PCB), SKY9X)
|
||||
GCCVERSIONGTE462 := $(shell expr 4.6.2 \<= `$(CC) -dumpversion`)
|
||||
ifeq ($(GCCVERSIONGTE462),1)
|
||||
CPPFLAGS += -flto
|
||||
@@ -714,7 +714,7 @@ MIN_VER = ${shell sh -c "grep \"MIN_VERS\" open9x.h | cut -d\ -f3"}
|
||||
all: begin gccversion sizebefore build sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
ifeq ($(PCB), ARM)
|
||||
ifeq ($(PCB), SKY9X)
|
||||
build: stamp_header font.lbm font_dblsize.lbm sticks.lbm s9xsplash.lbm asterisk.lbm allsrc.cpp elf remallsrc bin hex lss
|
||||
else
|
||||
build: stamp_header font.lbm font_dblsize.lbm sticks.lbm s9xsplash.lbm asterisk.lbm allsrc.cpp elf remallsrc hex eep lss sym
|
||||
@@ -806,7 +806,7 @@ end:
|
||||
@echo
|
||||
|
||||
# Display size of file.
|
||||
ifeq ($(PCB), ARM)
|
||||
ifeq ($(PCB), SKY9X)
|
||||
ELFSIZE = $(SIZE) $(TARGET).elf
|
||||
else
|
||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
|
||||
@@ -842,7 +842,7 @@ eeprom.bin:
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
ifeq ($(PCB), ARM)
|
||||
ifeq ($(PCB), SKY9X)
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
@@ -886,7 +886,7 @@ remallsrc:
|
||||
$(REMOVE) allsrc.cpp
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
ifeq ($(PCB), ARM)
|
||||
ifeq ($(PCB), SKY9X)
|
||||
%.o: %.c
|
||||
$(CC) $(ARMCPPFLAGS) $< -o $@
|
||||
OBJS = $(SRC:.c=.o)
|
||||
|
||||
+3
-3
@@ -44,8 +44,8 @@ extern bool warbleC;
|
||||
extern uint8_t hapticTick;
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#include "ersky9x/sound.h"
|
||||
#if defined(PCBSKY9X)
|
||||
#include "sky9x/sound.h"
|
||||
inline void _beep(uint8_t b) {
|
||||
buzzer_sound(b);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ extern void beep(uint8_t val);
|
||||
|
||||
#define IS_AUDIO_BUSY() (g_beepCnt || beepAgain || beepOn)
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
FORCEINLINE void AUDIO_HEARTBEAT()
|
||||
{
|
||||
if(g_beepCnt) {
|
||||
|
||||
@@ -72,11 +72,6 @@ inline void board_init()
|
||||
TCCR0B = (1<<WGM02) | (0b011 << CS00);
|
||||
TCCR0A = (0b01<<WGM00);
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
// Initialise global unix timestamp with current time from RTC chip on SD card interface
|
||||
rtc_init();
|
||||
#endif
|
||||
|
||||
/***************************************************/
|
||||
/* Rotary encoder interrupt set-up (V4 board only) */
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include "open9x.h"
|
||||
#include "ersky9x/board.h"
|
||||
#include "sky9x/board.h"
|
||||
|
||||
uint32_t Master_frequency ;
|
||||
volatile uint32_t Tenms ;
|
||||
@@ -792,8 +792,6 @@ void board_init()
|
||||
|
||||
alawInit();
|
||||
|
||||
rtc_init();
|
||||
|
||||
eeprom_init();
|
||||
|
||||
init_rotary_encoder();
|
||||
@@ -998,8 +996,8 @@ extern uint32_t keyState(EnumKeys enuk)
|
||||
}
|
||||
|
||||
uint16_t Analog_values[NUMBER_ANALOG] ;
|
||||
uint8_t temperature ; // Raw temp reading
|
||||
uint8_t maxTemperature ; // Raw temp reading
|
||||
uint8_t temperature = 0; // Raw temp reading
|
||||
uint8_t maxTemperature = 0 ; // Raw temp reading
|
||||
|
||||
// Read 8 (9 for REVB) ADC channels
|
||||
// Documented bug, must do them 1 by 1
|
||||
@@ -1037,7 +1035,7 @@ void read_9_adc()
|
||||
#endif
|
||||
|
||||
temperature = (((int32_t)temperature * 7) + ((((int32_t)ADC->ADC_CDR15 - 838) * 621) >> 11)) >> 3; // Filter it
|
||||
if (temperature > maxTemperature) {
|
||||
if (temperature < 200 && temperature > maxTemperature) {
|
||||
maxTemperature = temperature;
|
||||
}
|
||||
}
|
||||
@@ -1229,3 +1227,9 @@ uint16_t getCurrent()
|
||||
return (current_scale * Current) / 8192;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t getTemperature()
|
||||
{
|
||||
return temperature + g_eeGeneral.temperatureCalib;
|
||||
}
|
||||
|
||||
@@ -31,17 +31,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef board_ersky9x_h
|
||||
#define board_ersky9x_h
|
||||
#ifndef board_sky9x_h
|
||||
#define board_sky9x_h
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ersky9x/board.h"
|
||||
#include "ersky9x/sound_driver.h"
|
||||
#include "ersky9x/haptic_driver.h"
|
||||
#include "ersky9x/debug.h"
|
||||
#include "sky9x/board.h"
|
||||
#include "sky9x/sound_driver.h"
|
||||
#include "sky9x/haptic_driver.h"
|
||||
#include "sky9x/debug.h"
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#include "ersky9x/bluetooth.h"
|
||||
#include "sky9x/bluetooth.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
@@ -78,6 +78,7 @@ uint16_t getCurrent();
|
||||
|
||||
extern uint8_t temperature ; // Raw temp reading
|
||||
extern uint8_t maxTemperature ; // Raw temp reading
|
||||
uint8_t getTemperature();
|
||||
|
||||
#define strcpy_P strcpy
|
||||
#define strcat_P strcat
|
||||
+5
-13
@@ -63,7 +63,7 @@ uint8_t getEvent(bool trim)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define KEY_LONG_DELAY 32
|
||||
#else
|
||||
#define KEY_LONG_DELAY 24
|
||||
@@ -157,33 +157,25 @@ void per10ms()
|
||||
if (s_noHi) s_noHi--;
|
||||
if (trimsCheckTimer) trimsCheckTimer --;
|
||||
|
||||
#if defined (PCBARM)
|
||||
#if defined (PCBSKY9X)
|
||||
Tenms |= 1 ; // 10 mS has passed
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
/* Update gloabal Date/Time every 100 per10ms cycles */
|
||||
/* Update global Date/Time every 100 per10ms cycles */
|
||||
if (++g_ms100 == 100) {
|
||||
#if defined(PCBARM)
|
||||
if (g_rtcTime!=0) {
|
||||
g_rtcTime++; // inc global unix timestamp one second
|
||||
} else {
|
||||
rtc_init(); // try to get a valid time from the coprocessor
|
||||
}
|
||||
#else
|
||||
g_rtcTime++; // inc global unix timestamp one second
|
||||
#endif
|
||||
g_ms100 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
readKeysAndTrims();
|
||||
|
||||
#if defined(MAVLINK) && !defined(PCBARM)
|
||||
#if defined(MAVLINK) && !defined(PCBSKY9X)
|
||||
check_mavlink();
|
||||
#endif
|
||||
|
||||
#if defined (FRSKY) && !defined(PCBARM) && !defined(AUDIO) && !defined(VOICE)
|
||||
#if defined (FRSKY) && !defined(PCBSKY9X) && !defined(AUDIO) && !defined(VOICE)
|
||||
check_frsky();
|
||||
#endif
|
||||
|
||||
|
||||
+5
-5
@@ -60,7 +60,7 @@ inline void eeprom_write_byte()
|
||||
{
|
||||
EEAR = eeprom_pointer;
|
||||
EEDR = *eeprom_buffer_data;
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
EECR |= 1<<EEMPE;
|
||||
EECR |= 1<<EEPE;
|
||||
#else
|
||||
@@ -77,7 +77,7 @@ ISR(EE_READY_vect)
|
||||
eeprom_write_byte();
|
||||
}
|
||||
else {
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
EECR &= ~(1<<EERIE);
|
||||
#else
|
||||
EECR &= ~(1<<EERIE);
|
||||
@@ -97,9 +97,9 @@ void eeWriteBlockCmp(const void *i_pointer_ram, uint16_t i_pointer_eeprom, size_
|
||||
|
||||
#ifdef SIMU
|
||||
sem_post(eeprom_write_sem);
|
||||
#elif defined (PCBARM)
|
||||
#elif defined (PCBSKY9X)
|
||||
|
||||
#elif defined (PCBV4)
|
||||
#elif defined (PCBGRUVIN9X)
|
||||
EECR |= (1<<EERIE);
|
||||
#else
|
||||
EECR |= (1<<EERIE);
|
||||
@@ -884,7 +884,7 @@ void eeLoadModel(uint8_t id)
|
||||
resetProto();
|
||||
resetAll();
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
for (uint8_t i=0; i<MAX_TIMERS; i++) {
|
||||
if (g_model.timersXtra[i].remanent) {
|
||||
s_timerVal[i] = g_model.timersXtra[i].value;
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(PCBV4) && !defined(REV0)
|
||||
#if defined(PCBGRUVIN9X) && !defined(REV0)
|
||||
#define WRITE_DELAY_10MS 500
|
||||
#else
|
||||
#define WRITE_DELAY_10MS 200
|
||||
@@ -47,7 +47,7 @@ extern uint16_t s_eeDirtyTime10ms;
|
||||
// bs=16 128 blocks verlust link:128 16files:16*8 128 sum 256
|
||||
// bs=32 64 blocks verlust link: 64 16files:16*16 256 sum 320
|
||||
//
|
||||
#if defined(PCBV4) || defined(M128)
|
||||
#if defined(PCBGRUVIN9X) || defined(M128)
|
||||
#define EESIZE 4096
|
||||
#define EEFS_VERS 5
|
||||
#define MAXFILES 36
|
||||
@@ -84,7 +84,7 @@ PACK(struct EeFs{
|
||||
|
||||
#define RESV sizeof(EeFs) //reserv for eeprom header with directory (eeFs)
|
||||
|
||||
#if defined(PCBV4) || defined(M128)
|
||||
#if defined(PCBGRUVIN9X) || defined(M128)
|
||||
#define FIRSTBLK 1
|
||||
#define BLOCKS (1+(EESIZE-RESV)/BS)
|
||||
#define BLOCKS_OFFSET (RESV-BS)
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "USBDCallbacks.h"
|
||||
#include "USBD.h"
|
||||
#include <board.h>
|
||||
#include <core_cm3.h>
|
||||
|
||||
void USBDCallbacks_Initialized(void)
|
||||
{
|
||||
NVIC_EnableIRQ(UDP_IRQn);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void USBDCallbacks_RequestReceived(const USBGenericRequest *pRequest)
|
||||
{
|
||||
// Does nothing
|
||||
}
|
||||
#endif
|
||||
|
||||
void USBDCallbacks_Reset(void)
|
||||
{
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
void USBDCallbacks_Resumed(void)
|
||||
{
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
void USBDCallbacks_Suspended(void)
|
||||
{
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
#if 0
|
||||
void USBDDriverCallbacks_ConfigurationChanged(unsigned char cfgnum)
|
||||
{
|
||||
TRACE_INFO_WP("ConfigurationChanged ");
|
||||
}
|
||||
#endif
|
||||
|
||||
void USBDDriverCallbacks_InterfaceSettingChanged(
|
||||
unsigned char interface,
|
||||
unsigned char setting)
|
||||
{
|
||||
// TRACE_INFO_WP("InterfaceSettingChanged ");
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definitions of callbacks used by the USBD API to notify the user
|
||||
application of incoming events. These functions are declared as 'weak',
|
||||
so they can be re-implemented elsewhere in the application in a
|
||||
transparent way.
|
||||
*/
|
||||
|
||||
#ifndef USBDCALLBACKS_H
|
||||
#define USBDCALLBACKS_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <usb/common/core/USBGenericRequest.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern void USBDCallbacks_Initialized(void);
|
||||
|
||||
extern void USBDCallbacks_Reset(void);
|
||||
|
||||
extern void USBDCallbacks_Suspended(void);
|
||||
|
||||
extern void USBDCallbacks_Resumed(void);
|
||||
|
||||
extern void USBDCallbacks_RequestReceived(const USBGenericRequest *request);
|
||||
|
||||
#endif //#ifndef USBDCALLBACKS_H
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of several callbacks which are triggered by the USB software
|
||||
driver after receiving specific requests.
|
||||
|
||||
!!!Usage
|
||||
|
||||
-# Re-implement the USBDDriverCallbacks_ConfigurationChanged
|
||||
callback to know when the hosts changes the active configuration of
|
||||
the device.
|
||||
-# Re-implement the USBDDriverCallbacks_InterfaceSettingChanged
|
||||
callback to get notified whenever the active setting of an interface
|
||||
is changed by the host.
|
||||
*/
|
||||
|
||||
#ifndef USBDDRIVERCALLBACKS_H
|
||||
#define USBDDRIVERCALLBACKS_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern void USBDDriverCallbacks_ConfigurationChanged(unsigned char cfgnum);
|
||||
|
||||
extern void USBDDriverCallbacks_InterfaceSettingChanged(unsigned char interface,
|
||||
unsigned char setting);
|
||||
|
||||
#endif //#ifndef USBDDRIVERCALLBACKS_H
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "MSDIOFifo.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Internal variables
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//! \brief Initializes a MSDIOFifo instance.
|
||||
//! \param pFifo Pointer to the MSDIOFifo instance to initialize
|
||||
//! \param pBuffer Pointer to a buffer used for read/write operation and
|
||||
//! which must be blockSize bytes aligned.
|
||||
//! \param bufferSize Total size of the buffer in bytes
|
||||
//------------------------------------------------------------------------------
|
||||
void MSDIOFifo_Init(MSDIOFifo *pFifo,
|
||||
void * pBuffer, unsigned short bufferSize)
|
||||
{
|
||||
pFifo->pBuffer = pBuffer;
|
||||
pFifo->bufferSize = bufferSize;
|
||||
|
||||
pFifo->inputNdx = 0;
|
||||
pFifo->outputNdx = 0;
|
||||
pFifo->inputTotal = 0;
|
||||
pFifo->outputTotal = 0;
|
||||
|
||||
pFifo->inputState = MSDIO_IDLE;
|
||||
pFifo->outputState = MSDIO_IDLE;
|
||||
|
||||
pFifo->fullCnt = 0;
|
||||
pFifo->nullCnt = 0;
|
||||
}
|
||||
+10
-10
@@ -52,7 +52,7 @@
|
||||
|
||||
uint8_t frskyRxBuffer[FRSKY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
||||
uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE]; // Ditto for transmit buffer
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
uint8_t frskyTxBufferCount = 0;
|
||||
#endif
|
||||
uint8_t FrskyRxBufferReady = 0;
|
||||
@@ -428,7 +428,7 @@ void processFrskyPacket(uint8_t *packet)
|
||||
a second buffer to receive data while one buffer is being processed (slowly).
|
||||
*/
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
void processSerialData(uint8_t data)
|
||||
#else
|
||||
NOINLINE void processSerialData(uint8_t stat, uint8_t data)
|
||||
@@ -442,7 +442,7 @@ NOINLINE void processSerialData(uint8_t stat, uint8_t data)
|
||||
btPushByte(data);
|
||||
#endif
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
if (stat & ((1 << FE0) | (1 << DOR0) | (1 << UPE0))) {
|
||||
// discard buffer and start fresh on any comms error
|
||||
FrskyRxBufferReady = 0;
|
||||
@@ -498,7 +498,7 @@ NOINLINE void processSerialData(uint8_t stat, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(PCBARM) && !defined(SIMU)
|
||||
#if !defined(PCBSKY9X) && !defined(SIMU)
|
||||
ISR(USART0_RX_vect)
|
||||
{
|
||||
uint8_t stat;
|
||||
@@ -549,7 +549,7 @@ ISR(USART0_RX_vect)
|
||||
#endif
|
||||
|
||||
/******************************************/
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
void frskyTransmitBuffer( uint32_t size )
|
||||
{
|
||||
txPdcUsart( frskyTxBuffer, size ) ;
|
||||
@@ -564,7 +564,7 @@ void frskyTransmitBuffer()
|
||||
|
||||
uint8_t frskyAlarmsSendState = 0 ;
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
void frskyPushValue(uint8_t *&ptr, uint8_t value)
|
||||
{
|
||||
// byte stuff the only byte than might need it
|
||||
@@ -678,7 +678,7 @@ inline void FRSKY10mspoll(void)
|
||||
|
||||
NOINLINE void check_frsky()
|
||||
{
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
rxPdcUsart(processSerialData); // Receive serial data here
|
||||
#endif
|
||||
|
||||
@@ -826,7 +826,7 @@ bool FRSKY_alarmRaised(uint8_t idx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
inline void FRSKY_EnableTXD(void)
|
||||
{
|
||||
frskyTxBufferCount = 0;
|
||||
@@ -845,7 +845,7 @@ void FRSKY_Init(void)
|
||||
// clear frsky variables
|
||||
resetTelemetry();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
startPdcUsartReceive() ;
|
||||
#elif !defined(SIMU)
|
||||
|
||||
@@ -1177,7 +1177,7 @@ void displayGpsCoord(uint8_t y, char direction, int16_t bp, int16_t ap)
|
||||
|
||||
uint8_t getTelemCustomField(uint8_t line, uint8_t col)
|
||||
{
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
return g_model.frsky.lines[2*line+col];
|
||||
#else
|
||||
uint8_t result = (col==0 ? (g_model.frsky.lines[line] & 0x0f) : ((g_model.frsky.lines[line] & 0xf0) / 16));
|
||||
|
||||
+40
-27
@@ -46,7 +46,7 @@ enum EnumTabDiag {
|
||||
e_Vers,
|
||||
e_Keys,
|
||||
e_Ana,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
e_Hardware,
|
||||
#endif
|
||||
e_Calib
|
||||
@@ -72,7 +72,7 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
|
||||
menuProcDiagVers,
|
||||
menuProcDiagKeys,
|
||||
menuProcDiagAna,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
menuProcHardware,
|
||||
#endif
|
||||
menuProcDiagCalib
|
||||
@@ -114,12 +114,12 @@ enum menuProcSetupItems {
|
||||
ITEM_SETUP_HAPTIC_LENGTH,
|
||||
ITEM_SETUP_HAPTIC_STRENGTH,
|
||||
#endif
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
ITEM_SETUP_BRIGHTNESS,
|
||||
#endif
|
||||
ITEM_SETUP_CONTRAST,
|
||||
ITEM_SETUP_BATTERY_WARNING,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
ITEM_SETUP_CAPACITY_WARNING,
|
||||
ITEM_SETUP_TEMPERATURE_WARNING,
|
||||
#endif
|
||||
@@ -184,7 +184,7 @@ void menuProcSetup(uint8_t event)
|
||||
#else
|
||||
#define FRSKY_ZEROS
|
||||
#endif
|
||||
#ifdef PCBARM
|
||||
#ifdef PCBSKY9X
|
||||
#define ARM_ZEROS 0, 0, 0,
|
||||
#else
|
||||
#define ARM_ZEROS
|
||||
@@ -291,7 +291,7 @@ void menuProcSetup(uint8_t event)
|
||||
case ITEM_SETUP_SPEAKER_VOLUME:
|
||||
{
|
||||
lcd_putsLeft(y, STR_SPEAKER_VOLUME);
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, g_eeGeneral.speakerVolume, attr|LEFT);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerVolume, 0, NUM_VOL_LEVELS-1);
|
||||
@@ -330,7 +330,7 @@ void menuProcSetup(uint8_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcd_putsLeft(y, STR_BRIGHTNESS);
|
||||
lcd_outdezAtt(GENERAL_PARAM_OFS, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
@@ -358,7 +358,7 @@ void menuProcSetup(uint8_t event)
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
|
||||
break;
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_SETUP_CAPACITY_WARNING:
|
||||
lcd_putsLeft(y, STR_CAPAWARNING);
|
||||
putsTelemetryValue(GENERAL_PARAM_OFS, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ;
|
||||
@@ -367,8 +367,8 @@ void menuProcSetup(uint8_t event)
|
||||
|
||||
case ITEM_SETUP_TEMPERATURE_WARNING:
|
||||
lcd_putsLeft(y, STR_TEMPWARNING);
|
||||
putsTelemetryValue(GENERAL_PARAM_OFS, y, 80+g_eeGeneral.temperatureWarn, UNIT_DEGREES, attr|LEFT) ;
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, -80, 40); // 0-120degrees
|
||||
putsTelemetryValue(GENERAL_PARAM_OFS, y, g_eeGeneral.temperatureWarn, UNIT_DEGREES, attr|LEFT) ;
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, 0, 120); // 0 means no alarm
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -496,7 +496,7 @@ void menuProcSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
extern uint32_t sdAvailableAudioFiles; // TODO move that!
|
||||
#endif
|
||||
|
||||
@@ -587,7 +587,7 @@ void menuProcSd(uint8_t event)
|
||||
s_menu[s_menu_count++] = STR_SD_FORMAT;
|
||||
}
|
||||
else {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
char * line = reusableBuffer.sd.lines[index];
|
||||
if (!strcmp(line+strlen(line)-4, SOUNDS_EXT)) {
|
||||
@@ -727,7 +727,7 @@ void menuProcSd(uint8_t event)
|
||||
else if (result == STR_SD_FORMAT) {
|
||||
displayPopup(PSTR("Formatting...")); // TODO translations
|
||||
if (f_mkfs(0, 1, 0) == FR_OK) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
sdAvailableAudioFiles = 0;
|
||||
#endif
|
||||
f_chdir("/");
|
||||
@@ -748,7 +748,7 @@ void menuProcSd(uint8_t event)
|
||||
if ((uint16_t)m_posVert == reusableBuffer.sd.count) m_posVert--;
|
||||
reusableBuffer.sd.offset = s_pgOfs-1;
|
||||
}
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
f_getcwd(lfn, SD_SCREEN_FILE_LENGTH);
|
||||
strcat(lfn, "/");
|
||||
@@ -891,7 +891,9 @@ void menuProcDiagKeys(uint8_t event)
|
||||
|
||||
void menuProcDiagAna(uint8_t event)
|
||||
{
|
||||
#if defined(PCBARM) && defined(REVB)
|
||||
#if defined(PCBSKY9X) && defined(REVB)
|
||||
#define ANAS_ITEMS_COUNT 4
|
||||
#elif defined(PCBSKY9X)
|
||||
#define ANAS_ITEMS_COUNT 3
|
||||
#else
|
||||
#define ANAS_ITEMS_COUNT 2
|
||||
@@ -908,42 +910,48 @@ void menuProcDiagAna(uint8_t event)
|
||||
lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i+1)-1]*25/256);
|
||||
}
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
// Display raw BandGap result (debug)
|
||||
lcd_puts(64+5, 1+4*FH, STR_BG);
|
||||
lcd_outdezAtt(64+5+6*FW-3, 1+4*FH, BandGap, 0);
|
||||
#endif
|
||||
|
||||
// Voltage calibration
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(5*FH, STR_BATT_CALIB);
|
||||
static uint32_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ( adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128 ) * 4191 ;
|
||||
batCalV /= 55296 ;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
// TODO PREC2 => lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
|
||||
#elif defined(PCBV4)
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
|
||||
static uint16_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap;
|
||||
lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
|
||||
#else
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));
|
||||
#endif
|
||||
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
|
||||
|
||||
#if defined(PCBARM) && defined(REVB)
|
||||
lcd_putsLeft(7*FH-2, STR_CURRENT_CALIB);
|
||||
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 7*FH-2, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ;
|
||||
#if defined(PCBSKY9X) && defined(REVB)
|
||||
lcd_putsLeft(6*FH, STR_CURRENT_CALIB);
|
||||
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 6*FH, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ;
|
||||
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.currentCalib, -49, 49);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(7*FH, PSTR("Temp. Calib"));
|
||||
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 7*FH, getTemperature(), UNIT_DEGREES, (m_posVert==3 ? INVERS : 0)) ;
|
||||
if (m_posVert==3) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
enum menuProcHwItems {
|
||||
ITEM_SETUP_HW_COPROC,
|
||||
ITEM_SETUP_HW_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
@@ -951,7 +959,7 @@ enum menuProcHwItems {
|
||||
#define GENERAL_HW_PARAM_OFS (2+(15*FW))
|
||||
void menuProcHardware(uint8_t event)
|
||||
{
|
||||
MENU(PSTR("Hardware"), menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0});
|
||||
MENU(PSTR("Hardware"), menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, -1, 0});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
@@ -962,6 +970,11 @@ void menuProcHardware(uint8_t event)
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
|
||||
switch(k) {
|
||||
case ITEM_SETUP_HW_COPROC:
|
||||
lcd_putsLeft(y, STR_COPROC);
|
||||
lcd_outhex4(GENERAL_HW_PARAM_OFS, y, (Coproc_valid << 8) + Coproc_read);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_HW_OPTREX_DISPLAY:
|
||||
// TODO remove STR_OPTREX_DISPLAY + translations here
|
||||
g_eeGeneral.optrexDisplay = selectMenuItem(GENERAL_HW_PARAM_OFS, y, PSTR("LCD"), PSTR("\006NormalOptrex"), g_eeGeneral.optrexDisplay, 0, 1, attr, event);
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
/* Port Controls (Platform dependent) */
|
||||
// GCC optimisation should result in a single CBI/SBI instructions here
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
# define CS_LOW() PORTB &= ~0x01 /* MMC CS = L */
|
||||
# define CS_HIGH() PORTB |= 0x01 /* MMC CS = H */
|
||||
#else
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ void hapticQueue::heartbeat()
|
||||
|
||||
if (buzzTimeLeft > 0) {
|
||||
buzzTimeLeft--; // time gets counted down
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
hapticOn(g_eeGeneral.hapticStrength * 20);
|
||||
#else
|
||||
if (hapticTick-- > 0) {
|
||||
|
||||
+3
-3
@@ -67,7 +67,7 @@ void lcd_img(uint8_t x, uint8_t y, const pm_uchar * img, uint8_t idx, uint8_t mo
|
||||
|
||||
uint8_t lcdLastPos;
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t lcdLock;
|
||||
uint32_t lcdInputs;
|
||||
#endif
|
||||
@@ -490,7 +490,7 @@ void putsTime(uint8_t x, uint8_t y, putstime_t tme, uint8_t att, uint8_t att2)
|
||||
|
||||
qr = div(tme, 60);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (tme >= 3600) {
|
||||
qr = div(qr.quot, 60);
|
||||
lcd_outdezAtt(x+2*FWNUM, y, qr.quot, att);
|
||||
@@ -668,7 +668,7 @@ void putsRotaryEncoderMode(uint8_t x, uint8_t y, uint8_t phase, uint8_t idx, uin
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PCBARM
|
||||
#ifdef PCBSKY9X
|
||||
|
||||
// LCD i/o pins
|
||||
// LCD_RES PC27
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
|
||||
#define SURROUNDED 0x100
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define LcdFlags uint32_t
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define LcdFlags uint16_t
|
||||
#else
|
||||
#define LcdFlags uint8_t
|
||||
@@ -102,7 +102,7 @@ extern uint8_t lcdLastPos;
|
||||
extern volatile uint8_t LcdLock ;
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
extern uint8_t lcdLock ;
|
||||
extern uint32_t lcdInputs ;
|
||||
#endif
|
||||
@@ -143,7 +143,7 @@ extern void putsChnLetter(uint8_t x, uint8_t y, uint8_t idx, uint8_t attr);
|
||||
extern void putsVolts(uint8_t x, uint8_t y, uint16_t volts, uint8_t att);
|
||||
extern void putsVBat(uint8_t x, uint8_t y, uint8_t att);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define putstime_t int32_t
|
||||
#else
|
||||
#define putstime_t int16_t
|
||||
|
||||
+9
-9
@@ -99,7 +99,7 @@ void menuMainView(uint8_t event)
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
if (view_base <= e_inputs) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (view_base == e_inputs)
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
else
|
||||
@@ -205,9 +205,9 @@ void menuMainView(uint8_t event)
|
||||
putsModelName(2*FW-2, 0*FH, g_model.name, g_eeGeneral.currModel, DBLSIZE);
|
||||
|
||||
// Voltage (or alarm if any)
|
||||
#if defined(PCBARM)
|
||||
if (g_vbat100mV > g_eeGeneral.vBatWarn && temperature >= g_eeGeneral.temperatureWarn+80) {
|
||||
putsTelemetryValue(6*FW-1, 3*FH, temperature, UNIT_DEGREES, BLINK|INVERS|DBLSIZE);
|
||||
#if defined(PCBSKY9X)
|
||||
if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
|
||||
putsTelemetryValue(6*FW-1, 3*FH, getTemperature(), UNIT_DEGREES, BLINK|INVERS|DBLSIZE);
|
||||
}
|
||||
else if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
putsTelemetryValue(7*FW-1, 3*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
|
||||
@@ -278,7 +278,7 @@ void menuMainView(uint8_t event)
|
||||
if (view_base < e_inputs) {
|
||||
// scroll bar
|
||||
lcd_hlineStip(38, 34, 54, DOTTED);
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_hline(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
|
||||
#else
|
||||
lcd_hline((g_eeGeneral.view & ALTERNATE_VIEW) ? 64 : 38, 34, 26, SOLID);
|
||||
@@ -286,7 +286,7 @@ void menuMainView(uint8_t event)
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
uint8_t x0,y0;
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t chan = 8*(g_eeGeneral.view / ALTERNATE_VIEW) + i;
|
||||
#else
|
||||
uint8_t chan = (g_eeGeneral.view & ALTERNATE_VIEW) ? 8+i : i;
|
||||
@@ -352,16 +352,16 @@ void menuMainView(uint8_t event)
|
||||
#endif //EXTRA_ROTARY_ENCODERS
|
||||
}
|
||||
#endif // ROTARY_ENCODERS
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++) {
|
||||
int8_t len = getSwitch(10+i, 0) ? BAR_HEIGHT : 1;
|
||||
lcd_vline(16+3*i-1,SCREEN_HEIGHT-8-len,len);
|
||||
lcd_vline(16+3*i ,SCREEN_HEIGHT-8-len,len);
|
||||
}
|
||||
#elif defined(PCBV4) && defined(EXTRA_ROTARY_ENCODERS)
|
||||
#elif defined(PCBGRUVIN9X) && defined(EXTRA_ROTARY_ENCODERS)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++)
|
||||
putsSwitches(2*FW-2 + (i/3)*(4*FW-2) + (i/3>1 ? 3*FW+6 : 0), 4*FH+1 + (i%3)*FH, 10+i, getSwitch(10+i, 0) ? INVERS : 0);
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
for (uint8_t i=0; i<NUM_CSW; i++)
|
||||
putsSwitches(2*FW-2 + (i/3)*(4*FW) + (i/3>1 ? 3*FW : 0), 4*FH+1 + (i%3)*FH, 10+i, getSwitch(10+i, 0) ? INVERS : 0);
|
||||
#else
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ bool check_submenu_simple(uint8_t event, uint8_t maxrow)
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY 4
|
||||
#else
|
||||
#define ROTARY_ENCODER_GRANULARITY 1
|
||||
|
||||
+2
-2
@@ -132,14 +132,14 @@ extern int8_t s_inflight_min;
|
||||
extern int8_t s_inflight_max;
|
||||
extern int8_t s_inflight_shift;
|
||||
extern uint8_t s_inflight_bitshift;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define PREPARE_INFLIGHT_BITFIELD(a) int8_t *bitfield = (a)
|
||||
#endif
|
||||
#define INFLIGHT(val) (s_inflight_value==&val ? SURROUNDED : 0)
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift=0);
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, imin, imax, ishift, label) \
|
||||
checkInFlightIncDecModel(event, &var, imin, imax, ishift, label)
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, var, imin, imax, ishift, label, bitshift) \
|
||||
checkInFlightIncDecModel(event, bitfield, imin, imax, ishift, label, bitshift);
|
||||
#endif
|
||||
|
||||
+31
-31
@@ -187,9 +187,9 @@ void menuProcModelSelect(uint8_t event)
|
||||
{
|
||||
TITLE(STR_MENUMODELSEL);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define REFRESH(x)
|
||||
#elif defined(PCBV4) && defined(SDCARD)
|
||||
#elif defined(PCBGRUVIN9X) && defined(SDCARD)
|
||||
static bool refresh = true;
|
||||
#define REFRESH(x) refresh = (x)
|
||||
#else
|
||||
@@ -223,7 +223,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
#endif
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
if (event
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
|| oldSub != m_posVert
|
||||
@@ -383,7 +383,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
lcd_puts(9*FW-(LEN_FREE-4)*FW, 0, STR_FREE);
|
||||
if (refresh) reusableBuffer.models.eepromfree = EeFsGetFree();
|
||||
lcd_outdezAtt(17*FW, 0, reusableBuffer.models.eepromfree, 0);
|
||||
@@ -418,7 +418,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
k %= MAX_MODELS;
|
||||
|
||||
if (eeModelExists(k)) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
putsModelName(4*FW, y, ModelNames[k], k, 0);
|
||||
#else
|
||||
uint16_t & size = reusableBuffer.models.listsizes[i];
|
||||
@@ -437,7 +437,7 @@ void menuProcModelSelect(uint8_t event)
|
||||
}
|
||||
|
||||
if (s_warning) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
s_warning_info = ModelNames[sub];
|
||||
#else
|
||||
char * name = reusableBuffer.models.mainname;
|
||||
@@ -565,7 +565,7 @@ enum menuProcModelItems {
|
||||
ITEM_MODEL_PROTOCOL_PARAMS
|
||||
};
|
||||
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
#define FIELD_TIMER_MAX 3
|
||||
#else
|
||||
#define FIELD_TIMER_MAX 2
|
||||
@@ -596,7 +596,7 @@ void menuProcModel(uint8_t event)
|
||||
switch(k) {
|
||||
case ITEM_MODEL_NAME:
|
||||
EditName(MODEL_PARAM_OFS, y, g_model.name, sizeof(g_model.name), event, attr, m_posHorz);
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
memcpy(ModelNames[g_eeGeneral.currModel], g_model.name, sizeof(g_model.name));
|
||||
#endif
|
||||
break;
|
||||
@@ -610,7 +610,7 @@ void menuProcModel(uint8_t event)
|
||||
putsTime(15*FW, y, timer->val,
|
||||
(attr && m_posHorz==1 ? blink:0),
|
||||
(attr && m_posHorz==2 ? blink:0) );
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
lcd_putcAtt(20*FW+1, y, g_model.timersXtra[k-ITEM_MODEL_TIMER1].remanent ? 'R' : '-', (attr && m_posHorz==3) ? blink : 0);
|
||||
#endif
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
@@ -628,7 +628,7 @@ void menuProcModel(uint8_t event)
|
||||
timer->val -= qr.rem ;
|
||||
if ((int16_t)timer->val < 0) timer->val=0;
|
||||
break;
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
case 3:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.timersXtra[k-ITEM_MODEL_TIMER1].remanent, 0, 1);
|
||||
break;
|
||||
@@ -840,7 +840,7 @@ uint8_t editDelay(const uint8_t y, const uint8_t event, const uint8_t attr, cons
|
||||
|
||||
#if defined(FLIGHT_PHASES)
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define PhasesType uint16_t
|
||||
#else
|
||||
#define PhasesType uint8_t
|
||||
@@ -850,12 +850,12 @@ PhasesType editPhases(uint8_t x, uint8_t y, uint8_t event, PhasesType value, uin
|
||||
{
|
||||
lcd_putsLeft(y, STR_FPHASE);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
bool expoMenu = (x==EXPO_ONE_2ND_COLUMN-2*FW);
|
||||
#endif
|
||||
|
||||
for (uint8_t p=0; p<MAX_PHASES; p++) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (expoMenu && ((attr && p < m_posHorz-4) || (x > EXPO_ONE_2ND_COLUMN+2*FW)))
|
||||
continue;
|
||||
#endif
|
||||
@@ -980,7 +980,7 @@ void menuProcPhasesAll(uint8_t event)
|
||||
|
||||
uint8_t att;
|
||||
for (uint8_t i=0; i<MAX_PHASES; i++) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
int8_t y = (1+i-s_pgOfs)*FH;
|
||||
if (y<1*FH || y>7*FH) continue;
|
||||
#else
|
||||
@@ -1019,7 +1019,7 @@ void menuProcPhasesAll(uint8_t event)
|
||||
for (uint8_t t=0; t<NUM_STICKS; t++) {
|
||||
putsTrimMode((15+t)*FW+TRIMS_OFS, y, i, t, 0);
|
||||
}
|
||||
#if defined PCBV4
|
||||
#if defined PCBGRUVIN9X
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode((19+t)*FW+TRIMS_OFS+ROTARY_ENC_OFS, y, i, t, 0);
|
||||
}
|
||||
@@ -1029,7 +1029,7 @@ void menuProcPhasesAll(uint8_t event)
|
||||
lcd_putc(20*FW+2, y, (p->fadeIn && p->fadeOut) ? '*' : (p->fadeIn ? 'I' : 'O'));
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (s_pgOfs != MAX_PHASES-6) return;
|
||||
#endif
|
||||
|
||||
@@ -1459,7 +1459,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
|
||||
}
|
||||
|
||||
enum ExposFields {
|
||||
#ifdef PCBARM
|
||||
#ifdef PCBSKY9X
|
||||
EXPO_FIELD_NAME,
|
||||
#endif
|
||||
EXPO_FIELD_WIDTH,
|
||||
@@ -1475,7 +1475,7 @@ enum ExposFields {
|
||||
EXPO_FIELD_MAX
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define EXPO_ONE_ARM_ROW sizeof(ed->name),
|
||||
#else
|
||||
#define EXPO_ONE_ARM_ROW
|
||||
@@ -1506,7 +1506,7 @@ void menuProcExpoOne(uint8_t event)
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch(i)
|
||||
{
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
case EXPO_FIELD_NAME:
|
||||
EditName(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->name, sizeof(ed->name), event, attr, m_posHorz);
|
||||
break;
|
||||
@@ -1577,7 +1577,7 @@ void menuProcExpoOne(uint8_t event)
|
||||
}
|
||||
|
||||
enum MixFields {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
MIX_FIELD_NAME,
|
||||
#endif
|
||||
MIX_FIELD_SOURCE,
|
||||
@@ -1600,7 +1600,7 @@ enum MixFields {
|
||||
MIX_FIELD_COUNT
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MIX_ONE_ARM_ROW sizeof(md2->name),
|
||||
#else
|
||||
#define MIX_ONE_ARM_ROW
|
||||
@@ -1631,7 +1631,7 @@ void menuProcMixOne(uint8_t event)
|
||||
uint8_t i = k + s_pgOfs;
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch(i) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
case MIX_FIELD_NAME:
|
||||
EditName(MIXES_2ND_COLUMN, y, md2->name, sizeof(md2->name), event, attr, m_posHorz);
|
||||
break;
|
||||
@@ -1943,7 +1943,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
else
|
||||
lcd_outdezAtt(EXPO_LINE_EXPO_POS, y, ed->curveParam, 0);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (ed->name[0]) {
|
||||
putsSwitches(11*FW, y, ed->swtch, 0);
|
||||
lcd_putsnAtt(15*FW+2, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
|
||||
@@ -1965,7 +1965,7 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event)
|
||||
if (attr != 0)
|
||||
CHECK_INCDEC_MODELVAR(_event, md->weight, -125, 125);
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (md->name[0]) {
|
||||
lcd_putsnAtt(15*FW+2, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0));
|
||||
}
|
||||
@@ -2165,7 +2165,7 @@ void menuProcLimits(uint8_t event)
|
||||
#endif
|
||||
if (active) {
|
||||
int16_t new_offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS);
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
if (checkIncDec_Ret)
|
||||
#endif
|
||||
{
|
||||
@@ -2289,7 +2289,7 @@ void menuProcCurvesAll(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
enum CustomSwitchFields {
|
||||
CSW_FIELD_FUNCTION,
|
||||
CSW_FIELD_V1,
|
||||
@@ -2556,7 +2556,7 @@ void menuProcCustomSwitches(uint8_t event)
|
||||
|
||||
void menuProcFunctionSwitches(uint8_t event)
|
||||
{
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
uint8_t _event = event;
|
||||
if (s_menu_count) {
|
||||
event = 0;
|
||||
@@ -2631,7 +2631,7 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
lcd_outdezAtt(21*FW, y, val_displayed, attr);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
else if (sd->func == FUNC_PLAY_TRACK) {
|
||||
if (sd->param[0] && sd->param[1])
|
||||
lcd_putsnAtt(15*FW, y, sd->param, sizeof(sd->param), attr);
|
||||
@@ -2651,7 +2651,7 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
putsChnRaw(17*FW, y, val_displayed+1, attr);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
else if (sd->func == FUNC_VOLUME) {
|
||||
val_max = NUM_XCHNRAW-1;
|
||||
putsChnRaw(17*FW, y, val_displayed+1, attr);
|
||||
@@ -2716,7 +2716,7 @@ void menuProcFunctionSwitches(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
if (s_menu_count) {
|
||||
const char * result = displayMenu(_event);
|
||||
if (result) {
|
||||
@@ -2992,7 +2992,7 @@ void menuProcTelemetry(uint8_t event)
|
||||
if (attr && m_posHorz==c && (s_editMode>0 || p1valdiff)) {
|
||||
CHECK_INCDEC_MODELVAR(event, value, 0, (j==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
#if defined (PCBARM)
|
||||
#if defined (PCBSKY9X)
|
||||
g_model.frsky.lines[2*j+c] = value;
|
||||
#else
|
||||
g_model.frsky.lines[j] = (c==0 ? ((g_model.frsky.lines[j] & 0xf0) + (value & 0x0f)) : (g_model.frsky.lines[j] & 0x0f) + ((value & 0x0f) << 4));
|
||||
|
||||
+25
-24
@@ -48,9 +48,9 @@
|
||||
#define WARN_MEM (!(g_eeGeneral.warnOpts & WARN_MEM_BIT))
|
||||
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define EEPROM_VER 212
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define EEPROM_VER 211
|
||||
#else
|
||||
#define EEPROM_VER 211
|
||||
@@ -91,8 +91,8 @@ enum BeeperMode {
|
||||
e_mode_all
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#define EXTRA_ARM_FIELDS \
|
||||
#if defined(PCBSKY9X)
|
||||
#define EXTRA_SKY9X_FIELDS \
|
||||
uint8_t speakerVolume; \
|
||||
uint8_t backlightBright; \
|
||||
int8_t currentCalib
|
||||
@@ -100,9 +100,10 @@ enum BeeperMode {
|
||||
int8_t temperatureWarn; \
|
||||
uint8_t mAhWarn; \
|
||||
uint16_t mAhUsed; \
|
||||
uint32_t globalTimer
|
||||
uint32_t globalTimer; \
|
||||
int8_t temperatureCalib;
|
||||
#else
|
||||
#define EXTRA_ARM_FIELDS
|
||||
#define EXTRA_SKY9X_FIELDS
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
int8_t speakerVolume
|
||||
#endif
|
||||
@@ -135,7 +136,7 @@ PACK(typedef struct t_EEGeneral {
|
||||
int8_t backlightMode;
|
||||
TrainerData trainer;
|
||||
uint8_t view; //index of subview in main scrren
|
||||
uint8_t btBaudrate:3; // TODO only needed on ARM
|
||||
uint8_t btBaudrate:3; // TODO only needed on SKY9X
|
||||
int8_t beeperMode:2;
|
||||
uint8_t spare1:1;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
@@ -163,7 +164,7 @@ PACK(typedef struct t_EEGeneral {
|
||||
uint8_t unexpectedShutdown:1;
|
||||
uint8_t speakerPitch;
|
||||
|
||||
EXTRA_ARM_FIELDS;
|
||||
EXTRA_SKY9X_FIELDS;
|
||||
|
||||
uint8_t variants;
|
||||
|
||||
@@ -173,7 +174,7 @@ PACK(typedef struct t_EEGeneral {
|
||||
|
||||
// eeprom modelspec
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PACK(typedef struct t_ExpoData {
|
||||
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn;
|
||||
@@ -213,9 +214,9 @@ enum MixSources {
|
||||
MIXSRC_P1,
|
||||
MIXSRC_P2,
|
||||
MIXSRC_P3,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
MIXSRC_REa,
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
MIXSRC_REa,
|
||||
MIXSRC_REb,
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
@@ -270,7 +271,7 @@ enum MixSources {
|
||||
#define MODE_EXPO 0
|
||||
#define MODE_CURVE 1
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MAX_DELAY 60 /* 30 seconds */
|
||||
#define MAX_SLOW 60 /* 30 seconds */
|
||||
PACK(typedef struct t_MixData {
|
||||
@@ -317,7 +318,7 @@ PACK(typedef struct t_MixData {
|
||||
}) MixData;
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MAX_CSW_DURATION 120 /*60s*/
|
||||
#define MAX_CSW_DELAY 120 /*60s*/
|
||||
PACK(typedef struct t_CustomSwData { // Custom Switches data
|
||||
@@ -353,7 +354,7 @@ enum Functions {
|
||||
#if !defined(PCBSTD)
|
||||
FUNC_LOGS,
|
||||
#endif
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
FUNC_VOLUME,
|
||||
#endif
|
||||
FUNC_BACKLIGHT,
|
||||
@@ -363,7 +364,7 @@ enum Functions {
|
||||
FUNC_MAX
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PACK(typedef struct t_FuncSwData { // Function Switches data
|
||||
int8_t swtch; //input
|
||||
uint8_t func;
|
||||
@@ -470,7 +471,7 @@ enum VarioSource {
|
||||
VARIO_SOURCE_LAST = VARIO_SOURCE_A2,
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PACK(typedef struct t_FrSkyBarData {
|
||||
uint8_t source;
|
||||
uint8_t barMin; // minimum for bar display
|
||||
@@ -499,7 +500,7 @@ enum FrskySource {
|
||||
FRSKY_SOURCE_CELLS,
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PACK(typedef struct t_FrSkyData {
|
||||
FrSkyChannelData channels[2];
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
@@ -566,12 +567,12 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data
|
||||
|
||||
#define ROTARY_ENCODER_MAX 1024
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define NUM_ROTARY_ENCODERS_EXTRA 0
|
||||
#define NUM_ROTARY_ENCODERS 1
|
||||
#define ROTARY_ENCODER_ARRAY_EXTRA
|
||||
#define ROTARY_ENCODER_ARRAY int16_t rotaryEncoders[1];
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
#define NUM_ROTARY_ENCODERS_EXTRA 2
|
||||
#define NUM_ROTARY_ENCODERS (2+NUM_ROTARY_ENCODERS_EXTRA)
|
||||
@@ -604,7 +605,7 @@ PACK(typedef struct t_PhaseData {
|
||||
ROTARY_ENCODER_ARRAY
|
||||
}) PhaseData;
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MAX_MODELS 60
|
||||
#define NUM_CHNOUT 32 // number of real output channels CH1-CH32
|
||||
#define MAX_PHASES 9
|
||||
@@ -612,7 +613,7 @@ PACK(typedef struct t_PhaseData {
|
||||
#define MAX_EXPOS 32
|
||||
#define NUM_CSW 32 // number of custom switches
|
||||
#define NUM_FSW 32 // number of functions assigned to switches
|
||||
#elif defined(PCBV4) || defined(M128)
|
||||
#elif defined(PCBGRUVIN9X) || defined(M128)
|
||||
#define MAX_MODELS 30
|
||||
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define MAX_PHASES 5
|
||||
@@ -632,7 +633,7 @@ PACK(typedef struct t_PhaseData {
|
||||
|
||||
#define MAX_TIMERS 2
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MAX_CURVES 16
|
||||
#define NUM_POINTS 512
|
||||
#define CURVTYPE int16_t
|
||||
@@ -687,13 +688,13 @@ enum Dsm2Variants {
|
||||
#define TELEMETRY_DATA FrSkyData frsky
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4) || defined(PCBARM)
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBSKY9X)
|
||||
#define BeepANACenter uint16_t
|
||||
#else
|
||||
#define BeepANACenter uint8_t
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4) || defined(PCBARM)
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBSKY9X)
|
||||
PACK(typedef struct t_TimerDataExtra {
|
||||
uint16_t remanent:1;
|
||||
uint16_t value:15;
|
||||
|
||||
+87
-88
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "open9x.h"
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MIXER_STACK_SIZE 500
|
||||
#define MENUS_STACK_SIZE 2500
|
||||
#define AUDIO_STACK_SIZE 500
|
||||
@@ -73,7 +73,7 @@ const pm_uchar splashdata[] PROGMEM = { 'S','P','S',0,
|
||||
const pm_uchar * splash_lbm = splashdata+4;
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4) || defined(PCBARM) || defined(M128) || defined(EXTSTD)
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBSKY9X) || defined(M128) || defined(EXTSTD)
|
||||
const pm_uchar asterisk_lbm[] PROGMEM = {
|
||||
#include "asterisk.lbm"
|
||||
};
|
||||
@@ -84,7 +84,7 @@ const pm_uchar asterisk_lbm[] PROGMEM = {
|
||||
EEGeneral g_eeGeneral;
|
||||
ModelData g_model;
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
uint8_t g_tmr1Latency_max;
|
||||
uint8_t g_tmr1Latency_min;
|
||||
#endif
|
||||
@@ -92,11 +92,11 @@ uint8_t g_tmr1Latency_min;
|
||||
uint8_t unexpectedShutdown = 0;
|
||||
|
||||
uint16_t g_timeMainMax;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
uint8_t g_timeMainLast;
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO) && !defined(PCBARM)
|
||||
#if defined(AUDIO) && !defined(PCBSKY9X)
|
||||
audioQueue audio;
|
||||
#endif
|
||||
|
||||
@@ -451,7 +451,7 @@ void applyExpos(int16_t *anas)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
int16_t calc100toRESX(int8_t x)
|
||||
{
|
||||
// return (int16_t)x*10 + x/4 - x/64;
|
||||
@@ -528,7 +528,7 @@ int16_t getValue(uint8_t i)
|
||||
/*srcRaw is shifted +1!*/
|
||||
|
||||
if(i<NUM_STICKS+NUM_POTS) return calibratedStick[i];
|
||||
#if defined(PCBV4) || defined(PCBARM)
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBSKY9X)
|
||||
else if(i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS) return getRotaryEncoder(i-(NUM_STICKS+NUM_POTS));
|
||||
#endif
|
||||
else if(i<MIXSRC_TrimAil) return calc1000toRESX((int16_t)8 * getTrimValue(s_perout_flight_phase, i-(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS)));
|
||||
@@ -578,7 +578,7 @@ int16_t getValue(uint8_t i)
|
||||
else return 0;
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define GETSWITCH_RECURSIVE_TYPE uint32_t
|
||||
volatile bool s_default_switch_value;
|
||||
#else
|
||||
@@ -589,7 +589,7 @@ volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used;
|
||||
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value;
|
||||
/* recursive function. stack as of today (16/03/2012) grows by 8bytes at each call, which is ok! */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint32_t delays[NUM_CSW];
|
||||
uint32_t durations[NUM_CSW];
|
||||
#endif
|
||||
@@ -601,7 +601,7 @@ bool __getSwitch(int8_t swtch)
|
||||
bool result;
|
||||
|
||||
if (swtch == 0)
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
return s_default_switch_value;
|
||||
#else
|
||||
return s_last_switch_used & ((GETSWITCH_RECURSIVE_TYPE)1<<15);
|
||||
@@ -644,7 +644,7 @@ bool __getSwitch(int8_t swtch)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
if (result)
|
||||
s_last_switch_value |= ((GETSWITCH_RECURSIVE_TYPE)1<<cs_idx);
|
||||
#endif
|
||||
@@ -739,7 +739,7 @@ bool __getSwitch(int8_t swtch)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (cs->delay) {
|
||||
if (result) {
|
||||
if (delays[cs_idx] > get_tmr10ms())
|
||||
@@ -772,7 +772,7 @@ bool __getSwitch(int8_t swtch)
|
||||
|
||||
bool getSwitch(int8_t swtch, bool nc)
|
||||
{
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
s_last_switch_used = 0;
|
||||
s_last_switch_value = 0;
|
||||
s_default_switch_value = nc;
|
||||
@@ -925,7 +925,7 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY) || defined(PCBARM)
|
||||
#if defined(FRSKY) || defined(PCBSKY9X)
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att)
|
||||
{
|
||||
#ifdef IMPERIAL_UNITS
|
||||
@@ -956,7 +956,7 @@ void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t
|
||||
|
||||
void clearKeyEvents()
|
||||
{
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
CoTickDelay(100); // 200ms
|
||||
#endif
|
||||
|
||||
@@ -1031,7 +1031,7 @@ void doSplash()
|
||||
lcd_img(0, 0, splash_lbm, 0, 0);
|
||||
refreshDisplay();
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
AUDIO_TADA();
|
||||
#endif
|
||||
|
||||
@@ -1056,7 +1056,7 @@ void doSplash()
|
||||
#if defined(SIMU)
|
||||
if (!main_thread_running) return;
|
||||
sleep(1/*ms*/);
|
||||
#elif defined(PCBARM)
|
||||
#elif defined(PCBSKY9X)
|
||||
CoTickDelay(1);
|
||||
#endif
|
||||
getADC_filt();
|
||||
@@ -1087,7 +1087,7 @@ void doSplash()
|
||||
|
||||
void checkAll()
|
||||
{
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
checkLowEEPROM();
|
||||
#endif
|
||||
|
||||
@@ -1095,7 +1095,7 @@ void checkAll()
|
||||
checkSwitches();
|
||||
}
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
void checkLowEEPROM()
|
||||
{
|
||||
if (g_eeGeneral.disableMemoryWarning) return;
|
||||
@@ -1219,7 +1219,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
||||
{
|
||||
lcd_clear();
|
||||
|
||||
#if defined(PCBV4) || defined(PCBARM) || defined(M128) || defined(EXTSTD)
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBSKY9X) || defined(M128) || defined(EXTSTD)
|
||||
lcd_img(2, 0, asterisk_lbm, 0, 0);
|
||||
#else
|
||||
lcd_putsAtt(0, 0, PSTR("(!)"), DBLSIZE);
|
||||
@@ -1264,7 +1264,7 @@ void checkTrims()
|
||||
bool thro = (idx==THR_STICK && g_model.thrTrim);
|
||||
if (thro) v = 4; // if throttle trim and trim trottle then step=4
|
||||
int16_t after = (k&1) ? before + v : before - v; // positive = k&1
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t beepTrim = 0;
|
||||
#else
|
||||
bool beepTrim = false;
|
||||
@@ -1322,7 +1322,7 @@ void checkTrims()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBARM) && defined(REVB)
|
||||
#if defined(PCBSKY9X) && defined(REVB)
|
||||
uint16_t Current_analogue;
|
||||
uint16_t Current_max;
|
||||
uint32_t Current_accumulator;
|
||||
@@ -1339,7 +1339,7 @@ static uint16_t s_anaFilt[NUMBER_ANALOG];
|
||||
|
||||
#if defined(SIMU)
|
||||
uint16_t BandGap = 225;
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
// #define STARTADCONV (ADCSRA = (1<<ADEN) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2) | (1<<ADSC) | (1 << ADIE))
|
||||
// G: Note that the above would have set the ADC prescaler to 128, equating to
|
||||
// 125KHz sample rate. We now sample at 500KHz, with oversampling and other
|
||||
@@ -1361,7 +1361,7 @@ uint16_t anaIn(uint8_t chan)
|
||||
// ana-in: 3 1 2 0 4 5 6 7
|
||||
//static pm_char crossAna[] PROGMEM ={4,2,3,1,5,6,7,0}; // wenn schon Tabelle, dann muss sich auch lohnen
|
||||
// Google Translate (German): // if table already, then it must also be worthwhile
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
static const uint8_t crossAna[]={1,5,7,0,4,6,2,3,8};
|
||||
#if defined(REVB)
|
||||
if ( chan == 8 ) {
|
||||
@@ -1376,7 +1376,7 @@ uint16_t anaIn(uint8_t chan)
|
||||
return *p;
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
void getADC_filt()
|
||||
{
|
||||
register uint32_t x ;
|
||||
@@ -1482,10 +1482,10 @@ void getADC_single()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
void getADC_bandgap()
|
||||
{
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
static uint8_t s_bgCheck = 0;
|
||||
static uint16_t s_bgSum = 0;
|
||||
ADCSRA|=0x40; // request sample
|
||||
@@ -1515,12 +1515,12 @@ void getADC_bandgap()
|
||||
uint8_t g_vbat100mV = 0;
|
||||
uint16_t g_LightOffCounter;
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
FORCEINLINE bool checkSlaveMode()
|
||||
{
|
||||
// no power -> only phone jack = slave mode
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
return SLAVE_MODE;
|
||||
#else
|
||||
static bool lastSlaveMode = false;
|
||||
@@ -1863,7 +1863,7 @@ PLAY_FUNCTION(playValue, uint8_t idx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
static uint8_t currentSpeakerVolume = 255;
|
||||
uint8_t requiredSpeakerVolume;
|
||||
#endif
|
||||
@@ -1949,7 +1949,7 @@ void evalFunctions()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
else if (sd->func == FUNC_PLAY_TRACK) {
|
||||
if (IS_PLAYING(i+1)) {
|
||||
switch_mask = 0;
|
||||
@@ -2323,11 +2323,11 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms)
|
||||
getADC_single() ;
|
||||
}
|
||||
|
||||
#if defined(PCBARM) && defined(REVB) && !defined(SIMU)
|
||||
#if defined(PCBSKY9X) && defined(REVB) && !defined(SIMU)
|
||||
Current_analogue = ( Current_analogue * 31 + s_anaFilt[8] ) >> 5 ;
|
||||
if (Current_analogue > Current_max)
|
||||
Current_max = Current_analogue ;
|
||||
#elif defined(PCBV4) && !defined(SIMU)
|
||||
#elif defined(PCBGRUVIN9X) && !defined(SIMU)
|
||||
// For PCB V4, use our own 1.2V, external reference (connected to ADC3)
|
||||
ADCSRB &= ~(1<<MUX5);
|
||||
ADMUX = 0x03|ADC_VREF_TYPE; // Switch MUX to internal reference
|
||||
@@ -2400,7 +2400,7 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms)
|
||||
}
|
||||
|
||||
// Bandgap has had plenty of time to settle...
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
getADC_bandgap();
|
||||
#endif
|
||||
|
||||
@@ -2595,7 +2595,7 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
requiredSpeakerVolume = g_eeGeneral.speakerVolume;
|
||||
#endif
|
||||
|
||||
@@ -2605,7 +2605,7 @@ inline void doMixerCalculations(tmr10ms_t tmr10ms, uint8_t tick10ms)
|
||||
if (s_rangecheck_mode) AUDIO_PLAY(AU_FRSKY_CHEEP);
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (currentSpeakerVolume != requiredSpeakerVolume) {
|
||||
setVolume(requiredSpeakerVolume);
|
||||
currentSpeakerVolume = requiredSpeakerVolume;
|
||||
@@ -2625,7 +2625,7 @@ void perMain()
|
||||
#endif
|
||||
|
||||
// TODO same code here + integrate the timer which could be common
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (Tenms) {
|
||||
Tenms = 0 ;
|
||||
|
||||
@@ -2659,7 +2659,7 @@ void perMain()
|
||||
if (!tick10ms) return; //make sure the rest happen only every 10ms.
|
||||
|
||||
#if defined(SDCARD)
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
static uint8_t mountTimer;
|
||||
if (mountTimer-- == 0) {
|
||||
mountTimer = 100;
|
||||
@@ -2695,7 +2695,7 @@ void perMain()
|
||||
|
||||
lcd_clear();
|
||||
|
||||
#if defined(PCBARM) && defined(SIMU)
|
||||
#if defined(PCBSKY9X) && defined(SIMU)
|
||||
checkTrims();
|
||||
#endif
|
||||
|
||||
@@ -2711,7 +2711,7 @@ void perMain()
|
||||
|
||||
checkBacklight();
|
||||
|
||||
#if defined(PCBARM) && defined(FRSKY)
|
||||
#if defined(PCBSKY9X) && defined(FRSKY)
|
||||
check_frsky();
|
||||
#endif
|
||||
|
||||
@@ -2721,14 +2721,14 @@ void perMain()
|
||||
drawStatusLine();
|
||||
refreshDisplay();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if ( check_soft_power() == e_power_trainer ) { // On trainer power
|
||||
PIOC->PIO_PDR = PIO_PC22 ; // Disable bit C22 Assign to peripheral
|
||||
}
|
||||
else {
|
||||
PIOC->PIO_PER = PIO_PC22 ; // Enable bit C22 as input
|
||||
}
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
// PPM signal on phono-jack. In or out? ...
|
||||
if(checkSlaveMode()) {
|
||||
PORTG |= (1<<OUT_G_SIM_CTL); // 1=ppm out
|
||||
@@ -2746,7 +2746,7 @@ void perMain()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
static uint8_t counter = 0;
|
||||
if (counter-- == 0) {
|
||||
counter = 10;
|
||||
@@ -2754,11 +2754,11 @@ void perMain()
|
||||
if ((tmr10ms & 0x1f) == 2 /*every 10ms*32*/ || g_menuStack[g_menuStackPtr] == menuProcDiagAna) {
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
int32_t instant_vbat = anaIn(7);
|
||||
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * 4191 ;
|
||||
instant_vbat /= 55296 ;
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
uint16_t instant_vbat = anaIn(7);
|
||||
instant_vbat = ((uint32_t)instant_vbat*1112 + (int32_t)instant_vbat*g_eeGeneral.vBatCalib + (BandGap<<2)) / (BandGap<<3);
|
||||
#else
|
||||
@@ -2783,8 +2783,8 @@ void perMain()
|
||||
if (g_vbat100mV <= g_eeGeneral.vBatWarn && g_vbat100mV>50) {
|
||||
AUDIO_TX_BATTERY_LOW();
|
||||
}
|
||||
#if defined(PCBARM)
|
||||
else if (temperature >= g_eeGeneral.temperatureWarn+80) {
|
||||
#if defined(PCBSKY9X)
|
||||
else if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
|
||||
AUDIO_TX_TEMP_HIGH();
|
||||
}
|
||||
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
|
||||
@@ -2798,10 +2798,10 @@ void perMain()
|
||||
int16_t g_ppmIns[8];
|
||||
uint8_t ppmInState = 0; //0=unsync 1..8= wait for value i-1
|
||||
|
||||
#if !defined(SIMU) && !defined(PCBARM)
|
||||
#if !defined(SIMU) && !defined(PCBSKY9X)
|
||||
|
||||
volatile uint8_t g_tmr16KHz; //continuous timer 16ms (16MHz/1024/256) -- 8-bit counter overflow
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
ISR(TIMER2_OVF_vect)
|
||||
#else
|
||||
ISR(TIMER0_OVF_vect) // TODO now NOBLOCK in er9x
|
||||
@@ -2817,7 +2817,7 @@ uint16_t getTmr16KHz()
|
||||
{
|
||||
while(1){
|
||||
uint8_t hb = g_tmr16KHz;
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
uint8_t lb = TCNT2;
|
||||
#else
|
||||
uint8_t lb = TCNT0;
|
||||
@@ -2826,7 +2826,7 @@ uint16_t getTmr16KHz()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
||||
{
|
||||
cli();
|
||||
@@ -2863,7 +2863,7 @@ ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) // mixer interrupt
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) //10ms timer
|
||||
#else
|
||||
// Clocks every 64 uS
|
||||
@@ -2872,7 +2872,7 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
||||
{
|
||||
cli();
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK2 &= ~(1<<OCIE2A); // stop reentrance
|
||||
#else
|
||||
TIMSK &= ~(1<<OCIE0); // stop reentrance
|
||||
@@ -2880,7 +2880,7 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
||||
|
||||
sei();
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
static uint8_t accuracyWarble = 4; // because 16M / 1024 / 100 = 156.25. So bump every 4.
|
||||
uint8_t bump = (!(accuracyWarble++ & 0x03)) ? 157 : 156;
|
||||
OCR2A += bump;
|
||||
@@ -2923,11 +2923,11 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
||||
|
||||
per10ms();
|
||||
|
||||
#if defined(PCBV4) && defined(SDCARD)
|
||||
#if defined(PCBGRUVIN9X) && defined(SDCARD)
|
||||
sdPoll10mS();
|
||||
#endif
|
||||
|
||||
#if !defined(PCBV4)
|
||||
#if !defined(PCBGRUVIN9X)
|
||||
heartbeat |= HEART_TIMER10ms; // TODO check heartbeat everywhere!
|
||||
#endif
|
||||
|
||||
@@ -2937,7 +2937,7 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
||||
|
||||
cli();
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK2 |= (1<<OCIE2A);
|
||||
#else
|
||||
TIMSK |= (1<<OCIE0);
|
||||
@@ -2958,7 +2958,7 @@ ISR(TIMER3_CAPT_vect) // G: High frequency noise can cause stack overflo with IS
|
||||
uint16_t capture=ICR3;
|
||||
|
||||
// Prevent rentrance for this IRQ only
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 &= ~(1<<ICIE3);
|
||||
#else
|
||||
ETIMSK &= ~(1<<TICIE3);
|
||||
@@ -2988,7 +2988,7 @@ ISR(TIMER3_CAPT_vect) // G: High frequency noise can cause stack overflo with IS
|
||||
lastCapt = capture;
|
||||
|
||||
cli(); // disable other interrupts for stack pops before this function's RETI
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 |= (1<<ICIE3);
|
||||
#else
|
||||
ETIMSK |= (1<<TICIE3);
|
||||
@@ -3001,7 +3001,7 @@ ISR(TIMER3_CAPT_vect) // G: High frequency noise can cause stack overflo with IS
|
||||
// (reading from the .hex file), since a bug relating to Intel HEX file record
|
||||
// interpretation was fixed. However, I leave these commented out, just in case
|
||||
// it causes trouble for others.
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
// See fuses_2561.txt
|
||||
FUSES =
|
||||
{
|
||||
@@ -3032,7 +3032,7 @@ ISR(TIMER3_CAPT_vect) // G: High frequency noise can cause stack overflo with IS
|
||||
|
||||
// TODO serial_arm and serial_avr
|
||||
|
||||
#if defined (FRSKY) && !defined(PCBARM)
|
||||
#if defined (FRSKY) && !defined(PCBSKY9X)
|
||||
FORCEINLINE void FRSKY_USART0_vect()
|
||||
{
|
||||
if (frskyTxBufferCount > 0) {
|
||||
@@ -3044,7 +3044,7 @@ FORCEINLINE void FRSKY_USART0_vect()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (DSM2_SERIAL) && !defined(PCBARM)
|
||||
#if defined (DSM2_SERIAL) && !defined(PCBSKY9X)
|
||||
FORCEINLINE void DSM2_USART0_vect()
|
||||
{
|
||||
UDR0 = *((uint16_t*)pulses2MHzRPtr);
|
||||
@@ -3056,7 +3056,7 @@ FORCEINLINE void DSM2_USART0_vect()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU) && !defined(PCBARM)
|
||||
#if !defined(SIMU) && !defined(PCBSKY9X)
|
||||
#if defined (FRSKY) or defined(DSM2_SERIAL)
|
||||
ISR(USART0_UDRE_vect)
|
||||
{
|
||||
@@ -3134,7 +3134,7 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
void saveTimers()
|
||||
{
|
||||
for (uint8_t i=0; i<MAX_TIMERS; i++) {
|
||||
@@ -3150,7 +3150,7 @@ void saveTimers()
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
// Rotary encoder interrupts
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
volatile uint32_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
#else
|
||||
volatile uint8_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
@@ -3159,7 +3159,7 @@ volatile uint8_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
|
||||
#ifndef SIMU
|
||||
|
||||
#if defined(PCBV4) && defined(ROTARY_ENCODERS)
|
||||
#if defined(PCBGRUVIN9X) && defined(ROTARY_ENCODERS)
|
||||
|
||||
#if !defined(EXTRA_ROTARY_ENCODERS)
|
||||
ISR(INT2_vect)
|
||||
@@ -3184,9 +3184,9 @@ ISR(INT6_vect)
|
||||
uint8_t input = PINE & 0b01100000;
|
||||
if (input == 0 || input == 0b01100000) incRotaryEncoder(1, -1);
|
||||
}
|
||||
#endif //PCBV4+ROTARY_ENCODERS
|
||||
#endif //PCBGRUVIN9X+ROTARY_ENCODERS
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
extern unsigned char __bss_end ;
|
||||
|
||||
uint16_t stack_free()
|
||||
@@ -3203,7 +3203,7 @@ uint16_t stack_free()
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown)
|
||||
#define OPEN9X_INIT_ARGS const uint8_t mcusr
|
||||
#elif defined(PCBSTD)
|
||||
@@ -3218,17 +3218,21 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
||||
{
|
||||
eeReadAll();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
setVolume(g_eeGeneral.speakerVolume);
|
||||
PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright;
|
||||
#elif defined(VOICE)
|
||||
SET_VOLUME(g_eeGeneral.speakerVolume+7);
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM) && defined(BLUETOOTH)
|
||||
#if defined(PCBSKY9X) && defined(BLUETOOTH)
|
||||
btInit();
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
rtc_init();
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
||||
|
||||
if (UNEXPECTED_SHUTDOWN()) {
|
||||
@@ -3237,7 +3241,7 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
||||
else {
|
||||
doSplash();
|
||||
|
||||
#if defined(PCBARM) && defined(SDCARD)
|
||||
#if defined(PCBSKY9X) && defined(SDCARD)
|
||||
for (int i=0; i<500 && !Card_initialized; i++) {
|
||||
CoTickDelay(1); // 2ms
|
||||
}
|
||||
@@ -3247,22 +3251,17 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
||||
checkAlarm();
|
||||
}
|
||||
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
if (!g_eeGeneral.unexpectedShutdown) {
|
||||
g_eeGeneral.unexpectedShutdown = 1;
|
||||
eeDirty(EE_GENERAL);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBARM)
|
||||
rtc_init();
|
||||
CoTickDelay(10); // 20ms
|
||||
rtc_init();
|
||||
#endif
|
||||
|
||||
lcdSetContrast();
|
||||
backlightOn();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
start_ppm_capture();
|
||||
// TODO inside startPulses?
|
||||
s_pulses_paused = false;
|
||||
@@ -3276,7 +3275,7 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
void mixerTask(void * pdata)
|
||||
{
|
||||
s_pulses_paused = true;
|
||||
@@ -3369,7 +3368,7 @@ int main(void)
|
||||
// important to disable it before commencing with system initialisation (or
|
||||
// we could put a bunch more wdt_reset()s in. But I don't like that approach
|
||||
// during boot up.)
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
uint8_t mcusr = MCUSR; // save the WDT (etc) flags
|
||||
MCUSR = 0; // must be zeroed before disabling the WDT
|
||||
#elif defined(PCBSTD)
|
||||
@@ -3383,7 +3382,7 @@ int main(void)
|
||||
|
||||
lcd_init();
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
// Init Stack while interrupts are disabled
|
||||
#define STACKPTR _SFR_IO16(0x3D)
|
||||
{
|
||||
@@ -3435,11 +3434,11 @@ int main(void)
|
||||
init_rotary_sw();
|
||||
#endif
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
open9xInit(mcusr);
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (check_soft_power() == e_power_usb) {
|
||||
soft_power_off(); // Only turn power off if necessary
|
||||
|
||||
@@ -3488,12 +3487,12 @@ int main(void)
|
||||
|
||||
CoStartOS();
|
||||
#else
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
uint8_t shutdown_state = 0;
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
if ((shutdown_state=check_soft_power()) > e_power_trainer)
|
||||
break;
|
||||
#endif
|
||||
@@ -3514,9 +3513,9 @@ int main(void)
|
||||
if (t0 > g_timeMainMax) g_timeMainMax = t0;
|
||||
#endif
|
||||
}
|
||||
#endif // PCBARM
|
||||
#endif // PCBSKY9X
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
// Time to switch off
|
||||
lcd_clear() ;
|
||||
displayPopup(STR_SHUTDOWN);
|
||||
|
||||
+32
-32
@@ -50,15 +50,15 @@
|
||||
#define WDT_RESET_STOCK()
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#include "board_ersky9x.h"
|
||||
#elif defined(PCBV4)
|
||||
#if defined(PCBSKY9X)
|
||||
#include "board_sky9x.h"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "board_gruvin9x.h"
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#include "simpgmspace.h"
|
||||
#elif defined(PCBARM)
|
||||
#elif defined(PCBSKY9X)
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
typedef const uint16_t pm_uint16_t;
|
||||
@@ -93,7 +93,7 @@ extern void board_init();
|
||||
|
||||
#define PPM_CENTER 1500
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#include "eeprom_arm.h"
|
||||
#include "pulses_arm.h"
|
||||
#else
|
||||
@@ -127,7 +127,7 @@ extern uint8_t s_bind_allowed;
|
||||
|
||||
#if !defined(SIMU)
|
||||
#define assert(x)
|
||||
#if !defined(PCBARM) || !defined(DEBUG)
|
||||
#if !defined(PCBSKY9X) || !defined(DEBUG)
|
||||
#define printf printf_not_allowed
|
||||
#endif
|
||||
#endif
|
||||
@@ -180,7 +180,7 @@ extern uint8_t s_bind_allowed;
|
||||
#define OUT_C_LCD_RES 2
|
||||
#define OUT_C_LCD_CS1 1
|
||||
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
|
||||
# define INP_L_SPARE6 7
|
||||
# define INP_L_SPARE5 6
|
||||
@@ -295,9 +295,9 @@ extern uint8_t s_bind_allowed;
|
||||
#define DBLKEYS_PRESSED_RGT_UP(i) ((in & ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_UP))) == ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_UP)))
|
||||
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & ((1<<INP_B_KEY_LFT) + (1<<INP_B_KEY_DWN))) == ((1<<INP_B_KEY_LFT) + (1<<INP_B_KEY_DWN)))
|
||||
|
||||
#endif // defined (PCBV4)
|
||||
#endif // defined (PCBGRUVIN9X)
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define SLAVE_MODE (check_soft_power() == e_power_trainer)
|
||||
#else
|
||||
#define SLAVE_MODE (PING & (1<<INP_G_RF_POW))
|
||||
@@ -526,11 +526,11 @@ enum PowerState {
|
||||
e_power_off
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
uint32_t keyState(EnumKeys enuk);
|
||||
uint32_t check_soft_power();
|
||||
#else
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
uint8_t check_soft_power();
|
||||
#else
|
||||
#define check_soft_power() (e_power_on)
|
||||
@@ -629,7 +629,7 @@ extern uint8_t unexpectedShutdown;
|
||||
extern uint8_t g_tmr1Latency_max;
|
||||
extern uint8_t g_tmr1Latency_min;
|
||||
extern uint16_t g_timeMainMax;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
extern uint8_t g_timeMainLast;
|
||||
#endif
|
||||
|
||||
@@ -642,7 +642,7 @@ extern int8_t s_traceCnt;
|
||||
|
||||
extern int8_t *s_trimPtr[NUM_STICKS];
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
static inline uint16_t getTmr2MHz() { return TC1->TC_CHANNEL[0].TC_CV; }
|
||||
#else
|
||||
uint16_t getTmr16KHz();
|
||||
@@ -685,7 +685,7 @@ extern uint8_t s_eeDirtyMsk;
|
||||
|
||||
extern void backlightOn();
|
||||
|
||||
#if defined (PCBARM)
|
||||
#if defined (PCBSKY9X)
|
||||
#define __BACKLIGHT_ON (PWM->PWM_CH_NUM[0].PWM_CDTY = g_eeGeneral.backlightBright)
|
||||
#define __BACKLIGHT_OFF (PWM->PWM_CH_NUM[0].PWM_CDTY = 100)
|
||||
#ifdef REVB
|
||||
@@ -695,7 +695,7 @@ extern void backlightOn();
|
||||
extern uint16_t Analog_values[NUMBER_ANALOG] ;
|
||||
void read_9_adc(void ) ;
|
||||
#endif
|
||||
#elif defined (PCBV4)
|
||||
#elif defined (PCBGRUVIN9X)
|
||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
|
||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
|
||||
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
|
||||
@@ -720,9 +720,9 @@ void read_9_adc(void ) ;
|
||||
#define BUZZER_OFF PORTE &= ~(1 << OUT_E_BUZZER)
|
||||
|
||||
#if defined(HAPTIC)
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define HAPTIC_OFF hapticOff()
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define HAPTIC_ON PORTD &= ~(1 << INP_D_HAPTIC)
|
||||
#define HAPTIC_OFF PORTD |= (1 << INP_D_HAPTIC)
|
||||
#else
|
||||
@@ -752,7 +752,7 @@ template<class t> FORCEINLINE t limit(t mi, t x, t ma) { return min(max(mi,x),ma
|
||||
uint16_t isqrt32(uint32_t n);
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#if !defined(SIMU)
|
||||
extern "C" {
|
||||
#include <CoOS.h>
|
||||
@@ -769,7 +769,7 @@ inline void resumeMixerCalculations()
|
||||
{
|
||||
CoLeaveMutexSection(mixerMutex);
|
||||
}
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
inline void pauseMixerCalculations()
|
||||
{
|
||||
cli();
|
||||
@@ -788,7 +788,7 @@ inline void resumeMixerCalculations()
|
||||
#define resumeMixerCalculations()
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM) || defined(PCBV4)
|
||||
#if defined(PCBSKY9X) || defined(PCBGRUVIN9X)
|
||||
void saveTimers();
|
||||
#else
|
||||
#define saveTimers()
|
||||
@@ -805,7 +805,7 @@ void generalDefault();
|
||||
void modelDefault(uint8_t id);
|
||||
void resetProto();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
inline int32_t calc100toRESX(register int8_t x)
|
||||
{
|
||||
return ((uint32_t)x*655)>>6 ;
|
||||
@@ -833,7 +833,7 @@ extern int16_t calc1000toRESX(int16_t x);
|
||||
extern int16_t calcRESXto1000(int16_t x);
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
// This doesn't need protection on this processor
|
||||
#define tmr10ms_t uint32_t
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
@@ -907,7 +907,7 @@ extern void incSubtrim(uint8_t idx, int16_t inc);
|
||||
extern void instantTrim();
|
||||
extern void moveTrimsToOffsets();
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define ACTIVE_EXPOS_TYPE uint32_t
|
||||
#define ACTIVE_MIXES_TYPE uint64_t
|
||||
#else
|
||||
@@ -932,7 +932,7 @@ inline bool isMixActive(uint8_t mix)
|
||||
#define isMixActive(x) false
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define MASK_FSW_TYPE uint32_t // current max = 32 function switches
|
||||
#else
|
||||
#define MASK_FSW_TYPE uint16_t // current max = 16 function switches
|
||||
@@ -952,7 +952,7 @@ extern char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; // text buffer for frs
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
// Global rotary encoder registers -- 8-bit, 0-255
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint32_t g_rotenc[ROTARY_ENCODERS];
|
||||
#else
|
||||
extern volatile uint8_t g_rotenc[ROTARY_ENCODERS];
|
||||
@@ -994,7 +994,7 @@ extern uint16_t jeti_keys;
|
||||
enum AUDIO_SOUNDS {
|
||||
AU_INACTIVITY,
|
||||
AU_TX_BATTERY_LOW,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
AU_TX_MAH_HIGH,
|
||||
AU_TX_TEMP_HIGH,
|
||||
#endif
|
||||
@@ -1013,7 +1013,7 @@ enum AUDIO_SOUNDS {
|
||||
AU_WARNING2,
|
||||
AU_WARNING3,
|
||||
AU_TRIM_MIDDLE,
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
AU_TRIM_END,
|
||||
#endif
|
||||
AU_TADA,
|
||||
@@ -1046,8 +1046,8 @@ enum AUDIO_SOUNDS {
|
||||
};
|
||||
|
||||
#if defined(AUDIO)
|
||||
#if defined(PCBARM)
|
||||
#include "ersky9x/audio.h"
|
||||
#if defined(PCBSKY9X)
|
||||
#include "sky9x/audio.h"
|
||||
#else
|
||||
#include "stock/audio.h"
|
||||
#endif
|
||||
@@ -1059,7 +1059,7 @@ enum AUDIO_SOUNDS {
|
||||
#include "stock/voice.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4) && defined(VOICE)
|
||||
#if defined(PCBGRUVIN9X) && defined(VOICE)
|
||||
#include "gruvin9x/somo14d.h"
|
||||
#endif
|
||||
|
||||
@@ -1083,7 +1083,7 @@ union ReusableBuffer
|
||||
{
|
||||
/* 128 bytes on stock */
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
uint8_t eefs_buffer[BLOCKS]; // used by EeFsck
|
||||
#endif
|
||||
|
||||
@@ -1118,7 +1118,7 @@ extern union ReusableBuffer reusableBuffer;
|
||||
|
||||
void checkFlashOnBeep();
|
||||
|
||||
#if defined(FRSKY) || defined(PCBARM)
|
||||
#if defined(FRSKY) || defined(PCBSKY9X)
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att);
|
||||
#endif
|
||||
|
||||
|
||||
+15
-15
@@ -61,7 +61,7 @@ void set_timer3_ppm( void ) ;
|
||||
|
||||
void startPulses()
|
||||
{
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#if defined(DSM2_SERIAL)
|
||||
if (g_model.protocol != PROTO_DSM2)
|
||||
#endif
|
||||
@@ -115,7 +115,7 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation (BLOCKING ISR)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if !defined(PCBV4)
|
||||
#if !defined(PCBGRUVIN9X)
|
||||
// Original bitbang for PPM
|
||||
if (s_current_protocol != PROTO_NONE) {
|
||||
if (pulsePol) {
|
||||
@@ -128,7 +128,7 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation (BLOCKING ISR)
|
||||
}
|
||||
}
|
||||
#else
|
||||
// PCBV4 zero jitter hardware toggled PPM_out
|
||||
// PCBGRUVIN9X zero jitter hardware toggled PPM_out
|
||||
OCR1B = *((uint16_t*)pulses2MHzRPtr); // duplicate capture (Timer1 in CTC mode, so restricted to OCR1A for int vector)
|
||||
|
||||
// Toggle bit: Can't read PPM_OUT I/O pin when OC1B is connected (on the ATmega2560 -- can on ATmega64A!)
|
||||
@@ -152,7 +152,7 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation (BLOCKING ISR)
|
||||
|
||||
pulsePol = g_model.pulsePol;
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~(1<<OCIE1A); // stop reentrance (disable Timer1 interrupt)
|
||||
#else
|
||||
TIMSK &= ~(1<<OCIE1A); // stop reentrance (disable Timer1 interrupt)
|
||||
@@ -163,7 +163,7 @@ ISR(TIMER1_COMPA_vect) //2MHz pulse generation (BLOCKING ISR)
|
||||
// if setupPulses changed protocol to one that doesn't use COMPA then don't re-enable.
|
||||
if (!IS_PXX_PROTOCOL(s_current_protocol) && !IS_DSM2_PROTOCOL(s_current_protocol)) {
|
||||
// cli is not needed because for PPM protocols interrupts are not enabled when entering here
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 |= (1<<OCIE1A); // re-enable Timer1 interrupt
|
||||
#else
|
||||
TIMSK |= (1<<OCIE1A); // re-enable Timer1 interrupt
|
||||
@@ -195,7 +195,7 @@ void setupPulsesPPM(uint8_t proto)
|
||||
uint16_t q = (g_model.ppmDelay*50+300)*2; // Stoplen *2
|
||||
uint32_t rest = 22500u*2 - q; // Minimum Framelen=22.5ms
|
||||
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
if (proto == PROTO_PPM) {
|
||||
OCR5A = (uint16_t)0x7d * (45+g_model.ppmFrameLength-g_timeMainLast-2/*1ms*/);
|
||||
TCNT5 = 0;
|
||||
@@ -745,7 +745,7 @@ void setupPulses()
|
||||
OCR1C = 200; // 100 uS
|
||||
TCNT1 = 300; // Past the OCR1C value
|
||||
ICR1 = 44000; // Next frame starts in 22 mS
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~0x2F; // All interrupts off
|
||||
TIFR1 = 0x2F;
|
||||
TIMSK1 |= 0x28; // Enable CAPT and COMPC
|
||||
@@ -769,7 +769,7 @@ void setupPulses()
|
||||
TCNT1 = 0;
|
||||
OCR1B = 6000; // Next frame starts in 3 mS
|
||||
OCR1C = 4000; // Next frame setup in 2 mS
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~0x2F; // All Timer1 interrupts off
|
||||
TIFR1 = 0x2F;
|
||||
TIMSK1 |= (1<<OCIE1B); // Enable COMPB
|
||||
@@ -791,7 +791,7 @@ void setupPulses()
|
||||
TCCR1B = 0; // Stop counter
|
||||
OCR1A = 40000; // Next frame starts in 20 mS
|
||||
TCNT1 = 0;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~0x2F; // All Timer1 interrupts off
|
||||
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
|
||||
TIFR1 = 0x2F;
|
||||
@@ -815,7 +815,7 @@ void setupPulses()
|
||||
case PROTO_PPMSIM:
|
||||
TCCR1B = 0; // Stop counter
|
||||
TCNT1 = 0;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~0x2F; // All Timer1 interrupts off
|
||||
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
|
||||
TIFR1 = 0x2F;
|
||||
@@ -838,7 +838,7 @@ void setupPulses()
|
||||
TCCR1B = 0; // Stop counter
|
||||
OCR1A = 40000; // Next frame starts in 20 mS
|
||||
TCNT1 = 0;
|
||||
#if defined(PCBV4)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
TIMSK1 &= ~0x2F; // All Timer1 interrupts off
|
||||
TIFR1 = 0x2F;
|
||||
TIMSK1 |= (1<<OCIE1A); // Enable COMPA
|
||||
@@ -969,7 +969,7 @@ ISR(TIMER1_COMPC_vect) // DSM2 or PXX end of frame
|
||||
void set_timer3_capture()
|
||||
{
|
||||
#ifndef SIMU
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
||||
#else
|
||||
ETIMSK &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
||||
@@ -980,7 +980,7 @@ void set_timer3_capture()
|
||||
TCCR3A = 0;
|
||||
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
|
||||
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 |= (1<<ICIE3);
|
||||
#else
|
||||
ETIMSK |= (1<<TICIE3);
|
||||
@@ -991,7 +991,7 @@ void set_timer3_capture()
|
||||
void set_timer3_ppm()
|
||||
{
|
||||
#ifndef SIMU
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 &= ~(1<<ICIE3);
|
||||
#else
|
||||
ETIMSK &= ~(1<<TICIE3) ; // Stop capture interrupt
|
||||
@@ -1002,7 +1002,7 @@ void set_timer3_ppm()
|
||||
TCCR3A = (0<<WGM10);
|
||||
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
|
||||
|
||||
#if defined (PCBV4)
|
||||
#if defined (PCBGRUVIN9X)
|
||||
TIMSK3 |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
||||
#else
|
||||
ETIMSK |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
||||
|
||||
+4
-4
@@ -70,7 +70,7 @@ inline const pm_char *SDCARD_ERROR(FRESULT result)
|
||||
// TODO move the ARM function definition here (when cpp)
|
||||
extern void sdPoll10mS();
|
||||
|
||||
#if defined(PCBARM) && !(defined(SIMU))
|
||||
#if defined(PCBSKY9X) && !(defined(SIMU))
|
||||
extern "C" {
|
||||
extern uint32_t sd_card_ready();
|
||||
extern uint32_t sd_card_mounted();
|
||||
@@ -80,13 +80,13 @@ extern uint32_t sd_card_mounted();
|
||||
#define sd_card_mounted() (true)
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
#define O9X_FOURCC 0x3278396F // o9x for sky9x
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define O9X_FOURCC 0x3178396F // o9x for gruvin9x
|
||||
#endif
|
||||
|
||||
#if defined(PCBV4) || defined(SIMU)
|
||||
#if defined(PCBGRUVIN9X) || defined(SIMU)
|
||||
#define SD_IS_HC() (0)
|
||||
#define SD_GET_BLOCKNR() (0)
|
||||
#define SD_GET_SIZE_MB() (0)
|
||||
|
||||
+14
-14
@@ -42,7 +42,7 @@ uint16_t dummyport16;
|
||||
const char *eepromFile = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
Pio Pioa, Piob, Pioc;
|
||||
Pwm pwm;
|
||||
Twi Twio;
|
||||
@@ -66,10 +66,10 @@ void setSwitch(int8_t swtch)
|
||||
{
|
||||
switch (swtch) {
|
||||
case DSW_ID0:
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PIOC->PIO_PDSR &= ~0x00004000;
|
||||
PIOC->PIO_PDSR |= 0x00000800;
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
ping |= (1<<INP_G_ID1);
|
||||
pinb &= ~(1<<INP_B_ID2);
|
||||
#else
|
||||
@@ -78,9 +78,9 @@ void setSwitch(int8_t swtch)
|
||||
#endif
|
||||
break;
|
||||
case DSW_ID1:
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PIOC->PIO_PDSR |= 0x00004800;
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
ping &= ~(1<<INP_G_ID1);
|
||||
pinb &= ~(1<<INP_B_ID2);
|
||||
#else
|
||||
@@ -89,10 +89,10 @@ void setSwitch(int8_t swtch)
|
||||
#endif
|
||||
break;
|
||||
case DSW_ID2:
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PIOC->PIO_PDSR &= ~0x00000800;
|
||||
PIOC->PIO_PDSR |= 0x00004000;
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
ping &= ~(1<<INP_G_ID1);
|
||||
pinb |= (1<<INP_B_ID2);
|
||||
#else
|
||||
@@ -111,7 +111,7 @@ void *eeprom_write_function(void *)
|
||||
while (!sem_wait(eeprom_write_sem)) {
|
||||
if (!eeprom_thread_running)
|
||||
return NULL;
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (eeprom_read_operation) {
|
||||
assert(eeprom_buffer_size);
|
||||
eeprom_read_block(eeprom_buffer_data, (const void *)(int64_t)eeprom_pointer, eeprom_buffer_size);
|
||||
@@ -128,7 +128,7 @@ void *eeprom_write_function(void *)
|
||||
if (fp) {
|
||||
if (fwrite(eeprom_buffer_data, 1, 1, fp) != 1)
|
||||
perror("error in fwrite");
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
sleep(5/*ms*/);
|
||||
#endif
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void *eeprom_write_function(void *)
|
||||
fflush(fp);
|
||||
}
|
||||
}
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
}
|
||||
Spi_complete = 1;
|
||||
#endif
|
||||
@@ -167,7 +167,7 @@ void *main_thread(void *)
|
||||
g_menuStack[0] = menuMainView;
|
||||
g_menuStack[1] = menuProcModelSelect;
|
||||
|
||||
#ifdef PCBARM
|
||||
#ifdef PCBSKY9X
|
||||
eeprom_init();
|
||||
#endif
|
||||
|
||||
@@ -180,7 +180,7 @@ void *main_thread(void *)
|
||||
doSplash();
|
||||
#endif
|
||||
|
||||
#if !defined(PCBARM)
|
||||
#if !defined(PCBSKY9X)
|
||||
checkLowEEPROM();
|
||||
#endif
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace simu {
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
FATFS g_FATFS_Obj;
|
||||
#endif
|
||||
|
||||
@@ -412,7 +412,7 @@ FRESULT f_getcwd (TCHAR *path, UINT sz_path)
|
||||
return FR_OK;
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
int32_t Card_state = SD_ST_MOUNTED;
|
||||
uint32_t Card_CSD[4]; // TODO elsewhere
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
|
||||
extern sem_t *eeprom_write_sem;
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
extern Pio Pioa, Piob, Pioc;
|
||||
extern Twi Twio;
|
||||
extern Dacc dacc;
|
||||
@@ -263,7 +263,7 @@ extern void rxPdcUsart( void (*pChProcess)(uint8_t x) );
|
||||
#define UPE0 0
|
||||
#define FE0 0
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint32_t Tenms;
|
||||
extern uint32_t Master_frequency;
|
||||
#define NVIC_EnableIRQ(x)
|
||||
|
||||
+16
-16
@@ -269,7 +269,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
KEY_Left, INP_B_KEY_LFT, INP_L_KEY_LFT, (uint64_t)PIOC, ERSKY9X_LEFT_MASK,
|
||||
};
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PIOC->PIO_PDSR |= ERSKY9X_DOWN_MASK | ERSKY9X_UP_MASK | ERSKY9X_RIGHT_MASK | ERSKY9X_LEFT_MASK ;
|
||||
ERSKY9X_EXIT_PIO->PIO_PDSR |= ERSKY9X_EXIT_MASK;
|
||||
PIOB->PIO_PDSR |= ERSKY9X_MENU_MASK;
|
||||
@@ -277,7 +277,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
temperature = 67;
|
||||
maxTemperature = 70;
|
||||
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
uint8_t pin = (pinl & ~0x3f);
|
||||
#else
|
||||
uint8_t pin = (pinb & ~0x7e);
|
||||
@@ -285,9 +285,9 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
|
||||
for(unsigned i=0; i<DIM(keys1);i+=5) {
|
||||
if (getApp()->getKeyState(keys1[i])) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
((Pio*)keys1[i+3])->PIO_PDSR &= ~(keys1[i+4]);
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
pin |= (1<<keys1[i+2]);
|
||||
#else
|
||||
pin |= (1<<keys1[i+1]);
|
||||
@@ -295,8 +295,8 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#elif defined(PCBV4)
|
||||
#if defined(PCBSKY9X)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
pinl = pin;
|
||||
#else
|
||||
pinb = pin;
|
||||
@@ -310,18 +310,18 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
#else
|
||||
static FXuint keys2[]={KEY_F8, KEY_F7, KEY_F4, KEY_F3, KEY_F6, KEY_F5, KEY_F1, KEY_F2 };
|
||||
#endif
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
PIOA->PIO_PDSR |= (0x00800000 | 0x01000000 | 0x00000002 | 0x00000001);
|
||||
PIOB->PIO_PDSR |= (0x00000010);
|
||||
PIOC->PIO_PDSR |= (0x10000000 | 0x00000400 | 0x00000200);
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
pinj = 0;
|
||||
#else
|
||||
pind = 0;
|
||||
#endif
|
||||
for(unsigned i=0; i<DIM(keys2);i++){
|
||||
if(getApp()->getKeyState(keys2[i])) {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
switch(i) {
|
||||
case 6:
|
||||
PIOA->PIO_PDSR &= ~0x00800000;
|
||||
@@ -348,7 +348,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
PIOC->PIO_PDSR &= ~0x00000200;
|
||||
break;
|
||||
}
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
pinj |= (1<<i);
|
||||
#else
|
||||
pind |= (1<<i);
|
||||
@@ -356,7 +356,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
struct SwitchKey {
|
||||
FXuint key;
|
||||
volatile uint32_t & pin;
|
||||
@@ -373,7 +373,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
#endif
|
||||
|
||||
static SwitchKey keys3[] = {
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
{ KEY_1, PIOC->PIO_PDSR, 20, 0 },
|
||||
{ KEY_6, PIOA->PIO_PDSR, 2, 0 },
|
||||
{ KEY_2, PIOA->PIO_PDSR, 15, 0 },
|
||||
@@ -381,7 +381,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
||||
{ KEY_7, PIOC->PIO_PDSR, 16, 0 },
|
||||
{ KEY_8, PIOC->PIO_PDSR, 8, 0 } };
|
||||
#else
|
||||
#if defined(PCBV4) || defined(JETI) || defined(FRSKY) || defined(NMEA) || defined(ARDUPILOT)
|
||||
#if defined(PCBGRUVIN9X) || defined(JETI) || defined(FRSKY) || defined(NMEA) || defined(ARDUPILOT)
|
||||
{ KEY_1, pinc, INP_C_ThrCt, 0 },
|
||||
{ KEY_6, pinc, INP_C_AileDR, 0 },
|
||||
#else
|
||||
@@ -437,9 +437,9 @@ void Open9xSim::refreshDiplay()
|
||||
{
|
||||
if (lcd_refresh) {
|
||||
lcd_refresh = false;
|
||||
#if defined(PCBARM)
|
||||
#if defined(PCBSKY9X)
|
||||
if (PWM->PWM_CH_NUM[0].PWM_CDTY != 100)
|
||||
#elif defined(PCBV4)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
if (portc & 1<<OUT_C_LIGHT)
|
||||
#else
|
||||
if (portb & 1<<OUT_B_LIGHT)
|
||||
@@ -526,7 +526,7 @@ int main(int argc,char **argv)
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
if (chan == 7)
|
||||
#ifdef PCBV4
|
||||
#ifdef PCBGRUVIN9X
|
||||
return 150;
|
||||
#else
|
||||
return 1500;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// TODO merge this file with board_ersky9x.h
|
||||
// TODO merge this file with board_sky9x.h
|
||||
|
||||
#ifndef board_h
|
||||
#define board_h
|
||||
@@ -225,7 +225,6 @@ void init_twi()
|
||||
TWI0->TWI_CR = TWI_CR_MSEN | TWI_CR_SVDIS ; // Master mode enable
|
||||
TWI0->TWI_MMR = 0x002F0000 ; // Device 5E (>>1) and master is writing
|
||||
NVIC_EnableIRQ(TWI0_IRQn) ;
|
||||
setVolume(2) ;
|
||||
}
|
||||
|
||||
static int8_t Volume_required ;
|
||||
@@ -271,5 +271,20 @@ extern unsigned char USBD_IsHighSpeed(void);
|
||||
|
||||
extern void USBD_Test(unsigned char bIndex);
|
||||
|
||||
/* USBD Callbacks */
|
||||
|
||||
#define USBDCallbacks_Reset()
|
||||
|
||||
#define USBDCallbacks_Suspended()
|
||||
|
||||
#define USBDCallbacks_Resumed()
|
||||
|
||||
extern void USBDCallbacks_RequestReceived(const USBGenericRequest *request);
|
||||
|
||||
extern void USBDDriverCallbacks_ConfigurationChanged(unsigned char cfgnum);
|
||||
|
||||
extern void USBDDriverCallbacks_InterfaceSettingChanged(unsigned char interface,
|
||||
unsigned char setting);
|
||||
|
||||
#endif //#ifndef USBD_H
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "USBDDriver.h"
|
||||
#include "USBDDriverCallbacks.h"
|
||||
#include "USBD.h"
|
||||
#include <board.h>
|
||||
#include "debug.h"
|
||||
@@ -370,7 +369,7 @@ static void SetInterface(
|
||||
if (pDriver->pInterfaces[infnum] != setting) {
|
||||
|
||||
pDriver->pInterfaces[infnum] = setting;
|
||||
USBDDriverCallbacks_InterfaceSettingChanged(infnum, setting);
|
||||
// USBDDriverCallbacks_InterfaceSettingChanged(infnum, setting);
|
||||
}
|
||||
|
||||
// Acknowledge the request
|
||||
@@ -42,16 +42,11 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "USBD.h"
|
||||
#include "USBDCallbacks.h"
|
||||
#include <board.h>
|
||||
//#include <pio/pio.h>
|
||||
#include "debug.h"
|
||||
//#include <pmc.h>
|
||||
//#include <utility/led.h>
|
||||
#include <usb/common/core/USBEndpointDescriptor.h>
|
||||
#include <usb/common/core/USBGenericRequest.h>
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Local definitions
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -1713,7 +1708,7 @@ void USBD_Init(void)
|
||||
UDP->UDP_IER = UDP_IER_WAKEUP;
|
||||
|
||||
// Configure interrupts
|
||||
USBDCallbacks_Initialized();
|
||||
NVIC_EnableIRQ(UDP_IRQn);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
-2
@@ -39,9 +39,7 @@
|
||||
#include <usb/common/core/USBGenericRequest.h>
|
||||
#include <usb/common/core/USBFeatureRequest.h>
|
||||
#include <usb/device/core/USBD.h>
|
||||
#include <usb/device/core/USBDCallbacks.h>
|
||||
#include <usb/device/core/USBDDriver.h>
|
||||
#include <usb/device/core/USBDDriverCallbacks.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Internal variables
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user