minipix_uart_interface
A library and examples for the MiniPIX UART interface
gatherer_interface.h
Go to the documentation of this file.
1 
13 #ifndef GATHERER_INTERFACE_H
14 #define GATHERER_INTERFACE_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #include <mui.h>
21 
22 #include <stdint.h>
23 #include <stdbool.h>
24 
25 #ifndef GATHERER_SEND_STRING
26 #define GATHERER_SEND_STRING 0
27 #endif
28 
29 #ifndef GATHERER_SEND_CHAR
30 #define GATHERER_SEND_CHAR 0
31 #endif
32 
33 #if ((GATHERER_SEND_CHAR == 0) && (GATHERER_SEND_STRING == 0))
34 #error \
35  "Cannot have both GATHERER_SEND_CHAR and GATHERER_SEND_STRING set to 0. At least one data handling function needs to be used! Please, read README at https://github.com/klaxalk/minipix_uart_interface/tree/master/software/gatherer for more details."
36 #endif
37 
38 // hw support
39 typedef void (*gatherer_sendChar_t)(const uint8_t char_out);
40 typedef void (*gatherer_sendString_t)(const uint8_t *str_out, const uint16_t len);
41 
42 typedef struct
43 {
44  // | ---------- platform-specific function prototypes --------- |
47  //
49 
50 
51 typedef struct
52 {
58 
59 void gatherer_initialize(Gatherer_Handler_t *gatherer_handler);
60 
61 // | ------------- UART communication with MiniPIX ------------ |
62 
69 void gatherer_receiveCharCallback(Gatherer_Handler_t *gatherer_handler, const uint8_t byte_in);
70 
71 // | ----------------- callbacks called by MUI ---------------- |
72 
73 void gatherer_processFrameData(Gatherer_Handler_t *gatherer_handler, const LLCP_FrameData_t *data);
75 void gatherer_processStatus(Gatherer_Handler_t *gatherer_handler, const LLCP_Status_t *data);
76 void gatherer_processTemperature(Gatherer_Handler_t *gatherer_handler, const LLCP_Temperature_t *data);
77 void gatherer_processAck(Gatherer_Handler_t *gatherer_handler, const LLCP_Ack_t *data);
78 void gatherer_processMinipixError(Gatherer_Handler_t *gatherer_handler, const LLCP_MinipixError_t *data);
80 
81 // | ------------------------- private ------------------------ |
82 
83 void gatherer_sendMessage(Gatherer_Handler_t *gatherer_handler, const uint8_t *str_out, const uint16_t len);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif // GATHERER_INTERFACE_H
gatherer_processTemperature
void gatherer_processTemperature(Gatherer_Handler_t *gatherer_handler, const LLCP_Temperature_t *data)
Definition: gatherer_interface.c:192
gatherer_initialize
void gatherer_initialize(Gatherer_Handler_t *gatherer_handler)
Definition: gatherer_interface.c:5
gatherer_processAck
void gatherer_processAck(Gatherer_Handler_t *gatherer_handler, const LLCP_Ack_t *data)
Definition: gatherer_interface.c:212
gatherer_processFrameDataTerminator
void gatherer_processFrameDataTerminator(Gatherer_Handler_t *gatherer_handler, const LLCP_FrameDataTerminator_t *data)
Definition: gatherer_interface.c:152
Gatherer_Handler_t::mui_handler_ptr_
MUI_Handler_t * mui_handler_ptr_
Definition: gatherer_interface.h:53
gatherer_receiveCharCallback
void gatherer_receiveCharCallback(Gatherer_Handler_t *gatherer_handler, const uint8_t byte_in)
callback called by a user with new bytes coming from the UART connected to PC
Definition: gatherer_interface.c:15
LLCP_Temperature_t
LLCP_Temperature_t
Definition: llcp_minipix_messages.h:935
Gatherer_Handler_t
Definition: gatherer_interface.h:51
gatherer_processFrameMeasurementFinished
void gatherer_processFrameMeasurementFinished(Gatherer_Handler_t *gatherer_handler)
Definition: gatherer_interface.c:252
gatherer_processFrameData
void gatherer_processFrameData(Gatherer_Handler_t *gatherer_handler, const LLCP_FrameData_t *data)
Definition: gatherer_interface.c:132
MUI_Handler_t
Definition: mui.h:158
LLCP_FrameData_t
LLCP_FrameData_t
Definition: llcp_minipix_messages.h:181
LLCP_Status_t
LLCP_Status_t
Definition: llcp_minipix_messages.h:829
Gatherer_FcnPrototypes_t::sendChar
gatherer_sendChar_t sendChar
Definition: gatherer_interface.h:45
Gatherer_Handler_t::llcp_receiver
LLCP_Receiver_t llcp_receiver
Definition: gatherer_interface.h:54
LLCP_Ack_t
LLCP_Ack_t
Definition: llcp_minipix_messages.h:682
gatherer_sendString_t
void(* gatherer_sendString_t)(const uint8_t *str_out, const uint16_t len)
Definition: gatherer_interface.h:40
Gatherer_FcnPrototypes_t
Definition: gatherer_interface.h:42
LLCP_RX_TX_BUFFER_SIZE
#define LLCP_RX_TX_BUFFER_SIZE
Definition: llcp.h:54
gatherer_sendChar_t
void(* gatherer_sendChar_t)(const uint8_t char_out)
Definition: gatherer_interface.h:39
gatherer_sendMessage
void gatherer_sendMessage(Gatherer_Handler_t *gatherer_handler, const uint8_t *str_out, const uint16_t len)
Definition: gatherer_interface.c:271
LLCP_MinipixError_t
LLCP_MinipixError_t
Definition: llcp_minipix_messages.h:1043
gatherer_processStatus
void gatherer_processStatus(Gatherer_Handler_t *gatherer_handler, const LLCP_Status_t *data)
Definition: gatherer_interface.c:172
LLCP_FrameDataTerminator_t
LLCP_FrameDataTerminator_t
Definition: llcp_minipix_messages.h:251
tx_buffer
uint8_t tx_buffer[TX_SERIAL_BUFFER_SIZE]
Definition: main.cpp:16
Gatherer_FcnPrototypes_t::sendString
gatherer_sendString_t sendString
Definition: gatherer_interface.h:46
Gatherer_Handler_t::fcns
Gatherer_FcnPrototypes_t fcns
Definition: gatherer_interface.h:56
gatherer_processMinipixError
void gatherer_processMinipixError(Gatherer_Handler_t *gatherer_handler, const LLCP_MinipixError_t *data)
Definition: gatherer_interface.c:232
LLCP_Receiver_t
LLCP_Receiver_t
Definition: llcp.h:107