Subversion Repositories FlightCtrl

Rev

Rev 1801 | Rev 1842 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1612 dongfang 1
#ifndef _OUTPUT_H
2
#define _OUTPUT_H
3
 
4
#include <avr/io.h>
5
 
6
// This is for LEDs connected directly between +5V and the AVR port, without transistors.
7
// PORTbit = 0 --> LED on.
8
// To use the normal transistor set-up where 1 --> transistor conductive, reverse the 
9
// ON and OFF statements.
1805 - 10
 
11
// invert means: An "1" bit in digital debug data make a LOW on the output.
12
#define DIGITAL_DEBUG_INVERT 1
13
#define OUTPUT_HIGH(num)        {PORTC |=  (4 << (num));}
14
#define OUTPUT_LOW(num)         {PORTC &= ~(4 << (num));}
15
#define OUTPUT_SET(num, state)  {if (DIGITAL_DEBUG_INVERT){if(state) OUTPUT_LOW(num) else OUTPUT_HIGH(num)} else {if(state) OUTPUT_HIGH(num) else OUTPUT_LOW(num)}}
1775 - 16
#define OUTPUT_TOGGLE(num) (    {PORTC ^=  (4 << (num));}
1612 dongfang 17
 
1775 - 18
#define DEBUG_LEDTEST 256
19
#define DEBUG_HEIGHT_SWITCH 1
20
#define DEBUG_HEIGHT_DIFF 2
21
#define DEBUG_HOVERTHROTTLE 4
22
#define DEBUG_ACC0THORDER 8
23
#define DEBUG_COMMANDREPEATED 16
1796 - 24
#define DEBUG_PRESSURERANGE 32
1801 - 25
#define DEBUG_MK3MAG 64
1612 dongfang 26
 
27
void output_init(void);
28
void output_update(void);
29
 
30
#endif //_output_H