Rev 134 | Rev 139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 134 | Rev 136 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | #include <stdio.h> |
57 | #include <stdio.h> |
58 | #include <stdarg.h> |
58 | #include <stdarg.h> |
59 | #include <string.h> |
59 | #include <string.h> |
Line 60... | Line 60... | ||
60 | 60 | ||
- | 61 | #include "91x_lib.h" |
|
61 | #include "91x_lib.h" |
62 | #include "config.h" |
62 | #include "menu.h" |
63 | #include "menu.h" |
63 | #include "printf_P.h" |
64 | #include "printf_P.h" |
64 | #include "GPS.h" |
65 | #include "GPS.h" |
65 | #include "i2c.h" |
66 | #include "i2c.h" |
Line 91... | Line 92... | ||
91 | u8 UART1_DisplayLine = 0; |
92 | u8 UART1_DisplayLine = 0; |
92 | u8 UART1_ConfirmFrame = 0; |
93 | u8 UART1_ConfirmFrame = 0; |
Line 93... | Line 94... | ||
93 | 94 | ||
Line 94... | Line -... | ||
94 | UART_TypeDef *DebugUART = UART1; |
- | |
95 | - | ||
96 | #define UART1_BAUD_RATE 57600 //Baud Rate for the serial interfaces |
95 | UART_TypeDef *DebugUART = UART1; |
97 | 96 | ||
98 | // the tx buffer |
97 | // the tx buffer |
99 | #define UART1_TX_BUFFER_LEN 150 |
98 | #define UART1_TX_BUFFER_LEN 150 |
Line 205... | Line 204... | ||
205 | UART_InitStructure.UART_BaudRate = UART1_BAUD_RATE; |
204 | UART_InitStructure.UART_BaudRate = UART1_BAUD_RATE; |
206 | UART_InitStructure. UART_HardwareFlowControl = UART_HardwareFlowControl_None; |
205 | UART_InitStructure. UART_HardwareFlowControl = UART_HardwareFlowControl_None; |
207 | UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx; |
206 | UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx; |
208 | UART_InitStructure.UART_FIFO = UART_FIFO_Enable; |
207 | UART_InitStructure.UART_FIFO = UART_FIFO_Enable; |
209 | UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; |
208 | UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; |
210 | UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; |
209 | UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_8; |
Line 211... | Line 210... | ||
211 | 210 | ||
212 | UART_DeInit(UART1); // reset uart 1 to default |
211 | UART_DeInit(UART1); // reset uart 1 to default |
213 | UART_Init(UART1, &UART_InitStructure); // initialize uart 1 |
212 | UART_Init(UART1, &UART_InitStructure); // initialize uart 1 |
214 | // enable uart 1 interrupts selective |
213 | // enable uart 1 interrupts selective |
215 | UART_ITConfig(UART1, UART_IT_Receive | UART_IT_ReceiveTimeOut, ENABLE); |
214 | UART_ITConfig(UART1, UART_IT_Receive | UART_IT_ReceiveTimeOut, ENABLE); |
216 | UART_Cmd(UART1, ENABLE); // enable uart 1 |
215 | UART_Cmd(UART1, ENABLE); // enable uart 1 |
217 | // configure the uart 1 interupt line as an IRQ with priority 4 (0 is highest) |
216 | // configure the uart 1 interupt line |
218 | VIC_Config(UART1_ITLine, VIC_IRQ, 4); |
217 | VIC_Config(UART1_ITLine, VIC_IRQ, PRIORITY_UART1); |
219 | // enable the uart 1 IRQ |
218 | // enable the uart 1 IRQ |
220 | VIC_ITCmd(UART1_ITLine, ENABLE); |
219 | VIC_ITCmd(UART1_ITLine, ENABLE); |
221 | // initialize the debug timer |
220 | // initialize the debug timer |
222 | UART1_DebugData_Timer = SetDelay(UART1_DebugData_Interval); |
221 | UART1_DebugData_Timer = SetDelay(UART1_DebugData_Interval); |
Line 279... | Line 278... | ||
279 | UART0_Connect_to_MKGPS(); |
278 | UART0_Connect_to_MKGPS(); |
280 | } |
279 | } |
281 | abortState = 0; |
280 | abortState = 0; |
282 | break; |
281 | break; |
283 | } |
282 | } |
284 | // if the Debug uart is not UART1, rederect input to the Debug UART |
283 | // if the Debug uart is not UART1, redirect input to the Debug UART |
285 | if (DebugUART != UART1) |
284 | if (DebugUART != UART1) |
286 | { |
285 | { |
287 | // wait for space in the tx buffer of the DebugUART |
286 | // wait for space in the tx buffer of the DebugUART |
288 | while(UART_GetFlagStatus(DebugUART, UART_FLAG_TxFIFOFull) == SET) {}; |
287 | while(UART_GetFlagStatus(DebugUART, UART_FLAG_TxFIFOFull) == SET) {}; |
289 | // move byte to the tx fifi of the debug uart |
288 | // move byte to the tx fifi of the debug uart |