Subversion Repositories FlightCtrl

Rev

Rev 1869 | Rev 1908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1869 Rev 1887
Line 49... Line 49...
49
// +  POSSIBILITY OF SUCH DAMAGE.
49
// +  POSSIBILITY OF SUCH DAMAGE.
50
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51
#include <inttypes.h>
51
#include <inttypes.h>
52
#include "output.h"
52
#include "output.h"
53
#include "eeprom.h"
53
#include "eeprom.h"
-
 
54
#include "timer0.h"
Line 54... Line 55...
54
 
55
 
55
// To access the DebugOut struct.
56
// To access the DebugOut struct.
56
#include "uart0.h"
57
#include "uart0.h"
57
uint8_t flashCnt[2], flashMask[2];
58
uint8_t flashCnt[2], flashMask[2];
Line 113... Line 114...
113
  } else {
114
  } else {
114
    OUTPUT_SET(0, DebugOut.Digital[0] & DIGITAL_DEBUG_MASK);
115
    OUTPUT_SET(0, DebugOut.Digital[0] & DIGITAL_DEBUG_MASK);
115
    OUTPUT_SET(1, DebugOut.Digital[1] & DIGITAL_DEBUG_MASK);
116
    OUTPUT_SET(1, DebugOut.Digital[1] & DIGITAL_DEBUG_MASK);
116
  }
117
  }
117
}
118
}
-
 
119
 
-
 
120
void beep(uint16_t millis) {
-
 
121
  beepTime = millis;
-
 
122
}
-
 
123
 
-
 
124
/*
-
 
125
 * Make [numbeeps] beeps.
-
 
126
 */
-
 
127
void beepNumber(uint8_t numbeeps) {
-
 
128
  while(numbeeps--) {
-
 
129
    if(MKFlags & MKFLAG_MOTOR_RUN) return; //auf keinen Fall bei laufenden Motoren!
-
 
130
    beep(100); // 0.1 second
-
 
131
    delay_ms(250); // blocks 250 ms as pause to next beep,
-
 
132
    // this will block the flight control loop,
-
 
133
    // therefore do not use this function if motors are running
-
 
134
  }
-
 
135
}
-
 
136
 
-
 
137
/*
-
 
138
 * Beep the R/C alarm signal
-
 
139
 */
-
 
140
void beepRCAlarm(void) {
-
 
141
  if(beepModulation == 0xFFFF) { // If not already beeping an alarm signal (?)
-
 
142
    beepTime = 15000; // 1.5 seconds
-
 
143
    beepModulation = 0x0C00;
-
 
144
  }
-
 
145
}
-
 
146
 
-
 
147
/*
-
 
148
 * Beep the I2C bus error signal
-
 
149
 */
-
 
150
void beepI2CAlarm(void) {
-
 
151
  if((beepModulation == 0xFFFF) && (MKFlags & MKFLAG_MOTOR_RUN)) {
-
 
152
    beepTime = 10000; // 1 second
-
 
153
    beepModulation = 0x0080;
-
 
154
  }
-
 
155
}
-
 
156
 
-
 
157
/*
-
 
158
 * Beep the battery low alarm signal
-
 
159
 */
-
 
160
void beepBatteryAlarm(void) {
-
 
161
  beepModulation = 0x0300;
-
 
162
  if(!beepTime) {
-
 
163
    beepTime = 6000; // 0.6 seconds
-
 
164
  }
-
 
165
}
-
 
166
 
-
 
167
/*
-
 
168
 * Beep the EEPROM checksum alarm
-
 
169
 */
-
 
170
void beepEEPROMAlarm(void) {
-
 
171
  beepModulation = 0x0007;
-
 
172
  if(!beepTime) {
-
 
173
    beepTime = 6000; // 0.6 seconds
-
 
174
  }
-
 
175
}