minipix_uart_interface
A library and examples for the MiniPIX UART interface
|
#include <llcp_minipix_messages.h>
#include <llcp.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | MUI_FcnPrototypes_t |
Structure containing pointers to user callbacks. User shouls provide implementations to all the listed functions. More... | |
struct | MUI_Handler_t |
Macros | |
#define | MUI_USER_HANDSHAKES 0 |
#define | MUI_SEND_STRING 0 |
#define | MUI_SEND_CHAR 0 |
Typedefs | |
typedef void(* | mui_ledSetHW_t) (const bool) |
Function pointer for implementation of seting an LED state. More... | |
typedef void(* | mui_sendChar_t) (const uint8_t char_out) |
Function pointer for implementaion of sending a char (byte) over a serial line to MiniPIX. More... | |
typedef void(* | mui_sendString_t) (const uint8_t *str_out, const uint16_t len) |
Function pointer for implementation of sending a string (array of bytes) over a serial line to MiniPIX. More... | |
typedef void(* | mui_processFrameData_t) (const LLCP_FrameData_t *image_data) |
Function pointer to user implementation of callback to process incoming Frame data. More... | |
typedef void(* | mui_processFrameMeasurementFinished_t) (void) |
Function pointer to user implementation of callback to process message regarding that a measurement was finished. More... | |
typedef void(* | mui_processFrameDataTerminator_t) (const LLCP_FrameDataTerminator_t *terminator) |
Function pointer to user implementation of callback to process incoming Frame data terminator (the last packet). More... | |
typedef void(* | mui_processStatus_t) (const LLCP_Status_t *status_data) |
Function pointer to user implementation of callback to process incoming Status message. More... | |
typedef void(* | mui_processTemperature_t) (const LLCP_Temperature_t *temperature_data) |
Function pointer to user implementation of callback to process incoming Temperature message. More... | |
typedef void(* | mui_processAck_t) (const LLCP_Ack_t *ack_data) |
Function pointer to user implementation of callback to process incoming Ack message. More... | |
typedef void(* | mui_processMinipixError_t) (const LLCP_MinipixError_t *error_data) |
Function pointer to user implementation of callback to process incoming MiniPIX error message. More... | |
typedef void(* | mui_sleepHW_t) (const uint16_t duration) |
Function pointer for implementation of a sleep function. More... | |
Functions | |
void | mui_initialize (MUI_Handler_t *mui_handler) |
The "constructor" of the MUI handler. Should be called by the user just after allocating it. More... | |
void | mui_pwr (MUI_Handler_t *mui_handler, const bool state) |
Command to power on/off the Timepix3 chip. More... | |
void | mui_measureFrame (MUI_Handler_t *mui_handler, const uint16_t acquisition_time, const uint8_t mode) |
Command to acquire a frame over a period of the acquisition_time. As a result, the MiniPIX will start obtaning data and will call the processFrameData() function will be called. More... | |
void | mui_getFrameData (MUI_Handler_t *mui_handler) |
Command to request measured frame data. As a result, the MiniPIX will start obtaning data and will call the processFrameData() function will be called. More... | |
void | mui_setThreshold (MUI_Handler_t *mui_handler, const uint16_t threshold_coarse, const uint16_t threshold_fine) |
Command to set energy threshold. More... | |
void | mui_setConfigurationPreset (MUI_Handler_t *mui_handler, const uint8_t preset) |
Command to set configuration preset. More... | |
void | mui_updatePixelMask (MUI_Handler_t *mui_handler, LLCP_UpdatePixelMaskReq_t *data) |
Command to update a mask of a particular pixel. More... | |
void | mui_getStatus (MUI_Handler_t *mui_handle) |
Command to get the status of the MinixPIX HW. As a result, the method processStatus() will get called. More... | |
void | mui_getTemperature (MUI_Handler_t *mui_handle) |
Command to get the temperature of the MinixPIX HW. As a result, the method processTemperature() will get called. More... | |
void | mui_receiveCharCallback (MUI_Handler_t *mui_handler, const uint8_t byte_in) |
Called by the user with every incoming byte on the UART to the MiniPIX. More... | |
void | mui_update (MUI_Handler_t *mui_handler) |
Called by the user to led MUI do stuff in the background. Should be called regularly, e.g., in the main() loop or in a timer's callback. More... | |
void | mui_sendAck (MUI_Handler_t *mui_handler, const bool success) |
Sends ack to the MiniPIX. Not to be called by the user. More... | |
void | mui_sendMessage (MUI_Handler_t *mui_handler, const uint8_t *message, const uint16_t len) |
Abstraction above sending a message. Will use either sendString or sendChar basend on configuration. More... | |
void | mui_ledSet (MUI_Handler_t *mui_handler, const bool new_state) |
set LED state More... | |
void | mui_ledToggle (MUI_Handler_t *mui_handler) |
toggle the state of the LED More... | |
#define MUI_SEND_CHAR 0 |
#define MUI_SEND_STRING 0 |
#define MUI_USER_HANDSHAKES 0 |
typedef void(* mui_ledSetHW_t) (const bool) |
Function pointer for implementation of seting an LED state.
true | = light is on, false = light is of |
typedef void(* mui_processAck_t) (const LLCP_Ack_t *ack_data) |
Function pointer to user implementation of callback to process incoming Ack message.
pointer | to the structure with the data |
typedef void(* mui_processFrameData_t) (const LLCP_FrameData_t *image_data) |
Function pointer to user implementation of callback to process incoming Frame data.
pointer | to the structure with the data |
typedef void(* mui_processFrameDataTerminator_t) (const LLCP_FrameDataTerminator_t *terminator) |
Function pointer to user implementation of callback to process incoming Frame data terminator (the last packet).
pointer | to the structure with the data |
typedef void(* mui_processFrameMeasurementFinished_t) (void) |
Function pointer to user implementation of callback to process message regarding that a measurement was finished.
typedef void(* mui_processMinipixError_t) (const LLCP_MinipixError_t *error_data) |
Function pointer to user implementation of callback to process incoming MiniPIX error message.
pointer | to the structure with the data |
typedef void(* mui_processStatus_t) (const LLCP_Status_t *status_data) |
Function pointer to user implementation of callback to process incoming Status message.
pointer | to the structure with the data |
typedef void(* mui_processTemperature_t) (const LLCP_Temperature_t *temperature_data) |
Function pointer to user implementation of callback to process incoming Temperature message.
pointer | to the structure with the data |
typedef void(* mui_sendChar_t) (const uint8_t char_out) |
Function pointer for implementaion of sending a char (byte) over a serial line to MiniPIX.
byte | to send |
typedef void(* mui_sendString_t) (const uint8_t *str_out, const uint16_t len) |
Function pointer for implementation of sending a string (array of bytes) over a serial line to MiniPIX.
str_out | poiter to the first element of the byte array |
len | the number of bytes to send |
typedef void(* mui_sleepHW_t) (const uint16_t duration) |
Function pointer for implementation of a sleep function.
duration | time to sleep in milliseconds |
void mui_getFrameData | ( | MUI_Handler_t * | mui_handler | ) |
Command to request measured frame data. As a result, the MiniPIX will start obtaning data and will call the processFrameData() function will be called.
mui_handler |
void mui_getStatus | ( | MUI_Handler_t * | mui_handle | ) |
Command to get the status of the MinixPIX HW. As a result, the method processStatus() will get called.
mui_handle |
void mui_getTemperature | ( | MUI_Handler_t * | mui_handle | ) |
Command to get the temperature of the MinixPIX HW. As a result, the method processTemperature() will get called.
mui_handle |
void mui_initialize | ( | MUI_Handler_t * | mui_handler | ) |
The "constructor" of the MUI handler. Should be called by the user just after allocating it.
mui_handler |
void mui_ledSet | ( | MUI_Handler_t * | mui_handler, |
const bool | new_state | ||
) |
set LED state
mui_handler | |
new_state | true = light is on, false = light is off |
void mui_ledToggle | ( | MUI_Handler_t * | mui_handler | ) |
toggle the state of the LED
mui_handler |
void mui_measureFrame | ( | MUI_Handler_t * | mui_handler, |
const uint16_t | acquisition_time, | ||
const uint8_t | mode | ||
) |
Command to acquire a frame over a period of the acquisition_time. As a result, the MiniPIX will start obtaning data and will call the processFrameData() function will be called.
mui_handler | |
acquisition_time | Acquisition time in milliseconds |
mode | pixel measurement mode: LLCP_TPX3_PXL_MODE_{TOA_TOT,TOA,MPX_ITOT} |
void mui_pwr | ( | MUI_Handler_t * | mui_handler, |
const bool | state | ||
) |
Command to power on/off the Timepix3 chip.
mui_handler | |
state | true/false, power on/off |
void mui_receiveCharCallback | ( | MUI_Handler_t * | mui_handler, |
const uint8_t | byte_in | ||
) |
Called by the user with every incoming byte on the UART to the MiniPIX.
mui_handler | |
byte_in |
void mui_sendAck | ( | MUI_Handler_t * | mui_handler, |
const bool | success | ||
) |
Sends ack to the MiniPIX. Not to be called by the user.
mui_handler | |
success |
void mui_sendMessage | ( | MUI_Handler_t * | mui_handler, |
const uint8_t * | message, | ||
const uint16_t | len | ||
) |
Abstraction above sending a message. Will use either sendString or sendChar basend on configuration.
mui_handler | |
message | the string to send |
len | how many bytes to send |
void mui_setConfigurationPreset | ( | MUI_Handler_t * | mui_handler, |
const uint8_t | preset | ||
) |
Command to set configuration preset.
mui_handler | |
preset |
void mui_setThreshold | ( | MUI_Handler_t * | mui_handler, |
const uint16_t | threshold_coarse, | ||
const uint16_t | threshold_fine | ||
) |
Command to set energy threshold.
mui_handler | |
threshold |
void mui_update | ( | MUI_Handler_t * | mui_handler | ) |
Called by the user to led MUI do stuff in the background. Should be called regularly, e.g., in the main() loop or in a timer's callback.
mui_handler |
void mui_updatePixelMask | ( | MUI_Handler_t * | mui_handler, |
LLCP_UpdatePixelMaskReq_t * | data | ||
) |
Command to update a mask of a particular pixel.
mui_handler | |
LLCP_UpdatePixelMaskReq_t |