Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 14 | Rev 15 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #pragma once |
1 | #pragma once |
| 2 | #include "libSerial/serial.h" |
2 | #include "libSerial/serial.h" |
| 3 | 3 | ||
| - | 4 | #if defined __cplusplus |
|
| - | 5 | extern "C" |
|
| - | 6 | { |
|
| - | 7 | #endif |
|
| - | 8 | ||
| 4 | /// @brief storage for a string reader |
9 | /// @brief storage for a string reader |
| 5 | typedef struct |
10 | typedef struct |
| 6 | { |
11 | { |
| 7 | char *buffer; // pointer to workspace |
12 | char *buffer; // pointer to workspace |
| 8 | int limit; // string limit |
13 | int limit; // string limit |
| Line 26... | Line 31... | ||
| 26 | 31 | ||
| 27 | /// @brief Send a string to the user |
32 | /// @brief Send a string to the user |
| 28 | /// @param ctl Handle of usart |
33 | /// @param ctl Handle of usart |
| 29 | /// @param string String to send |
34 | /// @param string String to send |
| 30 | /// @param length Length of string |
35 | /// @param length Length of string |
| 31 | extern void sendString(usart_ctl *ctl, char const *string, int length); |
36 | extern void sendString(struct usart_ctl *ctl, char const *string, int length); |
| 32 | 37 | ||
| 33 | /// @brief Prepare the line buffer reader |
38 | /// @brief Prepare the line buffer reader |
| 34 | /// @param context editBuffer object to initialise |
39 | /// @param context editBuffer object to initialise |
| 35 | /// @param buffer Pointer to data: externally allocated memory buffer. |
40 | /// @param buffer Pointer to data: externally allocated memory buffer. |
| 36 | /// @param limit Maximum number of bytes in externally allocated memory buffer. |
41 | /// @param limit Maximum number of bytes in externally allocated memory buffer. |
| Line 39... | Line 44... | ||
| 39 | 44 | ||
| 40 | /// @brief Poll the line buffer reader |
45 | /// @brief Poll the line buffer reader |
| 41 | /// @param ctl pointer to a USART control structure |
46 | /// @param ctl pointer to a USART control structure |
| 42 | /// @param context pointer to the editBuffer context |
47 | /// @param context pointer to the editBuffer context |
| 43 | /// @return what kind of state the buffer is now in |
48 | /// @return what kind of state the buffer is now in |
| 44 | extern editBufferReturn readLine(usart_ctl *ctl, editBuffer *context); |
49 | extern editBufferReturn readLine(struct usart_ctl *ctl, editBuffer *context); |
| 45 | 50 | ||
| 46 | /// @brief Reset the state of the line buffer reader for the next command |
51 | /// @brief Reset the state of the line buffer reader for the next command |
| 47 | /// @param context editBuffer object to reset |
52 | /// @param context editBuffer object to reset |
| 48 | extern void resetInput(editBuffer * context); |
53 | extern void resetInput(editBuffer * context); |
| 49 | 54 | ||
| 50 | - | ||
| 51 | /// @brief Return number of characters in context |
55 | /// @brief Return number of characters in context |
| 52 | /// @param context |
56 | /// @param context |
| 53 | /// @return number of characters in the context |
57 | /// @return number of characters in the context |
| 54 | extern int charCount(editBuffer * context); |
58 | extern int charCount(editBuffer * context); |
| - | 59 | ||
| - | 60 | #if defined __cplusplus |
|
| - | 61 | } |
|
| - | 62 | #endif |
|