Subversion Repositories FlightCtrl

Rev

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

Rev 1801 Rev 1805
Line 57... Line 57...
57
uint8_t flashCnt[2], flashMask[2];
57
uint8_t flashCnt[2], flashMask[2];
58
// initializes the LED control outputs J16, J17
58
// initializes the LED control outputs J16, J17
59
void output_init(void) {
59
void output_init(void) {
60
  // set PC2 & PC3 as output (control of J16 & J17)
60
  // set PC2 & PC3 as output (control of J16 & J17)
61
  DDRC |= (1<<DDC2)|(1<<DDC3);
61
  DDRC |= (1<<DDC2)|(1<<DDC3);
62
  OUTPUT_OFF(0); OUTPUT_OFF(1);
62
  OUTPUT_SET(0,0); OUTPUT_SET(1,0);
63
  flashCnt[0]  = flashCnt[1]  = 0;
63
  flashCnt[0]  = flashCnt[1]  = 0;
64
  flashMask[0] = flashMask[1] = 128;
64
  flashMask[0] = flashMask[1] = 128;
65
}
65
}
Line 66... Line 66...
66
 
66
 
Line 92... Line 92...
92
 * Set to 0 for using outputs as the usual flashing lights.
92
 * Set to 0 for using outputs as the usual flashing lights.
93
 * Set to one of the DEBUG_... constants in output.h for using the outputs as debug lights.
93
 * Set to one of the DEBUG_... constants in output.h for using the outputs as debug lights.
94
 */
94
 */
95
#define DIGITAL_DEBUG_MASK DEBUG_MK3MAG
95
#define DIGITAL_DEBUG_MASK DEBUG_MK3MAG
Line 96... Line -...
96
 
-
 
97
// invert means: An "1" bit in digital debug data will feed NO base current to output transistor.
-
 
98
#define DIGITAL_DEBUG_INVERT 0
-
 
99
 
96
 
100
void output_update(void) {
97
void output_update(void) {
101
  uint8_t output0, output1;
98
  uint8_t output0, output1;
102
  if (!DIGITAL_DEBUG_MASK)
99
  if (!DIGITAL_DEBUG_MASK)
103
    flashingLights();
100
    flashingLights();
104
  else {
-
 
105
    if (DIGITAL_DEBUG_MASK == DEBUG_LEDTEST) {
-
 
106
      // Show the state for a SET bit. If inverse, then invert.
-
 
107
      output0 = output1 = ~DIGITAL_DEBUG_INVERT;
-
 
108
    } else if (DIGITAL_DEBUG_INVERT) {
-
 
109
      output0 = (~DebugOut.Digital[0]) & DIGITAL_DEBUG_MASK;
-
 
110
      output1 = (~DebugOut.Digital[1]) & DIGITAL_DEBUG_MASK;
-
 
111
    } else {
101
  else {
112
      output0 = DebugOut.Digital[0] & DIGITAL_DEBUG_MASK;
102
    OUTPUT_SET(0, DebugOut.Digital[0] & DIGITAL_DEBUG_MASK);
113
      output1 = DebugOut.Digital[1] & DIGITAL_DEBUG_MASK;
-
 
114
    }
-
 
115
    OUTPUT_SET(0, output0);
-
 
116
    OUTPUT_SET(1, output1);
103
    OUTPUT_SET(1, DebugOut.Digital[1] & DIGITAL_DEBUG_MASK);
117
  }
104
  }