IRPyro messaging application
Communications program between IRPyro and IRPyro evaluation tool
|
Go to the documentation of this file.
43 #ifndef MESSAGE_TO_GUI
47 #define BYTES_TO_GUI_SIZE (64)
78 static void AFE_to_bytes(AFE_reg_type AFE_register, uint8_t * AFE_byte )
82 AFE_byte[0] = AFE_register.S7_S0;
83 bit_value |= (AFE_register.LP << 7 )& 0X80 ;
84 bit_value |= (AFE_register.HP << 6 )& 0X40 ;
85 bit_value |= (AFE_register.C_LP << 4 )& 0X30 ;
86 bit_value |= (AFE_register.CLK_OUT << 3 )& 0X08 ;
87 bit_value |= (AFE_register.SYNC << 2 )& 0X04 ;
88 bit_value |= (AFE_register.TEMP << 1 )& 0X02 ;
89 bit_value |= (AFE_register.INT << 0 )& 0X01 ;
90 AFE_byte[1] = bit_value;
95 static void CCP_to_bytes(CCP_reg_type CCP_register, uint8_t *CCP_byte )
97 uint8_t bit_value = 0;
99 bit_value |= (CCP_register.Feedback_transconductance << 6)& 0XC0 ;
100 bit_value |= (CCP_register.High_pass_filter_setting << 4)& 0X30 ;
101 bit_value |= (CCP_register.Feedback_cap << 1)& 0X0E ;
102 bit_value |= (CCP_register.status_bit << 0)& 0X01 ;
103 *CCP_byte = bit_value;
108 static void WUP_to_bytes(WUP_reg_type WUP_register, uint8_t * WUP_byte)
110 uint8_t bit_value = 0;
112 WUP_byte[0] = WUP_register.UHT;
113 WUP_byte[1] = WUP_register.ULT;
114 WUP_byte[2] = WUP_register.LHT;
115 WUP_byte[3] = WUP_register.LLT;
116 WUP_byte[4] = WUP_register.WT_Threshold;
118 bit_value |= (WUP_register.ST << 6)& 0X40 ;
119 bit_value |= (WUP_register.DP0_DP2 << 3)& 0X38 ;
120 bit_value |= (WUP_register.CH0_CH2 << 0)& 0X07 ;
121 WUP_byte[5] = bit_value;
134 static uint8_t
crc_gen(
const uint8_t *current_byte, uint8_t bytes_to_process)
140 byte_to_crc = *current_byte;
145 while (bytes_to_process);
209 #define FIRMWARE_STRING_SIZE 52
221 uint8_t asic_version_byte[] = {0x21,0x21,0x21,0x21};
235 uint8_t afe_bytes_index = 0;
236 uint8_t num_sensors_to_process;
238 uint8_t num_sensors_to_process_for_byte_array;
241 num_sensors_to_process_for_byte_array = num_sensors_to_process;
245 array_of_afe_bytes[afe_bytes_index]=afe_bytes[1];
248 -- num_sensors_to_process;
250 while (num_sensors_to_process);
265 uint8_t channel_count = 0;
270 uint8_t channel_count_for_byte_array = channel_count;
271 uint8_t byte_array_idx = 0;
272 CCP_reg_type CCP_value = {0};
277 CCP_to_bytes(CCP_value, &array_of_ccp_bytes[byte_array_idx]);
283 while (channel_count);
284 channel_count = channel_count_for_byte_array;
307 uint8_t num_sensors_to_process;
308 uint8_t num_sensors_to_process_for_byte_array;
313 num_sensors_to_process_for_byte_array = num_sensors_to_process;
317 if (num_sensors_to_process_for_byte_array>1)
321 for(uint8_t wup_idx =0; wup_idx <
WUP_SIZE; ++ wup_idx)
323 array_of_wup_bytes[wup_idx + WUP_offset]=wup_bytes[wup_idx];
326 -- num_sensors_to_process;
328 while (num_sensors_to_process);
395 uint8_t afe_bytes[2];
530 uint8_t channel_selected;
535 {0,0},{0,1},{0,2},{0,3},{0,4},
536 {1,0},{1,1},{1,2},{1,3},{1,4},
537 {2,0},{2,1},{2,2},{2,3},{2,4},
538 {3,0},{3,1},{3,2},{3,3},{3,4}
552 for(uint8_t scope=0; scope < 7 ; ++ scope)
567 uint8_t time_to_send_sample = 0;
571 time_to_send_sample = 1;
619 #define CMD_ARRAY_SIZE (35)
static void gen_CCP_read(void)
collects CCP values according to Channel Configuration
#define FIRMWARE_STRING_SIZE
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
static void reset_soft(void)
Sensor reset successful.
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
static void bytes_to_gui_init(void)
initialize bytes array
void message_generator(uint8_t cmd_to_gui, uint8_t destination)
prepares packet to GUI
static void unit_id_read(void)
returns the unit id byte
static void logical_channels_read(void)
returns the value of the current scopes configuration
static void set_emitter_timings(void)
operation successful
uint8_t bytes_to_gui[BYTES_TO_GUI_SIZE]
static void get_failure_flags(void)
returns the value of the internal test byte
static uint32_t sample_period_timer
Sampling rate operation successful.
void message_prepack_data_sort(void)
Sorts sampling data from configured sensors.
uint8_t bytes_to_gui_size
uint8_t channel_processing(uint8_t *channel_count)
prepares for channel_id requests
static void CCP_to_bytes(CCP_reg_type CCP_register, uint8_t *CCP_byte)
encodes the CCP register contents of this_device into IRPyro
static void sampling_rate_write(void)
void get_bytes_to_GUI(uint8_t packet_function, uint8_t const *bytes_to_gui, uint16_t size)
selects the correct function to send data to the gui.
static void gen_AFE_read(void)
Get the AFE values Get byte[1] of the AFE register for:
uint8_t ChannelConfiguration[NUMBER_OF_SCOPES_IN_THE_GUI]
static void fndummy(void)
null function to fill unimplemented gaps
static void set_darkpixel_state(void)
operation successful
uint8_t channel_id_to_channel(void)
maps the GUI scope channel_id to physical channel on the sensor
static void gen_WUP_write(void)
WUP write successful.
#define BYTES_TO_GUI_SIZE
static void data_swap(uint8_t scope)
uint8_t channel_id_to_sensor(void)
maps the GUI scope channel_id to physical sensor
static void response_ok(void)
prepares ok string for GUI
static void sampling_rate_read(void)
returns the value of the sampling rate form the selected sensor
uint8_t response_required
static void status_start(void)
sends status start completion to GUI
uint8_t num_of_IRPyro_on_demo_board
static void report_error(void)
Prepare the "err\n" string for the GUI.
static void status_stop(void)
sends status stop to GUI
static void reset_hard(void)
board reset successful
static void response_err(void)
prepares ok string for GUI
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
static void message_generator_select_status(void)
Send status to GUI on time.
static void goto_sleep(void)
Sleep command successful.
const struct channel_configuration_map on_board[]
static void gen_CCP_write(void)
CCP write successful.
uint8_t status_need_to_send
Prepares configuration and sampling data from the sensor to be send to the GUI.
static void message_generator_selector()
test the condition to send a packet.
const uint8_t error_string[]
void channel_id_next(void)
increments the channel index
static uint8_t crc_gen(const uint8_t *current_byte, uint8_t bytes_to_process)
calculates the xor on bytes_to_GUI
static void second_unit_id_read(void)
operation successful
static void streaming_start(void)
streaming start successful
static void streaming_stop(void)
operation successful
static void wake_up(void)
Wake up command successful.
#define NUMBER_OF_SCOPES_IN_THE_GUI
static void message_generator_select_stream(void)
Enables streaming to the GUI.
static void asic_version_read(void)
IRPyro ASIC version byte.
IRPyro_cmd_type IRPyro_device_cmd
uint8_t JustStartedStreaming
void process_parms_load(uint8_t *idx, uint8_t *num_sensors_to_process)
configures for loop for single or multiple sensor operations
static int32_t current_sampling_data_frame_cnt
static void get_darkpixel_state(void)
operation successful
static void unit_id_write(void)
operation successful
static void firmware_version_send(void)
prepares the firmware version string
static void gen_AFE_write(void)
AFE write successful.
static bool condition_to_send_stream()
evaluates conditions to send stream
static void set_emitter_state(void)
operation successful
static void reset_hardware(void)
hardware reset successful
const uint8_t ok_string[]
static void null_test_command(void)
responds "ok" to GUI
static void logical_channels_write(void)
operation successful
static void board_type_read(void)
returns the byte identifying the board
static void gen_WUP_read(void)
Reads the WUP values of the selected sensor.
static int32_t sent_sampling_data_frame_cnt
IRPyro_devices IRPyro_device
int32_t ConfiguredSensorsSamplingDataToGUI[8]
Places sensor collected data in a buffer according to the map.