MEGA2560 update

This commit is contained in:
JivaroFAD
2014-09-21 20:26:19 +02:00
parent 37e6819a57
commit f39650bf16
3 changed files with 170 additions and 208 deletions
+49 -81
View File
@@ -37,33 +37,26 @@
#include "../../opentx.h"
#ifndef SIMU
inline void boardInit() // Done 2013.10.09 : trims, keyboard, LCD, ID1+2 SW warning PORTF-3 (1.2V ADC_ref)
inline void boardInit()
{
// Set up I/O port data directions and initial states
// Set up I/O port data directions and initial states (unused pin setting : input, pull-up on)
DDRA = 0b11111111; PORTA = 0b00000000; // LCD data
DDRB = 0b11000111; PORTB = 0b00111111; // 7:SPKR, 6:PPM_OUT, 5:TrainSW, 4:xxxxx, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
DDRC = 0b11111100; PORTC = 0b00000011; // LCD[7,6,5,4,3], 2:BackLight, 1:ID2_Sw, 0:ID1_Sw
DDRD = 0b11000000; PORTD = 0b11111100; // 7:VIB, 6:LED BL, 5:RENC2_PUSH, 4:RENC1_PUSH, 3:RENC2_B, 2:RENC2_A, 1:I2C_SDA, 0:I2C_SCL
DDRE = 0b00001010; PORTE = 0b11110100; // 7:PPM_IN, 6: RENC1_B, 5:RENC1_A, 4:USB_DNEG, 3:BUZZER, 2:USB_DPOS, 1:TELEM_TX, 0:TELEM_RX(pull-up off)
//DDRF = 0b00000000; PORTF = 0b00000000; // 7-4:JTAG, 3:ADC_REF_1.2V input, 2-0:ADC_SPARE_2-0
DDRB = 0b01000111; PORTB = 0b00101111; // 7:PPM_IN 6:PPM_OUT, 5:SimCTRL, 4:Buzzer, SDCARD[3:MISO 2:MOSI 1:SCK 0:CS]
DDRC = 0b11111100; PORTC = 0b00000011; // 7-3:LCD, 2:BackLight, 1:ID2_SW, 0:ID1_SW
DDRD = 0b00000000; PORTD = 0b11110000; // 7:AilDR_SW, 6:N/A, 5:N/A, 4:N/A, 3:RENC2_B, 2:RENC2_A, 1:RENC1_B, 0:RENC1_A
DDRE = 0b00001010; PORTE = 0b11110100; // 7:N/A, 6:N/A, 5:N/A, 4:N/A, 3:Buzzer(old), 2:N/A, 1:TELEM_TX, 0:TELEM_RX(pull-up off)
DDRF = 0b00000000; PORTF = 0b11111111; // 7-0:Trim switch inputs
DDRG = 0b00010000; PORTG = 0b00111111; // 7-6:N/A, 5:GearSW, 4: Sim_Ctrl[out], 3:xxxxx, 2:TCut_Sw, 1:RF_Power[in], 0: RudDr_Sw
DDRH = 0b10111000; PORTH = 0b11010111; // [7:0 DSM/PPM TX-caddy control. 1=PPM, 0=DSM ]
// [6:SOMO14D-BUSY 5:SOMO14D-DATA 4:SOMO14D-CLK 3:SOMO14D-RESET]
// [2:VIB_OPTION -- setting to input for now]
// [1:TxD 0:RxD Spare serial port]
//DDRJ = 0b00000000; PORTJ = 0b11111111; // 7-0:Trim switch inputs
DDRG = 0b00000000; PORTG = 0b11111111; // 7:N/A, 6:N/A, 5:N/A, 4:N/A, 3:N/A, 2:TCut_SW, 1:Gear_SW, 0: RudDr_SW
DDRH = 0b00011000; PORTH = 0b11010111; // 7:N/A, 6:RFPw, 5:JackPres, 4:HoldPw, 3:Speaker, 2:N/A, 1:N/A, 0:N/A
DDRJ = 0b00000000; PORTJ = 0b11111111; // 7:N/A, 6:N/A, 5:N/A, 4:N/A, 3:N/A, 2:N/A, 1:RENC2_push, 0:RENC1_push
DDRK = 0b00000000; PORTK = 0b00000000; // Analogic input (no pull-ups)
DDRL = 0b10000000; PORTL = 0b11111111; // 7: Hold_PWR_On (1=On, default Off), 6:Jack_Presence_TTL, 5-0: Keyboard inputs
ADMUX=ADC_VREF_TYPE;
DDRL = 0b00000000; PORTL = 0b11111111; // 7:TRN_SW 6:EleDR_SW, 5:ESC, 4:MENU 3:Keyb_Left, 2:Keyb_Right, 1:Keyb_Up, 0:Keyb_Down
ADMUX=ADC_VREF_TYPE; // need to be set to internal reference
ADCSRA=0x85; // ADC enabled, pre-scaler division=32 (no interrupt, no auto-triggering)
ADCSRB=(1<<MUX5);
/**** Set up timer/counter 0 ****/
/** Move old 64A Timer0 functions to Timer2 and use WGM on OC0(A) (PB7) for spkear tone output **/
// TCNT0 10ms = 16MHz/1024/156(.25) periodic timer (100ms interval)
// cycles at 9.984ms but includes 1:4 duty cycle correction to /157 to average at 10.0ms
TCCR2B = (0b111 << CS20); // Norm mode, clk/1024 (differs from ATmega64 chip)
@@ -71,12 +64,11 @@ inline void boardInit() // Done 2013.10.09 : trims, keyboard, LCD, ID
TIMSK2 |= (1<<OCIE2A) | (1<<TOIE2); // Enable Output-Compare and Overflow interrrupts
// Set up Phase correct Waveform Gen. mode, at clk/64 = 250,000 counts/second
// (Higher speed allows for finer control of frquencies in the audio range.)
// (Higher speed allows for finer control of frequencies in the audio range.)
// Used for audio tone generation
TCCR0B = (1<<WGM02) | (0b011 << CS00);
TCCR0A = (0b01<<WGM00);
/***************************************************/
/* Rotary encoder interrupt set-up */
EIMSK = 0; // disable ALL external interrupts.
// encoder 1
@@ -86,25 +78,14 @@ inline void boardInit() // Done 2013.10.09 : trims, keyboard, LCD, ID
EICRA = (1<<ISC30) | (1<<ISC20); // do the same for encoder 1
EIFR = (3<<INTF2);
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
/***************************************************/
#if defined (VOICE)
/*
* SOMO set-up (V4 board only)
*/
OCR4A = 0x1F4; //2ms
TCCR4B = (1 << WGM42) | (0b011 << CS40); // CTC OCR1A, 16MHz / 64 (4us ticks)
TIMSK4 |= (1<<OCIE4A); // Start the interrupt so the unit reset can occur
#endif
}
#endif // !SIMU
uint8_t pwrCheck()
{
#if !defined(SIMU) && !defined(REV0)
if ((PING & 0b00000010) && (~PINL & 0b01000000))
return e_power_off;
#if !defined(SIMU) //&& !defined(REV0)
//if ((PING & 0b00000010) && (~PINL & 0b01000000)) //temporary disabled
//return e_power_off;
#endif
return e_power_on;
}
@@ -112,7 +93,7 @@ uint8_t pwrCheck()
void pwrOff()
{
#ifndef REV0
PORTL = 0x7f;
PORTL = 0b11111111; //to check !
#endif
}
@@ -129,22 +110,22 @@ bool switchState(EnumKeys enuk)
return keys[enuk].state() ? 1 : 0;
switch(enuk){
//case SW_ELE:
// result = PINC & (1<<INP_C_ElevDR);
// break;
case SW_ELE:
result = PINL & (1<<INP_L_ElevDR);
break;
//case SW_AIL:
// result = PINC & (1<<INP_C_AileDR);
// break;
case SW_AIL:
result = PIND & (1<<INP_D_AileDR);
break;
case SW_RUD:
result = PING & (1<<INP_G_RuddDR);
break;
// INP_G_ID1 INP_B_ID2
// id0 0 1
// id1 1 1
// id2 1 0
// INP_C_ID1 INP_C_ID2
// ID0 0 1
// ID1 1 1
// ID2 1 0
case SW_ID0:
result = !(PINC & (1<<INP_C_ID1));
break;
@@ -180,7 +161,7 @@ bool switchState(EnumKeys enuk)
break;
case SW_TRN:
result = PINB & (1<<INP_B_Trainer);
result = PINL & (1<<INP_L_Trainer);
break;
default:
@@ -190,42 +171,31 @@ bool switchState(EnumKeys enuk)
return result;
}
// Trim switches ...
// Trim switches
static const pm_uchar crossTrim[] PROGMEM ={
1<<INP_F_TRM_LH_DWN,
1<<INP_F_TRM_LH_UP,
1<<INP_F_TRM_LV_DWN,
1<<INP_F_TRM_LV_UP,
1<<INP_F_TRM_RV_DWN,
1<<INP_F_TRM_RV_UP,
1<<INP_F_TRM_RH_DWN,
1<<INP_F_TRM_RH_UP
1<<INP_F_TRM_LH_DWN,
1<<INP_F_TRM_LH_UP,
1<<INP_F_TRM_LV_DWN,
1<<INP_F_TRM_LV_UP,
1<<INP_F_TRM_RV_DWN,
1<<INP_F_TRM_RV_UP,
1<<INP_F_TRM_RH_DWN,
1<<INP_F_TRM_RH_UP
};
uint8_t trimDown(uint8_t idx)
{
uint8_t in = ~PIND;
uint8_t in = ~PINF; //was PIND
return (in & pgm_read_byte(crossTrim+idx));
}
FORCEINLINE void readKeysAndTrims()
{
/* Original keys were connected to PORTB as follows:
Bit Key
7 other use
6 LEFT
5 RIGHT
4 UP
3 DOWN
2 EXIT
1 MENU
0 other use
*/
uint8_t enuk = KEY_MENU;
// User buttons ...
keys[BTN_REa].input(~PINJ & 0b00000001, BTN_REa);
keys[BTN_REb].input(~PINJ & 0b00000010, BTN_REb);
uint8_t tin = ~PINL;
uint8_t in;
in = (tin & 0x0f) << 3;
@@ -237,18 +207,16 @@ FORCEINLINE void readKeysAndTrims()
++enuk;
}
// Trims ...
// Trims
in = ~PINF;
for (int i=0; i<8; i++) {
// INP_D_TRM_RH_UP 0 .. INP_D_TRM_LH_UP 7
keys[enuk].input(in & pgm_read_byte(crossTrim+i),(EnumKeys)enuk);
++enuk;
}
keys[BTN_REa].input(REA_DOWN(), BTN_REa);
keys[BTN_REb].input(REB_DOWN(), BTN_REb);
}
ISR(INT2_vect)
{
uint8_t input = (PIND & 0x0C);
@@ -263,12 +231,12 @@ ISR(INT3_vect)
ISR(INT5_vect)
{
uint8_t input = (PINE & 0x60);
if (input == 0 || input == 0x60) incRotaryEncoder(1, +1);
uint8_t input = (PIND & 0x03);
if (input == 0 || input == 0x03) incRotaryEncoder(1, +1);
}
ISR(INT6_vect)
{
uint8_t input = (PINE & 0x60);
if (input == 0 || input == 0x60) incRotaryEncoder(1, -1);
uint8_t input = (PIND & 0x03);
if (input == 0 || input == 0x03) incRotaryEncoder(1, -1);
}
+119 -125
View File
@@ -39,35 +39,35 @@
#include "../common_avr/board_avr.h"
#define GPIO_BUTTON_MENU pinl
#define GPIO_BUTTON_EXIT pinl
#define GPIO_BUTTON_RIGHT pinl
#define GPIO_BUTTON_LEFT pinl
#define GPIO_BUTTON_UP pinl
#define GPIO_BUTTON_DOWN pinl
#define PIN_BUTTON_MENU (1<<INP_L_KEY_MEN)
#define PIN_BUTTON_EXIT (1<<INP_L_KEY_EXT)
#define PIN_BUTTON_UP (1<<INP_L_KEY_UP)
#define PIN_BUTTON_DOWN (1<<INP_L_KEY_DWN)
#define PIN_BUTTON_RIGHT (1<<INP_L_KEY_RGT)
#define PIN_BUTTON_LEFT (1<<INP_L_KEY_LFT)
#define GPIO_BUTTON_MENU pinl //ok
#define GPIO_BUTTON_EXIT pinl //ok
#define GPIO_BUTTON_RIGHT pinl //ok
#define GPIO_BUTTON_LEFT pinl //ok
#define GPIO_BUTTON_UP pinl //ok
#define GPIO_BUTTON_DOWN pinl //ok
#define PIN_BUTTON_MENU (1<<INP_L_KEY_MEN) //ok
#define PIN_BUTTON_EXIT (1<<INP_L_KEY_EXT) //ok
#define PIN_BUTTON_UP (1<<INP_L_KEY_UP) //ok
#define PIN_BUTTON_DOWN (1<<INP_L_KEY_DWN) //ok
#define PIN_BUTTON_RIGHT (1<<INP_L_KEY_RGT) //ok
#define PIN_BUTTON_LEFT (1<<INP_L_KEY_LFT) //ok
#define GPIO_TRIM_LH_L pinf
#define GPIO_TRIM_LV_DN pinf
#define GPIO_TRIM_RV_UP pinf
#define GPIO_TRIM_RH_L pinf
#define GPIO_TRIM_LH_R pinf
#define GPIO_TRIM_LV_UP pinf
#define GPIO_TRIM_RV_DN pinf
#define GPIO_TRIM_RH_R pinf
#define PIN_TRIM_LH_L (1<<INP_F_TRM_LH_DWN)
#define PIN_TRIM_LV_DN (1<<INP_F_TRM_LV_DWN)
#define PIN_TRIM_RV_UP (1<<INP_F_TRM_RV_UP)
#define PIN_TRIM_RH_L (1<<INP_F_TRM_RH_DWN)
#define PIN_TRIM_LH_R (1<<INP_F_TRM_LH_UP)
#define PIN_TRIM_LV_UP (1<<INP_F_TRM_LV_UP)
#define PIN_TRIM_RV_DN (1<<INP_F_TRM_RV_DWN)
#define PIN_TRIM_RH_R (1<<INP_F_TRM_RH_UP)
#define GPIO_TRIM_LH_L pinf //ok
#define GPIO_TRIM_LV_DN pinf //ok
#define GPIO_TRIM_RV_UP pinf //ok
#define GPIO_TRIM_RH_L pinf //ok
#define GPIO_TRIM_LH_R pinf //ok
#define GPIO_TRIM_LV_UP pinf //ok
#define GPIO_TRIM_RV_DN pinf //ok
#define GPIO_TRIM_RH_R pinf //ok
#define PIN_TRIM_LH_L (1<<INP_F_TRM_LH_DWN) //ok
#define PIN_TRIM_LV_DN (1<<INP_F_TRM_LV_DWN) //ok
#define PIN_TRIM_RV_UP (1<<INP_F_TRM_RV_UP) //ok
#define PIN_TRIM_RH_L (1<<INP_F_TRM_RH_DWN) //ok
#define PIN_TRIM_LH_R (1<<INP_F_TRM_LH_UP) //ok
#define PIN_TRIM_LV_UP (1<<INP_F_TRM_LV_UP) //ok
#define PIN_TRIM_RV_DN (1<<INP_F_TRM_RV_DWN) //ok
#define PIN_TRIM_RH_R (1<<INP_F_TRM_RH_UP) //ok
#define TIMER_16KHZ_VECT TIMER2_OVF_vect
#define COUNTER_16KHZ TCNT2
@@ -78,107 +78,108 @@
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
#define SLAVE_MODE() (PING & (1<<INP_G_RF_POW))
#define JACK_PPM_OUT() PORTG |= (1<<OUT_G_SIM_CTL)
#define JACK_PPM_IN() PORTG &= ~(1<<OUT_G_SIM_CTL)
// SD driver
#define sdDone()
#if !defined(SIMU)
bool sdMounted();
void sdMountPoll();
void sdPoll10ms();
#define SD_IS_HC() (0)
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SIZE_MB() (0)
#define SD_GET_SPEED() (0)
#endif
#define SLAVE_MODE() (PINH & (1<<INP_H_RF_POW))
#define JACK_PPM_OUT() PORTB |= (1<<OUT_B_SIM_CTL)
#define JACK_PPM_IN() PORTB &= ~(1<<OUT_B_SIM_CTL)
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT)
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT))
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT) //ok
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT) //ok
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT)) //ok
# define INP_L_SPARE6 7
# define INP_L_SPARE5 6
# define INP_L_KEY_EXT 5
# define INP_L_KEY_MEN 4
# define INP_L_KEY_LFT 3
# define INP_L_KEY_RGT 2
# define INP_L_KEY_UP 1
# define INP_L_KEY_DWN 0
# define INP_F_TRM_RH_UP 7
# define INP_F_TRM_RH_DWN 6
# define INP_F_TRM_RV_UP 5
# define INP_F_TRM_RV_DWN 4
# define INP_F_TRM_LV_UP 3
# define INP_F_TRM_LV_DWN 2
# define INP_F_TRM_LH_UP 1
# define INP_F_TRM_LH_DWN 0
# define INP_E_PPM_IN 7
# define INP_E_ROT_ENC_1_B 6
# define INP_E_ROT_ENC_1_A 5
# define INP_E_USB_D_PLS 4
# define OUT_E_BUZZER 3
# define INP_E_USB_D_NEG 2
# define INP_E_TELEM_RX 1
# define OUT_E_TELEM_TX 0
# define OUT_D_HAPTIC 7
# define INP_D_SPARE4 6
# define INP_D_ROT_ENC_2_PUSH 5
# define INP_D_ROT_ENC_1_PUSH 4
# define OUT_D_ROT_ENC_2_B 3
# define INP_D_ROT_ENC_2_A 2
# define INP_D_I2C_SCL 1
# define INP_D_I2C_SDA 0
# define INP_G_Gear 5
# define INP_G_ThrCt 2
# define OUT_G_SIM_CTL 4 //1 : phone-jack=ppm_in
# define INP_C_ID1 0
# define INP_C_ID2 1
# define INP_G_RF_POW 1
# define INP_G_RuddDR 0
# define INP_C_AileDR 7
# define INP_C_ElevDR 6
# define OUT_C_LIGHT 2
# define OUT_B_Speaker 7
# define OUT_B_PPM 6
# define INP_B_Trainer 5
#if defined(VOICE)
# define OUT_H_14DRESET 3
# define OUT_H_14DCLK 4
# define OUT_H_14DDATA 5
# define INP_H_14DBUSY 6
// SD driver //to verify
#define sdDone()
#if !defined(SIMU)
bool sdMounted();
void sdMountPoll();
void sdPoll10ms();
#define SD_IS_HC() (0)
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SIZE_MB() (0)
#define SD_GET_SPEED() (0)
#endif
// Keys driver
#define TRIMS_PRESSED() (~PINJ)
#define KEYS_PRESSED() (~PINL) // used only for DBLKEYS code.
// Keyboard driver
# define INP_L_KEY_EXT 5 //ok
# define INP_L_KEY_MEN 4 //ok
# define INP_L_KEY_LFT 3 //ok
# define INP_L_KEY_RGT 2 //ok
# define INP_L_KEY_UP 1 //ok
# define INP_L_KEY_DWN 0 //ok
// Trims driver
# define INP_F_TRM_RH_UP 7 //ok
# define INP_F_TRM_RH_DWN 6 //ok
# define INP_F_TRM_RV_UP 5 //ok
# define INP_F_TRM_RV_DWN 4 //ok
# define INP_F_TRM_LV_UP 3 //ok
# define INP_F_TRM_LV_DWN 2 //ok
# define INP_F_TRM_LH_UP 1 //ok
# define INP_F_TRM_LH_DWN 0 //ok
// Switchs driver
# define INP_C_ID2 1 //ok
# define INP_C_ID1 0 //ok
# define INP_D_AileDR 7 //ok
# define INP_G_ThrCt 2 //ok
# define INP_G_Gear 1 //ok
# define INP_G_RuddDR 0 //ok
# define INP_L_ElevDR 6 //ok
# define INP_L_Trainer 7 //ok
// Servitudes driver
# define INP_B_PPM_IN 7 //to verify
# define OUT_B_PPM 6 //to verify
# define OUT_B_SIM_CTL 5 //to verify
# define OUT_B_BUZZER 4 //to verify
# define INP_H_RF_POW 6 //to verify
# define INP_H_SPARE5 5 //hold power OUT_H_xx 4 ?????
# define INP_H_SPARE6 4 //jack presence INP_H_xx 5 ?????
# define OUT_H_Speaker 3 //to verify
# define INP_E_TELEM_RX 1 //same as Gruvin9x
# define OUT_E_TELEM_TX 0 //same as Gruvin9x
// Rotary encoders driver
# define INP_D_ROT_ENC_1_A 0 //ko
# define INP_D_ROT_ENC_1_B 1 //ko
# define INP_D_ROT_ENC_2_A 2 //ok, but recognised as rotary 1
# define INP_D_ROT_ENC_2_B 3 //ok, but recognised as rotary 1
# define INP_J_ROT_ENC_1_PUSH 0 //ok
# define INP_J_ROT_ENC_2_PUSH 1 //ok
# define REA_DOWN() (~PINJ & (1<<INP_J_ROT_ENC_1_PUSH))
# define REB_DOWN() (~PINJ & (1<<INP_J_ROT_ENC_2_PUSH))
# define ROTENC_DOWN() (REA_DOWN() || REB_DOWN())
// Old #define from Gruvin9x
# define OUT_E_BUZZER 3 //PB : temporary used, crash otherwise at compilation!!!!!!
/*
# define INP_E_USB_D_PLS 4 //to erase
# define INP_E_USB_D_NEG 2 //to erase
# define OUT_D_HAPTIC 7 //to erase
# define INP_D_SPARE4 6 //to erase
# define INP_D_I2C_SCL 1 //to erase
# define INP_D_I2C_SDA 0 //to erase
*/
// LCD driver
#define PORTA_LCD_DAT PORTA //ok
#define PORTC_LCD_CTRL PORTC //ok
#define OUT_C_LCD_E 7 //ok
#define OUT_C_LCD_RnW 6 //ok
#define OUT_C_LCD_A0 5 //ok
#define OUT_C_LCD_RES 4 //ok
#define OUT_C_LCD_CS1 3 //ok
#define OUT_C_LIGHT 2 //ok
// DBLKeys driver //ok
#define KEYS_PRESSED() (~PINL)
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & ((1<<INP_L_KEY_RGT) + (1<<INP_L_KEY_LFT))) == ((1<<INP_L_KEY_RGT) + (1<<INP_L_KEY_LFT)))
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & ((1<<INP_L_KEY_UP) + (1<<INP_L_KEY_DWN))) == ((1<<INP_L_KEY_UP) + (1<<INP_L_KEY_DWN)))
#define DBLKEYS_PRESSED_RGT_UP(i) ((in & ((1<<INP_L_KEY_RGT) + (1<<INP_L_KEY_UP))) == ((1<<INP_L_KEY_RGT) + (1<<INP_L_KEY_UP)))
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & ((1<<INP_L_KEY_LFT) + (1<<INP_L_KEY_DWN))) == ((1<<INP_L_KEY_LFT) + (1<<INP_L_KEY_DWN)))
// LCD driver
#define PORTA_LCD_DAT PORTA
#define PORTC_LCD_CTRL PORTC
#define OUT_C_LCD_E 7
#define OUT_C_LCD_RnW 6
#define OUT_C_LCD_A0 5
#define OUT_C_LCD_RES 4
#define OUT_C_LCD_CS1 3
// Power driver
uint8_t pwrCheck();
void pwrOff();
@@ -189,12 +190,5 @@ void pwrOff();
// Haptic driver
#define hapticOff() // TODO hapticOn() cleaner ...
#define HAPTIC_ON() PORTD &= ~(1 << OUT_D_HAPTIC)
#define HAPTIC_OFF() PORTD |= (1 << OUT_D_HAPTIC)
// Rotary encoder driver
#define REA_DOWN() (~PIND & 0x20)
#define REB_DOWN() (~PIND & 0x10)
#define ROTENC_DOWN() (REA_DOWN() || REB_DOWN())
#endif
+2 -2
View File
@@ -206,11 +206,11 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
#elif defined(PCBMEGA2560)
SWITCH_CASE(0, ping, 1<<INP_G_ThrCt)
SWITCH_CASE(1, ping, 1<<INP_G_RuddDR)
SWITCH_CASE(2, pinc, 1<<INP_C_ElevDR)
SWITCH_CASE(2, pinc, 1<<INP_L_ElevDR)
SWITCH_3_CASE(3, pinc, pinc, (1<<INP_C_ID1), (1<<INP_C_ID2))
SWITCH_CASE(4, pinc, 1<<INP_C_AileDR)
SWITCH_CASE(5, ping, 1<<INP_G_Gear)
SWITCH_CASE(6, pinb, 1<<INP_B_Trainer)
SWITCH_CASE(6, pinb, 1<<INP_L_Trainer)
#else // PCB9X
#if defined(JETI) || defined(FRSKY) || defined(NMEA) || defined(ARDUPILOT)
SWITCH_CASE(0, pinc, 1<<INP_C_ThrCt)