mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
MEGA2560 didn't compile correctly
This commit is contained in:
parent
2c591e810d
commit
4c2c85fe9f
9 changed files with 80 additions and 72 deletions
|
@ -57,13 +57,13 @@ void audioQueue::heartbeat()
|
||||||
#else
|
#else
|
||||||
if (toneTimeLeft > 0) {
|
if (toneTimeLeft > 0) {
|
||||||
if (toneFreq == 0) { //pause only events
|
if (toneFreq == 0) { //pause only events
|
||||||
SPEAKER_OFF;
|
speakerOff();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
if (toneFreq) {
|
if (toneFreq) {
|
||||||
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||||
SPEAKER_ON;
|
speakerOn();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
toneFreq += toneFreqIncr;
|
toneFreq += toneFreqIncr;
|
||||||
|
@ -72,7 +72,7 @@ void audioQueue::heartbeat()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tonePause > 0) {
|
if (tonePause > 0) {
|
||||||
SPEAKER_OFF;
|
speakerOff();
|
||||||
tonePause--; //time gets counted down
|
tonePause--; //time gets counted down
|
||||||
}
|
}
|
||||||
else if (t_queueRidx != t_queueWidx) {
|
else if (t_queueRidx != t_queueWidx) {
|
||||||
|
@ -89,7 +89,7 @@ void audioQueue::heartbeat()
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
if (tone2Freq) {
|
if (tone2Freq) {
|
||||||
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||||
SPEAKER_ON;
|
speakerOn();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
toneFreq = tone2Freq;
|
toneFreq = tone2Freq;
|
||||||
|
@ -97,7 +97,7 @@ void audioQueue::heartbeat()
|
||||||
tone2TimeLeft--; //time gets counted down
|
tone2TimeLeft--; //time gets counted down
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SPEAKER_OFF;
|
speakerOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
#define audio_h
|
#define audio_h
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
#if defined(PCBSTD)
|
||||||
#define SPEAKER_ON BUZZER_ON
|
#define speakerOn() buzzerOn()
|
||||||
#define SPEAKER_OFF toneFreq=0; BUZZER_OFF
|
#define speakerOff() toneFreq=0; buzzerOff()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//audio
|
//audio
|
||||||
|
@ -66,9 +66,9 @@ class audioQueue
|
||||||
if (toneFreq) {
|
if (toneFreq) {
|
||||||
toneCounter += toneFreq;
|
toneCounter += toneFreq;
|
||||||
if ((toneCounter & 0x80) == 0x80)
|
if ((toneCounter & 0x80) == 0x80)
|
||||||
BUZZER_ON;
|
buzzerOn();
|
||||||
else
|
else
|
||||||
BUZZER_OFF;
|
buzzerOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,37 +114,36 @@ void beep(uint8_t val);
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
inline void BUZZER_HEARTBEAT()
|
inline void BUZZER_HEARTBEAT()
|
||||||
{
|
{
|
||||||
if(g_beepCnt) {
|
if (g_beepCnt) {
|
||||||
if(!beepAgainOrig) {
|
if (!beepAgainOrig) {
|
||||||
beepAgainOrig = g_beepCnt;
|
beepAgainOrig = g_beepCnt;
|
||||||
beepOn = true;
|
beepOn = true;
|
||||||
}
|
|
||||||
g_beepCnt--;
|
|
||||||
}
|
}
|
||||||
else
|
g_beepCnt--;
|
||||||
{
|
}
|
||||||
if(beepAgain && beepAgainOrig) {
|
else {
|
||||||
beepOn = !beepOn;
|
if (beepAgain && beepAgainOrig) {
|
||||||
g_beepCnt = beepOn ? beepAgainOrig : 8;
|
beepOn = !beepOn;
|
||||||
if(beepOn) beepAgain--;
|
g_beepCnt = beepOn ? beepAgainOrig : 8;
|
||||||
}
|
if (beepOn) beepAgain--;
|
||||||
else {
|
|
||||||
beepAgainOrig = 0;
|
|
||||||
beepOn = false;
|
|
||||||
warble = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beepOn) {
|
|
||||||
warbleC = warble && !warbleC;
|
|
||||||
if (warbleC)
|
|
||||||
BUZZER_OFF;
|
|
||||||
else
|
|
||||||
BUZZER_ON;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BUZZER_OFF;
|
beepAgainOrig = 0;
|
||||||
|
beepOn = false;
|
||||||
|
warble = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beepOn) {
|
||||||
|
warbleC = warble && !warbleC;
|
||||||
|
if (warbleC)
|
||||||
|
buzzerOff();
|
||||||
|
else
|
||||||
|
buzzerOn();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buzzerOff();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4830,7 +4830,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||||
|
|
||||||
// CSW name
|
// CSW name
|
||||||
uint8_t sw = SWSRC_SW1+k;
|
uint8_t sw = SWSRC_SW1+k;
|
||||||
putsSwitches(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && horz<0) ? INVERS : 0));
|
putsSwitches(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||||
|
|
||||||
// CSW func
|
// CSW func
|
||||||
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
||||||
|
|
|
@ -274,7 +274,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||||
#define CURSOR_ON_LINE() m_posHorz<0
|
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||||
#else
|
#else
|
||||||
#define NAVIGATION_LINE_BY_LINE 0
|
#define NAVIGATION_LINE_BY_LINE 0
|
||||||
#define CURSOR_ON_LINE() (0)
|
#define CURSOR_ON_LINE() (0)
|
||||||
|
|
|
@ -977,9 +977,6 @@ void checkBacklight();
|
||||||
#define BACKLIGHT_OFF() __BACKLIGHT_OFF
|
#define BACKLIGHT_OFF() __BACKLIGHT_OFF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUZZER_ON PORTE |= (1 << OUT_E_BUZZER)
|
|
||||||
#define BUZZER_OFF PORTE &= ~(1 << OUT_E_BUZZER)
|
|
||||||
|
|
||||||
#define BITMASK(bit) (1<<(bit))
|
#define BITMASK(bit) (1<<(bit))
|
||||||
|
|
||||||
/// liefert Dimension eines Arrays
|
/// liefert Dimension eines Arrays
|
||||||
|
|
|
@ -94,8 +94,8 @@ void sdPoll10ms();
|
||||||
#define SD_GET_SPEED() (0)
|
#define SD_GET_SPEED() (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
|
#define speakerOn() TCCR0A |= (1 << COM0A0)
|
||||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
|
#define speakerOff() TCCR0A &= ~(1 << COM0A0)
|
||||||
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
|
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
|
||||||
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT)
|
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT)
|
||||||
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT))
|
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT))
|
||||||
|
@ -169,30 +169,34 @@ void sdPoll10ms();
|
||||||
#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)))
|
#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
|
// LCD driver
|
||||||
#define PORTA_LCD_DAT PORTA
|
#define PORTA_LCD_DAT PORTA
|
||||||
#define PORTC_LCD_CTRL PORTC
|
#define PORTC_LCD_CTRL PORTC
|
||||||
#define OUT_C_LCD_E 5
|
#define OUT_C_LCD_E 5
|
||||||
#define OUT_C_LCD_RnW 4
|
#define OUT_C_LCD_RnW 4
|
||||||
#define OUT_C_LCD_A0 3
|
#define OUT_C_LCD_A0 3
|
||||||
#define OUT_C_LCD_RES 2
|
#define OUT_C_LCD_RES 2
|
||||||
#define OUT_C_LCD_CS1 1
|
#define OUT_C_LCD_CS1 1
|
||||||
|
|
||||||
// Power driver
|
// Power driver
|
||||||
uint8_t pwrCheck();
|
uint8_t pwrCheck();
|
||||||
void pwrOff();
|
void pwrOff();
|
||||||
#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown)
|
#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown)
|
||||||
|
|
||||||
// USB fake driver
|
// USB fake driver
|
||||||
#define usbPlugged() false
|
#define usbPlugged() false
|
||||||
|
|
||||||
// Haptic driver
|
// Haptic driver
|
||||||
#define hapticOff() // TODO hapticOn() cleaner ...
|
#define hapticOff() // TODO hapticOn() cleaner ...
|
||||||
#define HAPTIC_ON() PORTD &= ~(1 << OUT_D_HAPTIC)
|
#define HAPTIC_ON() PORTD &= ~(1 << OUT_D_HAPTIC)
|
||||||
#define HAPTIC_OFF() PORTD |= (1 << OUT_D_HAPTIC)
|
#define HAPTIC_OFF() PORTD |= (1 << OUT_D_HAPTIC)
|
||||||
|
|
||||||
// Rotary encoder driver
|
// Rotary encoder driver
|
||||||
#define REA_DOWN() (~PIND & 0x20)
|
#define REA_DOWN() (~PIND & 0x20)
|
||||||
#define REB_DOWN() (~PIND & 0x10)
|
#define REB_DOWN() (~PIND & 0x10)
|
||||||
#define ROTENC_DOWN() (REA_DOWN() || REB_DOWN())
|
#define ROTENC_DOWN() (REA_DOWN() || REB_DOWN())
|
||||||
|
|
||||||
|
// Buzzer driver
|
||||||
|
#define buzzerOn() PORTE |= (1 << OUT_E_BUZZER)
|
||||||
|
#define buzzerOff() PORTE &= ~(1 << OUT_E_BUZZER)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -82,8 +82,8 @@
|
||||||
#define SLAVE_MODE() (PINH & (1<<INP_H_RF_POW)) //not tested
|
#define SLAVE_MODE() (PINH & (1<<INP_H_RF_POW)) //not tested
|
||||||
#define JACK_PPM_OUT() PORTB |= (1<<OUT_B_SIM_CTL) //not tested
|
#define JACK_PPM_OUT() PORTB |= (1<<OUT_B_SIM_CTL) //not tested
|
||||||
#define JACK_PPM_IN() PORTB &= ~(1<<OUT_B_SIM_CTL) //not tested
|
#define JACK_PPM_IN() PORTB &= ~(1<<OUT_B_SIM_CTL) //not tested
|
||||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0) //not tested
|
#define speakerOn() TCCR0A |= (1 << COM0A0) //not tested
|
||||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0) //not tested
|
#define speakerOff() TCCR0A &= ~(1 << COM0A0) //not tested
|
||||||
|
|
||||||
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT) //ok
|
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT) //ok
|
||||||
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT) //ok
|
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT) //ok
|
||||||
|
@ -192,4 +192,8 @@ void pwrOff();
|
||||||
// Haptic driver
|
// Haptic driver
|
||||||
#define hapticOff() // TODO hapticOn() cleaner ...
|
#define hapticOff() // TODO hapticOn() cleaner ...
|
||||||
|
|
||||||
|
// Buzzer driver
|
||||||
|
#define buzzerOn() PORTB |= (1 << OUT_B_BUZZER)
|
||||||
|
#define buzzerOff() PORTB &= ~(1 << OUT_B_BUZZER)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -210,21 +210,21 @@ void backlightFade();
|
||||||
#define INP_G_RuddDR 0
|
#define INP_G_RuddDR 0
|
||||||
|
|
||||||
// Keys driver
|
// Keys driver
|
||||||
#define TRIMS_PRESSED() (~PIND)
|
#define TRIMS_PRESSED() (~PIND)
|
||||||
#define KEYS_PRESSED() (~PINB)
|
#define KEYS_PRESSED() (~PINB)
|
||||||
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_LFT))) == ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_LFT)))
|
#define DBLKEYS_PRESSED_RGT_LFT(i) ((in & ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_LFT))) == ((1<<INP_B_KEY_RGT) + (1<<INP_B_KEY_LFT)))
|
||||||
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & ((1<<INP_B_KEY_UP) + (1<<INP_B_KEY_DWN))) == ((1<<INP_B_KEY_UP) + (1<<INP_B_KEY_DWN)))
|
#define DBLKEYS_PRESSED_UP_DWN(i) ((in & ((1<<INP_B_KEY_UP) + (1<<INP_B_KEY_DWN))) == ((1<<INP_B_KEY_UP) + (1<<INP_B_KEY_DWN)))
|
||||||
#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_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)))
|
#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)))
|
||||||
|
|
||||||
// LCD driver
|
// LCD driver
|
||||||
#define PORTA_LCD_DAT PORTA
|
#define PORTA_LCD_DAT PORTA
|
||||||
#define PORTC_LCD_CTRL PORTC
|
#define PORTC_LCD_CTRL PORTC
|
||||||
#define OUT_C_LCD_E 5
|
#define OUT_C_LCD_E 5
|
||||||
#define OUT_C_LCD_RnW 4
|
#define OUT_C_LCD_RnW 4
|
||||||
#define OUT_C_LCD_A0 3
|
#define OUT_C_LCD_A0 3
|
||||||
#define OUT_C_LCD_RES 2
|
#define OUT_C_LCD_RES 2
|
||||||
#define OUT_C_LCD_CS1 1
|
#define OUT_C_LCD_CS1 1
|
||||||
|
|
||||||
// Rotary encoder driver
|
// Rotary encoder driver
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
@ -233,10 +233,14 @@ void rotencPoll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Haptic
|
// Haptic
|
||||||
#define HAPTIC_ON() PORTG |= (1 << OUT_G_HAPTIC)
|
#define HAPTIC_ON() PORTG |= (1 << OUT_G_HAPTIC)
|
||||||
#define HAPTIC_OFF() PORTG &= ~(1 << OUT_G_HAPTIC)
|
#define HAPTIC_OFF() PORTG &= ~(1 << OUT_G_HAPTIC)
|
||||||
|
|
||||||
// USB fake driver
|
// USB fake driver
|
||||||
#define usbPlugged() false
|
#define usbPlugged() false
|
||||||
|
|
||||||
|
// Buzzer driver
|
||||||
|
#define buzzerOn() PORTE |= (1 << OUT_E_BUZZER)
|
||||||
|
#define buzzerOff() PORTE &= ~(1 << OUT_E_BUZZER)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue