Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1198 - 1
 
2
/****************************************************************/
3
/*                                                                                                                              */
4
/*                               NG-Video 5,8GHz                                                        */
5
/*                                                                                                                              */
6
/*                              Copyright (C) 2011 - gebad                                              */
7
/*                                                                                                                              */
8
/*  This code is distributed under the GNU Public License               */
9
/*      which can be found at http://www.gnu.org/licenses/gpl.txt       */
10
/*                                                                                                                              */
11
/****************************************************************/
12
 
13
#ifndef SETTING_H_
14
#define SETTING_H_
15
 
16
/* Indexwerte für av_source bzw. zur Auswertung von av_source */
17
#define AV1                                     0
18
#define AV2                                     1
19
#define DIVERSITY                       2
20
 
21
#define MARKER_SELECT           0xfc    // 0xfc enspricht '>>' Menue-Marker
22
#define MARKER_AV                       0xfb    // 0xfb enspricht '<<' Diversity AV-Marker
23
#define MARKER_RSSI                     'd'             // Diversity, wenn RX umschaltet mittels RSSI-Wert
24
#define MARKER_SYNC                     's'             // Diversity, wenn RX umschaltet auf Grund der Bildsynchronisation
25
 
26
#define SET_MUX_0                       PORTA &= ~(1<<MUX_IN); // MUX SxA enabled
27
#define SET_MUX_1                       PORTA |= (1<<MUX_IN);  // MUX SxB enabled
28
#define CLEAR_INT10                     EIMSK &= ~((1<<INT1) | (1<<INT0));      // Interrupt für Sync ausschalten
29
#define SET_INT10                       EIMSK |= (1<<INT1) | (1<<INT0);         // External Interrupt Mask Register ein
30
 
31
/* Beep Verzögerungszeitein */
32
#define DBEEPVERS                       2       // Beep on              nach Versionsanzeige
33
#define DBEEPVERSP                      30      // Beep Pause   nach Versionsanzeige
34
#define BEEPENTER                       1       // Beep on              Enter kurz Scroll_Menu() und Select_Menu()
35
#define DBEEPWR                         4       // Beep on              geänderte Werte ROM schreiben
36
#define DBEEPWRP                        30      // Beep Pause   geänderte Werte ROM schreiben
37
#define BEEPBAT                         20      // Beep on              bei Akku low
38
#define BEEP_LOW_TIME           240     // TIMER0_1 aller 500ms aufgerufen, BeepIntervall Akku leer mit 2 Min Abstand beginnen
39
 
40
#define ENABLE_BTIMER           1       // damit Intervall Beeper für Akku leer mit TIMER0_1 gesteuert wird 
41
#define DISABLE_BTIMER          0
42
 
43
#define GPS_DISP_NONE           0       // Anzeigen bei Antennennachführung per WI232 und GPS
44
#define GPS_DISP_CALC           1
45
#define GPS_DISP_CURRENT        2
46
#define GPS_DISP_HOME           3
47
#define GPS_MISC                        4
48
#define GPS_RX_COUNT            5
49
 
50
#define BAUDRATE                        5       // für Antennennachführung mittels MKCockpit
51
#define BAUDRATE_MIN            0
52
#define BAUDRATE_MAX            6
53
 
54
#define POLOLU_CMD                      2
55
 
56
#define OFF                                     0
57
#define ON                                      1
58
 
59
#define EEPROM                  __attribute__ ((section(".eeprom")))
60
 
61
uint32_t baud[8] = {4800, 7200, 9600, 14400, 19200, 38400, 57600};
62
 
63
typedef struct {
64
uint8_t  rev;
65
uint16_t min;
66
uint16_t max;
67
uint16_t mid;
68
} servo_t;
69
 
70
typedef struct
71
{ uint16_t min;
72
  uint16_t max;
73
  uint16_t korr_1;
74
  uint16_t korr_2;
75
} udbm_t;
76
 
77
typedef struct
78
{
79
  uint16_t u0;
80
  uint16_t u1;
81
} adc_avg_t;
82
 
83
typedef struct
84
{
85
  uint16_t min;
86
  uint16_t max;
87
} clipo_t;
88
 
89
typedef struct
90
{
91
  uint8_t Umk;
92
  uint16_t Capacity;
93
  uint16_t UsedCapacity;
94
  uint32_t time_on;
95
} lipo_t;
96
 
97
typedef struct
98
{
99
  uint32_t Sum;
100
  uint16_t Count;
101
} current_t;
102
 
103
/**************************************************************/
104
/*                                                                                                                        */
105
/*                          EEPROM                                                        */
106
/*                                                                                                                        */
107
/**************************************************************/
108
static uint8_t   ep_eep_init                                    EEPROM;
109
static char              ep_version[sizeof(VERSION)]    EEPROM;
110
static uint8_t   ep_dogm_vers                                   EEPROM;
111
static uint8_t   ep_contrast                                    EEPROM;
112
static uint8_t   ep_light_time                                  EEPROM;
113
static uint8_t   ep_u_offset                                    EEPROM;
114
static uint32_t  ep_u_min                                       EEPROM;
115
static uint8_t   ep_channel                                             EEPROM;
116
static uint8_t   ep_av_source                                   EEPROM;
117
static uint8_t   ep_language                                    EEPROM;
118
static udbm_t    ep_udbm[CHANNEL_MAX]                   EEPROM;
119
static uint8_t   ep_sIdxSteps                                   EEPROM;
120
static servo_t   ep_servo[SERVO_NUM_CHANNELS][sizeof(servo_t)]  EEPROM;
121
static uint8_t   ep_servo_frame                                 EEPROM;
122
static uint8_t   ep_servo_nr                                    EEPROM;
123
static uint8_t   ep_single_step                                 EEPROM;
124
static uint8_t   ep_repeat                                              EEPROM;
125
static uint8_t   ep_pause                                               EEPROM;
126
static uint8_t   ep_pause_step                                  EEPROM;
127
static uint8_t   ep_tracking                                    EEPROM;
128
static uint8_t   ep_track_hyst                                  EEPROM;
129
static uint8_t   ep_track_tx                                    EEPROM;
130
static uint8_t   ep_baudrate                                    EEPROM;
131
static current_t ep_current                                             EEPROM;
132
static uint8_t   ep_akku_nr                                             EEPROM;
133
static lipo_t    ep_lipo[AKKU_NR_MAX+1]                 EEPROM;
134
static uint8_t   ep_mk_i_offset                                 EEPROM;
135
static uint8_t   ep_mk_i_faktor                                 EEPROM;
136
static uint8_t   ep_mk_w_faktor                                 EEPROM;
137
 
138
uint8_t  dogm_vers;
139
uint8_t  contrast;
140
uint8_t  light_time = BACKGR_LIGHT_MAX;
141
uint8_t  backgr_light = OFF;
142
uint8_t  u_offset = U_OFFSET;
143
uint32_t u_min = U_MIN;
144
uint8_t  channel = CHANNEL;
145
uint8_t  av_source = AV_SOURCE;
146
uint8_t  language = NO_LANGUAGE;
147
udbm_t udbm = {UDBM_MIN, UDBM_MAX, UDBM_KORR_FA, UDBM_KORR_FA};
148
uint32_t hyst_u_min;
149
servo_t servo[SERVO_NUM_CHANNELS] =     {{SERVO_REV, SERVO_I0_RIGHT, SERVO_I0_LEFT, SERVO_I0_MIDDLE},\
150
                                                                         {SERVO_REV, SERVO_I0_RIGHT, SERVO_I0_LEFT, SERVO_I0_MIDDLE}};
151
uint8_t  servo_frame = SERVO_PERIODE;
152
uint8_t  single_step = SINGLE_STEP;
153
uint8_t  repeat = REPEAT;
154
uint8_t  pause = PAUSE;
155
uint8_t  pause_step = PAUSE_STEP;
156
uint8_t  tracking       = TRACKING_MIN;
157
uint8_t  track_hyst     = TRACKING_HYSTERESE;
158
uint8_t  track_tx = 0;
159
uint8_t  baudrate = BAUDRATE;
160
current_t current = {0, 0};
161
uint8_t  akku_nr = AKKU_NR_MIN;
162
lipo_t   lipo = {0xff, AKKU_CAPACITY, 0, 0};    // Umk 255 ==> erste Inbetriebnahme keine Nachfrage Akku-Nr.
163
uint8_t  mk_i_offset = MK_I_OFFSET;
164
uint8_t  mk_i_faktor = MK_I_FAKTOR;
165
uint8_t  mk_w_faktor = MK_W_FAKTOR;
166
 
167
uint8_t  gps_display = 0;
168
uint8_t  gps_disp_clear;
169
 
170
uint8_t RSSI_Calc_UdBm(uint16_t *pbar_udbm);
171
uint8_t Set_AV_Source(uint8_t src);
172
 
173
uint16_t bar_udbm[12];          // RSSI-Bargraph
174
uint16_t* pbar_udbm = bar_udbm;
175
uint8_t wudbm;                          // Differenz/Abstand benachbarter udbm[i] für differenzierteren Bargraphen
176
uint8_t bat_low = 1;   
177
uint8_t sw_avx;                         // steuert über Set_AV_Source() oder rssi_diversity(av_source) Marker-Position und RX-Umschaltung 
178
uint8_t mux_X;                          // berücksichtigt Schaltung auf Grund Synchronisation und RSSI (sw_avx meist RSSI) RX-Zählung
179
uint8_t MK_Motor_run = 0;       // Flag für RX Time-Counter Start/Stop
180
uint8_t mk_timer = 0;           // Zeitzähler lipo.time_on auf aus
181
uint8_t exit_while = 0;         // unabhängige Task (z.B: Menu_MK_BatteryChangeNr() - Aufruf) kann Eingabe while-Schleife beenden, wenn 1
182
 
183
volatile uint8_t  vsync0;
184
volatile uint8_t  vsync1;
185
volatile uint8_t  vscount0;
186
volatile uint8_t  vscount1;
187
volatile uint32_t rxcount0 = 0;
188
volatile uint32_t rxcount1 = 0;
189
 
190
uint16_t ADC_Read( uint8_t channel );
191
void servoSetDefaultPos(void);
192
void USART_Init_Baudrate(void);
193
void Double_Beep(uint8_t time, uint8_t pause);
194
char* my_itoa(int32_t zahl, uint8_t Vorz, uint8_t len, uint8_t Festkomma, uint8_t Nachkomma);
195
void Displ_TimeMS(int32_t time);
196
 
197
 
198
#endif /* SETTING_H_ */