mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 00:05:17 +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
|
||||
if (toneTimeLeft > 0) {
|
||||
if (toneFreq == 0) { //pause only events
|
||||
SPEAKER_OFF;
|
||||
speakerOff();
|
||||
}
|
||||
else {
|
||||
#if defined(PCBGRUVIN9X)
|
||||
if (toneFreq) {
|
||||
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
SPEAKER_ON;
|
||||
speakerOn();
|
||||
}
|
||||
#endif
|
||||
toneFreq += toneFreqIncr;
|
||||
|
@ -72,7 +72,7 @@ void audioQueue::heartbeat()
|
|||
}
|
||||
else {
|
||||
if (tonePause > 0) {
|
||||
SPEAKER_OFF;
|
||||
speakerOff();
|
||||
tonePause--; //time gets counted down
|
||||
}
|
||||
else if (t_queueRidx != t_queueWidx) {
|
||||
|
@ -89,7 +89,7 @@ void audioQueue::heartbeat()
|
|||
#if defined(PCBGRUVIN9X)
|
||||
if (tone2Freq) {
|
||||
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
|
||||
SPEAKER_ON;
|
||||
speakerOn();
|
||||
}
|
||||
#else
|
||||
toneFreq = tone2Freq;
|
||||
|
@ -97,7 +97,7 @@ void audioQueue::heartbeat()
|
|||
tone2TimeLeft--; //time gets counted down
|
||||
}
|
||||
else {
|
||||
SPEAKER_OFF;
|
||||
speakerOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
#define audio_h
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define SPEAKER_ON BUZZER_ON
|
||||
#define SPEAKER_OFF toneFreq=0; BUZZER_OFF
|
||||
#define speakerOn() buzzerOn()
|
||||
#define speakerOff() toneFreq=0; buzzerOff()
|
||||
#endif
|
||||
|
||||
//audio
|
||||
|
@ -66,9 +66,9 @@ class audioQueue
|
|||
if (toneFreq) {
|
||||
toneCounter += toneFreq;
|
||||
if ((toneCounter & 0x80) == 0x80)
|
||||
BUZZER_ON;
|
||||
buzzerOn();
|
||||
else
|
||||
BUZZER_OFF;
|
||||
buzzerOff();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,37 +114,36 @@ void beep(uint8_t val);
|
|||
#if !defined(CPUARM)
|
||||
inline void BUZZER_HEARTBEAT()
|
||||
{
|
||||
if(g_beepCnt) {
|
||||
if(!beepAgainOrig) {
|
||||
beepAgainOrig = g_beepCnt;
|
||||
beepOn = true;
|
||||
}
|
||||
g_beepCnt--;
|
||||
if (g_beepCnt) {
|
||||
if (!beepAgainOrig) {
|
||||
beepAgainOrig = g_beepCnt;
|
||||
beepOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(beepAgain && beepAgainOrig) {
|
||||
beepOn = !beepOn;
|
||||
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;
|
||||
g_beepCnt--;
|
||||
}
|
||||
else {
|
||||
if (beepAgain && beepAgainOrig) {
|
||||
beepOn = !beepOn;
|
||||
g_beepCnt = beepOn ? beepAgainOrig : 8;
|
||||
if (beepOn) beepAgain--;
|
||||
}
|
||||
else {
|
||||
BUZZER_OFF;
|
||||
beepAgainOrig = 0;
|
||||
beepOn = false;
|
||||
warble = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (beepOn) {
|
||||
warbleC = warble && !warbleC;
|
||||
if (warbleC)
|
||||
buzzerOff();
|
||||
else
|
||||
buzzerOn();
|
||||
}
|
||||
else {
|
||||
buzzerOff();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4830,7 +4830,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
|||
|
||||
// CSW name
|
||||
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
|
||||
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)
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
#define CURSOR_ON_LINE() m_posHorz<0
|
||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
#else
|
||||
#define NAVIGATION_LINE_BY_LINE 0
|
||||
#define CURSOR_ON_LINE() (0)
|
||||
|
|
|
@ -977,9 +977,6 @@ void checkBacklight();
|
|||
#define BACKLIGHT_OFF() __BACKLIGHT_OFF
|
||||
#endif
|
||||
|
||||
#define BUZZER_ON PORTE |= (1 << OUT_E_BUZZER)
|
||||
#define BUZZER_OFF PORTE &= ~(1 << OUT_E_BUZZER)
|
||||
|
||||
#define BITMASK(bit) (1<<(bit))
|
||||
|
||||
/// liefert Dimension eines Arrays
|
||||
|
|
|
@ -94,8 +94,8 @@ void sdPoll10ms();
|
|||
#define SD_GET_SPEED() (0)
|
||||
#endif
|
||||
|
||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
|
||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
|
||||
#define speakerOn() TCCR0A |= (1 << COM0A0)
|
||||
#define speakerOff() 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))
|
||||
|
@ -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)))
|
||||
|
||||
// LCD driver
|
||||
#define PORTA_LCD_DAT PORTA
|
||||
#define PORTC_LCD_CTRL PORTC
|
||||
#define OUT_C_LCD_E 5
|
||||
#define OUT_C_LCD_RnW 4
|
||||
#define OUT_C_LCD_A0 3
|
||||
#define OUT_C_LCD_RES 2
|
||||
#define OUT_C_LCD_CS1 1
|
||||
#define PORTA_LCD_DAT PORTA
|
||||
#define PORTC_LCD_CTRL PORTC
|
||||
#define OUT_C_LCD_E 5
|
||||
#define OUT_C_LCD_RnW 4
|
||||
#define OUT_C_LCD_A0 3
|
||||
#define OUT_C_LCD_RES 2
|
||||
#define OUT_C_LCD_CS1 1
|
||||
|
||||
// Power driver
|
||||
uint8_t pwrCheck();
|
||||
void pwrOff();
|
||||
#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown)
|
||||
#define UNEXPECTED_SHUTDOWN() ((mcusr & (1 << WDRF)) || g_eeGeneral.unexpectedShutdown)
|
||||
|
||||
// USB fake driver
|
||||
#define usbPlugged() false
|
||||
#define usbPlugged() false
|
||||
|
||||
// Haptic driver
|
||||
#define hapticOff() // TODO hapticOn() cleaner ...
|
||||
#define HAPTIC_ON() PORTD &= ~(1 << OUT_D_HAPTIC)
|
||||
#define HAPTIC_OFF() PORTD |= (1 << OUT_D_HAPTIC)
|
||||
#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())
|
||||
#define REA_DOWN() (~PIND & 0x20)
|
||||
#define REB_DOWN() (~PIND & 0x10)
|
||||
#define ROTENC_DOWN() (REA_DOWN() || REB_DOWN())
|
||||
|
||||
// Buzzer driver
|
||||
#define buzzerOn() PORTE |= (1 << OUT_E_BUZZER)
|
||||
#define buzzerOff() PORTE &= ~(1 << OUT_E_BUZZER)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,8 +82,8 @@
|
|||
#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_IN() PORTB &= ~(1<<OUT_B_SIM_CTL) //not tested
|
||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0) //not tested
|
||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0) //not tested
|
||||
#define speakerOn() TCCR0A |= (1 << COM0A0) //not tested
|
||||
#define speakerOff() TCCR0A &= ~(1 << COM0A0) //not tested
|
||||
|
||||
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT) //ok
|
||||
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT) //ok
|
||||
|
@ -192,4 +192,8 @@ void pwrOff();
|
|||
// Haptic driver
|
||||
#define hapticOff() // TODO hapticOn() cleaner ...
|
||||
|
||||
// Buzzer driver
|
||||
#define buzzerOn() PORTB |= (1 << OUT_B_BUZZER)
|
||||
#define buzzerOff() PORTB &= ~(1 << OUT_B_BUZZER)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -210,21 +210,21 @@ void backlightFade();
|
|||
#define INP_G_RuddDR 0
|
||||
|
||||
// Keys driver
|
||||
#define TRIMS_PRESSED() (~PIND)
|
||||
#define KEYS_PRESSED() (~PINB)
|
||||
#define TRIMS_PRESSED() (~PIND)
|
||||
#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_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_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
|
||||
#define PORTA_LCD_DAT PORTA
|
||||
#define PORTC_LCD_CTRL PORTC
|
||||
#define OUT_C_LCD_E 5
|
||||
#define OUT_C_LCD_RnW 4
|
||||
#define OUT_C_LCD_A0 3
|
||||
#define OUT_C_LCD_RES 2
|
||||
#define OUT_C_LCD_CS1 1
|
||||
#define PORTA_LCD_DAT PORTA
|
||||
#define PORTC_LCD_CTRL PORTC
|
||||
#define OUT_C_LCD_E 5
|
||||
#define OUT_C_LCD_RnW 4
|
||||
#define OUT_C_LCD_A0 3
|
||||
#define OUT_C_LCD_RES 2
|
||||
#define OUT_C_LCD_CS1 1
|
||||
|
||||
// Rotary encoder driver
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
@ -233,10 +233,14 @@ void rotencPoll();
|
|||
#endif
|
||||
|
||||
// Haptic
|
||||
#define HAPTIC_ON() PORTG |= (1 << OUT_G_HAPTIC)
|
||||
#define HAPTIC_OFF() PORTG &= ~(1 << OUT_G_HAPTIC)
|
||||
#define HAPTIC_ON() PORTG |= (1 << OUT_G_HAPTIC)
|
||||
#define HAPTIC_OFF() PORTG &= ~(1 << OUT_G_HAPTIC)
|
||||
|
||||
// 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue