Bsongis/9x fixes (#4463)

[9x] Fixes + make firmware target added
This commit is contained in:
Bertrand Songis
2017-02-17 17:11:38 +01:00
committed by GitHub
parent 6106d1b228
commit 3e84e7930c
20 changed files with 209 additions and 187 deletions
+1
View File
@@ -2,6 +2,7 @@ option(SP22 "SmartieParts 2.2 Backlight support" OFF)
option(PWM_BACKLIGHT "PWM Backlight" OFF)
set(ARCH AVR)
set(MCU atmega64)
set(AVRDUDE_MCU m64)
string(TOLOWER ${PCB} FLAVOUR)
set(EEPROM_VARIANT_NEEDED ON)
set(EEPROM EEPROM_RLC)
+27 -37
View File
@@ -23,53 +23,51 @@
#if defined(ROTARY_ENCODER_NAVIGATION)
#if defined(TELEMETREZ)
uint8_t TrotCount ; // TeZ version
uint8_t LastTrotCount ; // TeZ version
uint8_t RotEncoder ;
#define ROTENC_DOWN() (RotEncoder != 0)
uint8_t TrotCount; // TeZ version
uint8_t LastTrotCount; // TeZ version
uint8_t RotEncoder;
#else
uint8_t RotPosition ;
int8_t LastRotaryValue ;
int8_t Rotary_diff ;
int8_t RotaryControl ;
uint8_t RotEncoder ;
#define ROTENC_DOWN() (RotEncoder & 0x20)
uint8_t RotPosition;
int8_t LastRotaryValue;
int8_t Rotary_diff;
int8_t RotaryControl;
uint8_t RotEncoder;
#endif
void rotencPoll()
{
#if defined(TELEMETREZ)
if (TrotCount != LastTrotCount) {
rotencValue[0] = LastTrotCount = TrotCount ;
rotencValue[0] = LastTrotCount = TrotCount;
}
#else
// Rotary Encoder polling
PORTA = 0 ; // No pullups
DDRA = 0x1F ; // Top 3 bits input
PORTA = 0; // No pullups
DDRA = 0x1F; // Top 3 bits input
asm(" rjmp 1f") ;
asm("1:") ;
asm(" rjmp 1f");
asm("1:");
uint8_t rotary ;
rotary = PINA ;
DDRA = 0xFF ; // Back to all outputs
rotary &= 0xE0 ;
uint8_t rotary;
rotary = PINA;
DDRA = 0xFF; // Back to all outputs
rotary &= 0xE0;
RotEncoder = rotary ; // just read the lcd pin
RotEncoder = rotary; // just read the lcd pin
rotary &= 0xDF ;
rotary &= 0xDF;
if ( rotary != RotPosition ) {
uint8_t x ;
x = RotPosition & 0x40 ;
x <<= 1 ;
x ^= rotary & 0x80 ;
uint8_t x;
x = RotPosition & 0x40;
x <<= 1;
x ^= rotary & 0x80;
if ( x ) {
rotencValue[0] -= 1 ;
rotencValue[0] -= 1;
}
else {
rotencValue[0] += 1 ;
rotencValue[0] += 1;
}
RotPosition = rotary ;
RotPosition = rotary;
}
#endif // TELEMETREZ
}
@@ -140,14 +138,6 @@ void boardInit()
#endif // !defined(SIMU)
}
#ifndef SIMU
FORCEINLINE
#endif
uint8_t keyDown()
{
return ((~PINB) & 0x7E) | ROTENC_DOWN();
}
#if !defined(SIMU) && (defined(TELEMETRY_MOD_14051) || defined(TELEMETRY_MOD_14051_SWAPPED))
uint8_t pf7_digital[MUX_PF7_DIGITAL_MAX - MUX_PF7_DIGITAL_MIN + 1];
/**
@@ -306,7 +296,7 @@ void readKeysAndTrims()
#if defined(NAVIGATION_STICKS)
if (~PINB & 0x7E) {
StickScrollTimer = STICK_SCROLL_TIMEOUT ;
StickScrollTimer = STICK_SCROLL_TIMEOUT;
}
#endif
}
+17
View File
@@ -183,7 +183,24 @@ bool checkSlaveMode();
#define INP_G_RF_POW 1
#define INP_G_RuddDR 0
// Rotary Encoder driver
#if defined(ROTARY_ENCODER_NAVIGATION)
extern uint8_t RotEncoder;
#if defined(TELEMETREZ)
#define ROTENC_DOWN() (RotEncoder != 0)
#else
#define ROTENC_DOWN() (RotEncoder & 0x20)
#endif
#else
#define ROTENC_DOWN() (0)
#endif
// Keys driver
inline uint8_t keyDown()
{
return ((~PINB) & 0x7E) | ROTENC_DOWN();
}
#if defined(TELEMETRY_MOD_14051) || defined(TELEMETRY_MOD_14051_SWAPPED)
enum MuxInput {
MUX_BATT,