Rev 268 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 268 | Rev 290 | ||
|---|---|---|---|
| Line 14... | Line 14... | ||
| 14 | return 0; |
14 | return 0; |
| 15 | } |
15 | } |
| 16 | 16 | ||
| 17 | static int app_getchar(FILE *stream) { |
17 | static int app_getchar(FILE *stream) { |
| 18 | return bios->debug_getchar(); |
18 | return bios->debug_getchar(); |
| - | 19 | } |
|
| - | 20 | ||
| - | 21 | void can_receive(Can_Message_t *msg) { |
|
| - | 22 | printf("candata!\n"); |
|
| 19 | } |
23 | } |
| 20 | 24 | ||
| 21 | int main(void) |
25 | int main(void) |
| 22 | { |
26 | { |
| 23 | unsigned long time; |
27 | unsigned long time; |
| 24 | unsigned long time1 = |
28 | unsigned long time1 = bios->timebase_get(); |
| 25 | unsigned long time2 = |
29 | unsigned long time2 = bios->timebase_get(); |
| 26 | 30 | ||
| 27 | sei(); |
31 | sei(); |
| 28 | 32 | ||
| 29 | stdout = &mystdio; |
33 | stdout = &mystdio; |
| 30 | stdin = &mystdio; |
34 | stdin = &mystdio; |
| - | 35 | ||
| - | 36 | Can_Message_t txMsg; |
|
| - | 37 | txMsg.Id = 100; |
|
| - | 38 | txMsg.DataLength = 0; |
|
| - | 39 | txMsg.RemoteFlag = 0; |
|
| - | 40 | txMsg.ExtendedFlag = 1; |
|
| - | 41 | ||
| - | 42 | //set up callback for candata |
|
| - | 43 | bios->can_callback = &can_receive; |
|
| 31 | 44 | ||
| 32 | printf("AVR Test Application\n"); |
45 | printf("AVR Test Application\n"); |
| 33 | printf("Using AVR BIOS version %x\n", bios->version); |
46 | printf("Using AVR BIOS version %x\n", bios->version); |
| 34 | 47 | ||
| 35 | while (1) { |
48 | while (1) { |
| 36 | time = bios->timebase_get(); |
49 | time = bios->timebase_get(); |
| 37 | if ((time - time1) >= 2000) { |
50 | if ((time - time1) >= 2000) { |
| - | 51 | //test-send a canmessage |
|
| - | 52 | bios->can_send(&txMsg); |
|
| 38 | time1 = time; |
53 | time1 = time; |
| 39 | printf("Two seconds passed, time is now %d.\n", (int)time); |
54 | printf("Two seconds passed, time is now %d.\n", (int)time); |
| 40 | } |
55 | } |
| 41 | 56 | ||
| 42 | if ((time - time2) >= 20000) { |
57 | if ((time - time2) >= 20000) { |