Rev 63 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 63 | Rev 69 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | void UartParseByte(uint8_t c) { |
43 | void UartParseByte(uint8_t c) { |
| 44 | static CanMessage_t cm; |
44 | static CanMessage_t cm; |
| 45 | static uint8_t waitingMessage = 0; |
45 | static uint8_t waitingMessage = 0; |
| 46 | static uint32_t startTime = 0; |
46 | static uint32_t startTime = 0; |
| 47 | static int8_t count = 0; |
47 | static int8_t count = 0; |
| 48 | - | ||
| 49 | printf("Byte: %u\n", c); |
- | |
| 50 | 48 | ||
| 51 | /* 50ms timeout */ |
49 | /* 50ms timeout */ |
| 52 |
|
50 | if (waitingMessage && TimebasePassedTimeMS(startTime) > 50) { |
| 53 | waitingMessage = 0; |
51 | waitingMessage = 0; |
| 54 |
|
52 | } |
| 55 | 53 | ||
| 56 | if (waitingMessage) { |
54 | if (waitingMessage) { |
| 57 | /* save start time */ |
55 | /* save start time */ |
| 58 | startTime = TimebaseCurrentTime(); |
56 | startTime = TimebaseCurrentTime(); |
| 59 | /* UART END */ |
57 | /* UART END */ |
| 60 | if (count >= 15) { |
58 | if (count >= 15) { |
| - | 59 | if (c == UART_END_BYTE) { |
|
| 61 | PORTC ^= (1<<PC0); |
60 | PORTC ^= (1<<PC0); |
| 62 | //if (c == UART_END_BYTE) { |
- | |
| 63 | CanSend(&cm); |
61 | CanSend(&cm); |
| 64 |
|
62 | } |
| 65 | waitingMessage = 0; |
63 | waitingMessage = 0; |
| 66 | return; |
64 | return; |
| 67 | } |
65 | } |
| 68 | /* data */ |
66 | /* data */ |
| 69 | else if (count >= 7) { |
67 | else if (count >= 7) { |