Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 14 | Rev 15 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /// Functions provided that use serial code, but are more independent |
1 | /// Functions provided that use serial code, but are more independent |
2 | 2 | ||
3 | #include "libSerial/serialUtils.h" |
3 | #include "libSerial/serialUtils.h" |
4 | 4 | ||
- | 5 | #if defined __cplusplus |
|
- | 6 | extern "C" |
|
- | 7 | { |
|
- | 8 | #endif |
|
- | 9 | ||
- | 10 | ||
5 | void sendString(usart_ctl *ctl, char const *string, int length) |
11 | void sendString(struct usart_ctl *ctl, char const *string, int length) |
6 | { |
12 | { |
7 | for (int i = 0; i < length; i++) |
13 | for (int i = 0; i < length; i++) |
8 | PutCharSerial(ctl, string[i]); |
14 | PutCharSerial(ctl, string[i]); |
9 | } |
15 | } |
10 | 16 | ||
Line 16... | Line 22... | ||
16 | context->complete = 0; |
22 | context->complete = 0; |
17 | context->readLines = readLines; // if readlines , then we look for \r at the end of a line and skip control chars |
23 | context->readLines = readLines; // if readlines , then we look for \r at the end of a line and skip control chars |
18 | context->buffer[0] = 0; |
24 | context->buffer[0] = 0; |
19 | } |
25 | } |
20 | 26 | ||
21 | editBufferReturn readLine(usart_ctl *ctl, editBuffer *context) |
27 | editBufferReturn readLine(struct usart_ctl *ctl, editBuffer *context) |
22 | { |
28 | { |
23 | int cnt = PollSerial(ctl); |
29 | int cnt = PollSerial(ctl); |
24 | if (!cnt) |
30 | if (!cnt) |
25 | return EDIT_NULL; |
31 | return EDIT_NULL; |
26 | 32 | ||
Line 59... | Line 65... | ||
59 | } |
65 | } |
60 | 66 | ||
61 | int charCount(editBuffer * context) |
67 | int charCount(editBuffer * context) |
62 | { |
68 | { |
63 | return context->counter; |
69 | return context->counter; |
64 | } |
- | |
65 | 70 | } |
|
- | 71 | ||
- | 72 | ||
- | 73 | #if defined __cplusplus |
|
- | 74 | } |
|
- | 75 | #endif |
|
- | 76 |