Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2189 - 1
#ifndef _DEBUG_H
2
#define _DEBUG_H
3
 
4
/*
5
 * Some digital output useful for timing and tracing things with a scope.
6
 */
7
#define J3HIGH    PORTD |= (1<<PORTD5)
8
#define J3LOW     PORTD &= ~(1<<PORTD5)
9
#define J3TOGGLE  PORTD ^= (1<<PORTD5)
10
 
11
#define J4HIGH    PORTD |= (1<<PORTD4)
12
#define J4LOW     PORTD &= ~(1<<PORTD4)
13
#define J4TOGGLE  PORTD ^= (1<<PORTD4)
14
 
15
#define J5HIGH    PORTD |= (1<<PORTD3)
16
#define J5LOW     PORTD &= ~(1<<PORTD3)
17
#define J5TOGGLE  PORTD ^= (1<<PORTD3)
18
 
19
// invert means: An "1" bit in digital debug data make a LOW on the output.
20
#define DIGITAL_DEBUG_INVERT 0
21
 
22
/*
23
 * Some digital debugs. A digital debug is 2 signals on the 2 LED outputs,
24
 * turned on and off depending on some condtions given in the code.
25
 * Only one can be selected, by defining DIGITAL_DEBUG_MASK to the value
26
 * of the debug.
27
 * In the code one can do like:
28
 * if (whatever_condition) {
29
 *  DebugOut.Digital[0] |= DEBUG_MYOWNDEBUGGER;
30
 * } else {
31
 *  DebugOut.Digital[0] &= ~DEBUG_MYOWNDEBUGGER;
32
 * }
33
 * ...
34
 * if (whatever_other_condition) {
35
 *  DebugOut.Digital[1] |= DEBUG_MYOWNDEBUGGER;
36
 * } else {
37
 *  DebugOut.Digital[1] &= ~DEBUG_MYOWNDEBUGGER;
38
 * }
39
 *
40
 * Digital debugs may be added as desired, and removed when the mystery
41
 * at hand is resolved.
42
 */
43
 
44
#define DEBUG_MAINLOOP_TIMER 1
45
#define DEBUG_HEIGHT_DIFF    2
46
#define DEBUG_INVERTED       4
47
#define DEBUG_COMMAND        8
48
#define DEBUG_COMPASS       16
49
#define DEBUG_PRESSURERANGE 32
50
#define DEBUG_CLIP          64
51
#define DEBUG_SENSORLIMIT  128
52
 
53
#define OUTPUTFLAGS_INVERT_0         1 // Inverted: 1 means low output on atmega. Does not affect on-board LED (if used with the OUTPUTOPTIONS_USE_ONBOARD_LEDS option)
54
#define OUTPUTFLAGS_INVERT_1         2 // Inverted: 1 means low output on atmega. Does not affect on-board LED (if used with the OUTPUTOPTIONS_USE_ONBOARD_LEDS option)
55
#define OUTPUTFLAGS_FLASH_0_AT_BEEP  4 // Flash LED when beeper beeps
56
#define OUTPUTFLAGS_FLASH_1_AT_BEEP  8 // Flash LED when beeper beeps
57
#define OUTPUTFLAGS_USE_ONBOARD_LEDS 16 // Control on-board LEDs in addition to outputs
58
#define OUTPUTFLAGS_TEST_OFF         32 // For testing: Turn off both outputs
59
#define OUTPUTFLAGS_TEST_ON          64 // For testing: Turn on both outputs
60
 
61
// For practical reasons put here instead of in uart0.h
62
typedef struct {
63
    uint8_t digital[2];
64
    int16_t analog[32]; // debug values
65
}__attribute__((packed)) DebugOut_t;
66
 
67
extern DebugOut_t debugOut;
68
 
69
#endif