csp_if_kiss.h
Go to the documentation of this file.
1 /*
2 Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
3 Copyright (C) 2012 GomSpace ApS (http://www.gomspace.com)
4 Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10 
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
27 #ifndef _CSP_IF_KISS_H_
28 #define _CSP_IF_KISS_H_
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <stdint.h>
35 
36 #include <csp/csp.h>
37 #include <csp/csp_interface.h>
38 
58 void csp_kiss_rx(csp_iface_t * interface, uint8_t *buf, int len, void *pxTaskWoken);
59 
69 typedef void (*csp_kiss_putc_f)(char buf);
70 
85 typedef void (*csp_kiss_discard_f)(char c, void *pxTaskWoken);
86 
90 typedef enum {
95 } kiss_mode_e;
96 
104 typedef struct csp_kiss_handle_s {
107  unsigned int rx_length;
108  kiss_mode_e rx_mode;
109  unsigned int rx_first;
110  volatile unsigned char *rx_cbuf;
113 
114 
118 void csp_kiss_init(csp_iface_t * csp_iface, csp_kiss_handle_t * csp_kiss_handle, csp_kiss_putc_f kiss_putc_f, csp_kiss_discard_f kiss_discard_f, const char * name);
119 
120 #ifdef __cplusplus
121 } /* extern "C" */
122 #endif
123 
124 #endif /* _CSP_IF_KISS_H_ */
125 
126 /* @} */
Interface struct.
Definition: csp_types.h:190
Definition: csp_if_kiss.h:91
Definition: csp_if_kiss.h:94
kiss_mode_e
Definition: csp_if_kiss.h:90
csp_packet_t * rx_packet
Definition: csp_if_kiss.h:111
Definition: csp_if_kiss.h:93
This structure should be statically allocated by the user and passed to the kiss interface during the...
Definition: csp_if_kiss.h:104
void(* csp_kiss_discard_f)(char c, void *pxTaskWoken)
The characters not accepted by the kiss interface, are discarded using this function, which must be implemented by the user and passed through the kiss_init function.
Definition: csp_if_kiss.h:85
void csp_kiss_rx(csp_iface_t *interface, uint8_t *buf, int len, void *pxTaskWoken)
The KISS interface relies on the USART callback in order to parse incoming messaged from the serial i...
void(* csp_kiss_putc_f)(char buf)
The putc function is used by the kiss interface to send a string of data to the serial port...
Definition: csp_if_kiss.h:69
Definition: csp_if_kiss.h:92
CSP PACKET STRUCTURE Note: This structure is constructed to fit with all interface frame types in ord...
Definition: csp_types.h:174
unsigned int rx_first
Definition: csp_if_kiss.h:109
unsigned int rx_length
Definition: csp_if_kiss.h:107
volatile unsigned char * rx_cbuf
Definition: csp_if_kiss.h:110
void csp_kiss_init(csp_iface_t *csp_iface, csp_kiss_handle_t *csp_kiss_handle, csp_kiss_putc_f kiss_putc_f, csp_kiss_discard_f kiss_discard_f, const char *name)
csp_kiss_discard_f kiss_discard
Definition: csp_if_kiss.h:106
kiss_mode_e rx_mode
Definition: csp_if_kiss.h:108
struct csp_kiss_handle_s csp_kiss_handle_t
This structure should be statically allocated by the user and passed to the kiss interface during the...
csp_kiss_putc_f kiss_putc
Definition: csp_if_kiss.h:105