IRPyro messaging application
Communications program between IRPyro and IRPyro evaluation tool
message_generator.c File Reference

Recovers requested configuration/data to be send to the GUI. More...

#include "message_generator.h"
#include "version.h"
Include dependency graph for message_generator.c:

Go to the source code of this file.

Macros

#define AFE_SIZE   (2)
 
#define BYTES_TO_GUI_SIZE   (64)
 
#define CMD_ARRAY_SIZE   (35)
 
#define FIRMWARE_STRING_SIZE   52
 
#define WUP_SIZE   (6)
 

Functions

static void AFE_to_bytes (AFE_reg_type AFE_register, uint8_t *AFE_byte)
 encodes the AFE register contents of this_device into the IRPyro More...
 
static void asic_version_read (void)
 IRPyro ASIC version byte. More...
 
static void board_type_read (void)
 returns the byte identifying the board More...
 
static void bytes_to_gui_init (void)
 initialize bytes array More...
 
static void CCP_to_bytes (CCP_reg_type CCP_register, uint8_t *CCP_byte)
 encodes the CCP register contents of this_device into IRPyro More...
 
static bool condition_to_send_stream ()
 evaluates conditions to send stream More...
 
static uint8_t crc_gen (const uint8_t *current_byte, uint8_t bytes_to_process)
 calculates the xor on bytes_to_GUI More...
 
static void data_swap (uint8_t scope)
 
static void firmware_version_send (void)
 prepares the firmware version string More...
 
static void fndummy (void)
 null function to fill unimplemented gaps More...
 
static void gen_AFE_read (void)
 Get the AFE values Get byte[1] of the AFE register for: More...
 
static void gen_AFE_write (void)
 AFE write successful. More...
 
static void gen_CCP_read (void)
 collects CCP values according to Channel Configuration More...
 
static void gen_CCP_write (void)
 CCP write successful. More...
 
static void gen_WUP_read (void)
 Reads the WUP values of the selected sensor. More...
 
static void gen_WUP_write (void)
 WUP write successful. More...
 
static void get_darkpixel_state (void)
 operation successful More...
 
static void get_failure_flags (void)
 returns the value of the internal test byte More...
 
static void goto_sleep (void)
 Sleep command successful. More...
 
static void logical_channels_read (void)
 returns the value of the current scopes configuration More...
 
static void logical_channels_write (void)
 operation successful More...
 
void message_generator (uint8_t cmd_to_gui, uint8_t destination)
 prepares packet to GUI More...
 
static void message_generator_select_status (void)
 Send status to GUI on time. More...
 
static void message_generator_select_stream (void)
 Enables streaming to the GUI. More...
 
static void message_generator_selector ()
 test the condition to send a packet. More...
 
void message_prepack_data_sort (void)
 Sorts sampling data from configured sensors. More...
 
static void null_test_command (void)
 responds "ok" to GUI More...
 
static void report_error (void)
 Prepare the "err\n" string for the GUI. More...
 
static void reset_hard (void)
 board reset successful More...
 
static void reset_hardware (void)
 hardware reset successful More...
 
static void reset_soft (void)
 Sensor reset successful. More...
 
static void response_byte_array_ok (uint8_t *byte_array, uint8_t size_of_byte_array)
 prepares byte array + ok + crc as a byte array for GUI More...
 
static void response_err (void)
 prepares ok string for GUI More...
 
static void response_ok (void)
 prepares ok string for GUI More...
 
static void sampling_rate_read (void)
 returns the value of the sampling rate form the selected sensor More...
 
static void sampling_rate_write (void)
 
static void second_unit_id_read (void)
 operation successful More...
 
static void set_darkpixel_state (void)
 operation successful More...
 
static void set_emitter_state (void)
 operation successful More...
 
static void set_emitter_timings (void)
 operation successful More...
 
static void status_start (void)
 sends status start completion to GUI More...
 
static void status_stop (void)
 sends status stop to GUI More...
 
static void streaming_start (void)
 streaming start successful More...
 
static void streaming_stop (void)
 operation successful More...
 
static void unit_id_read (void)
 returns the unit id byte More...
 
static void unit_id_write (void)
 operation successful More...
 
static void wake_up (void)
 Wake up command successful. More...
 
static void WUP_to_bytes (WUP_reg_type WUP_register, uint8_t *WUP_byte)
 encodes the WUP register contents of this_device into the IRPyro More...
 

Variables

uint8_t bytes_to_gui [BYTES_TO_GUI_SIZE]
 
uint8_t bytes_to_gui_size = 0
 
int32_t ConfiguredSensorsSamplingDataToGUI [8] = {0}
 Places sensor collected data in a buffer according to the map. More...
 
static int32_t current_sampling_data_frame_cnt = 1
 
const uint8_t error_string [] = {0x65,0x72,0x72,0x0A,0x90}
 
uint8_t JustStartedStreaming
 
const uint8_t ok_string [] = {0x6F,0x6B,0x0A}
 
uint8_t packet_function
 
uint8_t response_required
 
static uint32_t sample_period_timer
 Sampling rate operation successful. More...
 
uint8_t sensor_selected
 
static int32_t sent_sampling_data_frame_cnt = 0
 

Detailed Description

Recovers requested configuration/data to be send to the GUI.

Author
_KEMET, Ltd
Date
March 2018
Version
Release 1.0.6
Attention

© COPYRIGHT 2018 _KEMET, Ltd

   Copyright (c) 2018, _KEMET, Ltd
   All rights reserved.

   THIS SOFTWARE IS PROVIDED BY _KEMET, Ltd ''AS IS'' AND ANY
   EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   DISCLAIMED. IN NO EVENT SHALL _KEMET, Ltd BE LIABLE FOR ANY
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file message_generator.c.

Macro Definition Documentation

◆ AFE_SIZE

#define AFE_SIZE   (2)

◆ BYTES_TO_GUI_SIZE

#define BYTES_TO_GUI_SIZE   (64)

Definition at line 48 of file message_generator.c.

◆ CMD_ARRAY_SIZE

#define CMD_ARRAY_SIZE   (35)

◆ FIRMWARE_STRING_SIZE

#define FIRMWARE_STRING_SIZE   52

◆ WUP_SIZE

#define WUP_SIZE   (6)

Variable Documentation

◆ bytes_to_gui

uint8_t bytes_to_gui[BYTES_TO_GUI_SIZE]

Definition at line 53 of file message_generator.c.

◆ bytes_to_gui_size

uint8_t bytes_to_gui_size = 0

Definition at line 54 of file message_generator.c.

◆ error_string

const uint8_t error_string[] = {0x65,0x72,0x72,0x0A,0x90}

Definition at line 48 of file message_generator.c.

◆ JustStartedStreaming

uint8_t JustStartedStreaming

Definition at line 55 of file message_generator.c.

◆ ok_string

const uint8_t ok_string[] = {0x6F,0x6B,0x0A}

Definition at line 49 of file message_generator.c.

◆ packet_function

uint8_t packet_function

Definition at line 51 of file message_generator.c.

◆ response_required

uint8_t response_required

Definition at line 50 of file message_generator.c.

◆ sensor_selected

uint8_t sensor_selected

Definition at line 52 of file message_generator.c.