Rev 10 | Rev 13 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #pragma once |
1 | #pragma once |
2 | #include "libSerial/serial.h" |
2 | #include "libSerial/serial.h" |
3 | 3 | ||
4 | extern void sendString(usart_ctl *ctl, char const *string, int length); |
- | |
5 | - | ||
6 | /// @brief storage for a string reader |
4 | /// @brief storage for a string reader |
7 | typedef struct |
5 | typedef struct |
8 | { |
6 | { |
9 | char *buffer; // pointer to workspace |
7 | char *buffer; // pointer to workspace |
10 | int limit; // string limit |
8 | int limit; // string limit |
Line 19... | Line 17... | ||
19 | EDIT_NULL = 0, ///< No result |
17 | EDIT_NULL = 0, ///< No result |
20 | EDIT_DONE, ///< All characters read |
18 | EDIT_DONE, ///< All characters read |
21 | EDIT_CR ///< Characters up to CR read |
19 | EDIT_CR ///< Characters up to CR read |
22 | } editBufferReturn; |
20 | } editBufferReturn; |
23 | 21 | ||
- | 22 | /// @brief Send a string to the user |
|
- | 23 | /// @param ctl |
|
24 | // working |
24 | /// @param string |
- | 25 | /// @param length |
|
- | 26 | extern void sendString(usart_ctl *ctl, char const *string, int length); |
|
- | 27 | ||
- | 28 | /// @brief Prepare the line buffer reader |
|
- | 29 | /// @param context editBuffer object to initialise |
|
- | 30 | /// @param buffer Pointer to data: externally allocated memory buffer. |
|
- | 31 | /// @param limit Maximum number of bytes in externally allocated memory buffer. |
|
- | 32 | /// @param readLines if 1 then we are reading text with <CR> as line terminator, control codes ignored. |
|
25 | extern void initReadLine(editBuffer *context, char *buffer, int limit, char readLines); |
33 | extern void initReadLine(editBuffer *context, char *buffer, int limit, char readLines); |
26 | 34 | ||
- | 35 | /// @brief Poll the line buffer reader |
|
- | 36 | /// @param ctl pointer to a USART control structure |
|
- | 37 | /// @param context pointer to the editBuffer context |
|
- | 38 | /// @return what kind of state the buffer is now in |
|
27 | extern editBufferReturn readLine(usart_ctl *ctl, editBuffer *context); |
39 | extern editBufferReturn readLine(usart_ctl *ctl, editBuffer *context); |