minipix_uart_interface
A library and examples for the MiniPIX UART interface
mui.h File Reference
#include <llcp_minipix_messages.h>
#include <llcp.h>
#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for mui.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...
 

Macro Definition Documentation

◆ MUI_SEND_CHAR

#define MUI_SEND_CHAR   0

◆ MUI_SEND_STRING

#define MUI_SEND_STRING   0

◆ MUI_USER_HANDSHAKES

#define MUI_USER_HANDSHAKES   0

Typedef Documentation

◆ mui_ledSetHW_t

typedef void(* mui_ledSetHW_t) (const bool)

Function pointer for implementation of seting an LED state.

Parameters
true= light is on, false = light is of

◆ mui_processAck_t

typedef void(* mui_processAck_t) (const LLCP_Ack_t *ack_data)

Function pointer to user implementation of callback to process incoming Ack message.

Parameters
pointerto the structure with the data

◆ mui_processFrameData_t

typedef void(* mui_processFrameData_t) (const LLCP_FrameData_t *image_data)

Function pointer to user implementation of callback to process incoming Frame data.

Parameters
pointerto the structure with the data

◆ mui_processFrameDataTerminator_t

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).

Parameters
pointerto the structure with the data

◆ mui_processFrameMeasurementFinished_t

typedef void(* mui_processFrameMeasurementFinished_t) (void)

Function pointer to user implementation of callback to process message regarding that a measurement was finished.

◆ mui_processMinipixError_t

typedef void(* mui_processMinipixError_t) (const LLCP_MinipixError_t *error_data)

Function pointer to user implementation of callback to process incoming MiniPIX error message.

Parameters
pointerto the structure with the data

◆ mui_processStatus_t

typedef void(* mui_processStatus_t) (const LLCP_Status_t *status_data)

Function pointer to user implementation of callback to process incoming Status message.

Parameters
pointerto the structure with the data

◆ mui_processTemperature_t

typedef void(* mui_processTemperature_t) (const LLCP_Temperature_t *temperature_data)

Function pointer to user implementation of callback to process incoming Temperature message.

Parameters
pointerto the structure with the data

◆ mui_sendChar_t

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.

Parameters
byteto send

◆ mui_sendString_t

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.

Parameters
str_outpoiter to the first element of the byte array
lenthe number of bytes to send

◆ mui_sleepHW_t

typedef void(* mui_sleepHW_t) (const uint16_t duration)

Function pointer for implementation of a sleep function.

Parameters
durationtime to sleep in milliseconds

Function Documentation

◆ mui_getFrameData()

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.

Parameters
mui_handler

◆ mui_getStatus()

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.

Parameters
mui_handle

◆ mui_getTemperature()

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.

Parameters
mui_handle

◆ mui_initialize()

void mui_initialize ( MUI_Handler_t mui_handler)

The "constructor" of the MUI handler. Should be called by the user just after allocating it.

Parameters
mui_handler

◆ mui_ledSet()

void mui_ledSet ( MUI_Handler_t mui_handler,
const bool  new_state 
)

set LED state

Parameters
mui_handler
new_statetrue = light is on, false = light is off

◆ mui_ledToggle()

void mui_ledToggle ( MUI_Handler_t mui_handler)

toggle the state of the LED

Parameters
mui_handler

◆ mui_measureFrame()

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.

Parameters
mui_handler
acquisition_timeAcquisition time in milliseconds
modepixel measurement mode: LLCP_TPX3_PXL_MODE_{TOA_TOT,TOA,MPX_ITOT}

◆ mui_pwr()

void mui_pwr ( MUI_Handler_t mui_handler,
const bool  state 
)

Command to power on/off the Timepix3 chip.

Parameters
mui_handler
statetrue/false, power on/off

◆ mui_receiveCharCallback()

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.

Parameters
mui_handler
byte_in

◆ mui_sendAck()

void mui_sendAck ( MUI_Handler_t mui_handler,
const bool  success 
)

Sends ack to the MiniPIX. Not to be called by the user.

Parameters
mui_handler
success

◆ mui_sendMessage()

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.

Parameters
mui_handler
messagethe string to send
lenhow many bytes to send

◆ mui_setConfigurationPreset()

void mui_setConfigurationPreset ( MUI_Handler_t mui_handler,
const uint8_t  preset 
)

Command to set configuration preset.

Parameters
mui_handler
preset

◆ mui_setThreshold()

void mui_setThreshold ( MUI_Handler_t mui_handler,
const uint16_t  threshold_coarse,
const uint16_t  threshold_fine 
)

Command to set energy threshold.

Parameters
mui_handler
threshold

◆ mui_update()

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.

Parameters
mui_handler

◆ mui_updatePixelMask()

void mui_updatePixelMask ( MUI_Handler_t mui_handler,
LLCP_UpdatePixelMaskReq_t data 
)

Command to update a mask of a particular pixel.

Parameters
mui_handler
LLCP_UpdatePixelMaskReq_t