IRPyro messaging application
Communications program between IRPyro and IRPyro evaluation tool
message_generator.c
Go to the documentation of this file.
1 /**
2 ******************************************************************************
3 * @file message_generator.c
4 * @author _KEMET, Ltd
5 * @date March 2018
6 * @version Release 1.0.6
7 * @copyright (c) 2018 _KEMET, Ltd
8 * @brief Recovers requested configuration/data to be send to the GUI
9 *
10 * @verbatim
11  ===============================================================================
12  ##### Description #####
13  ===============================================================================
14  [..]
15  after the execution of a valid instruction code message_generator()
16  - passes the code of packet function
17  - sets the next state of eevt: apply parameter or contact_GUI
18  - SET case: returns OK /ERR on success or failure
19  - GET case: fills a byte buffer with the data requested
20  [..]
21  @endverbatim
22  ******************************************************************************
23  @attention <h2><center>&copy; COPYRIGHT 2018 _KEMET, Ltd</center></h2>
24  @verbatim
25  Copyright (c) 2018, _KEMET, Ltd
26  All rights reserved.
27 
28  THIS SOFTWARE IS PROVIDED BY _KEMET, Ltd ''AS IS'' AND ANY
29  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31  DISCLAIMED. IN NO EVENT SHALL _KEMET, Ltd BE LIABLE FOR ANY
32  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  @endverbatim
39 
40  ******************************************************************************
41  */
42 /* Includes ------------------------------------------------------------------*/
43 #ifndef MESSAGE_TO_GUI
44 #include "message_generator.h"
45 #include "version.h"
46 #endif
47 #define BYTES_TO_GUI_SIZE (64)
48 const uint8_t error_string[] = {0x65,0x72,0x72,0x0A,0x90}; //"err\n";
49 const uint8_t ok_string[] = {0x6F,0x6B,0x0A}; //"ok\n";
54 uint8_t bytes_to_gui_size = 0;
56 
57 /** @defgroup message_interface Message Interface
58  * @ingroup eevt_main
59  * @brief Defines in firmware each individual command response to GUI commands
60  * @verbatim
61  *
62  * @endverbatim
63  * @note
64  * @{
65  */
66 /** @defgroup message_generator Message Generator
67  * @ingroup message_interface
68  * @brief Given a byte string response from the firmware, selects the adequate frame for the GUI.
69  * @verbatim
70  *
71  * @endverbatim
72  * @note
73  * @{
74  */
75 /**
76  * @brief encodes the AFE register contents of this_device into the IRPyro
77  */
78 static void AFE_to_bytes(AFE_reg_type AFE_register, uint8_t * AFE_byte )
79 {
80  uint8_t bit_value =0;
81 
82  AFE_byte[0] = AFE_register.S7_S0; // 0b11111111
83  bit_value |= (AFE_register.LP << 7 )& 0X80 ; // 0b10000000
84  bit_value |= (AFE_register.HP << 6 )& 0X40 ; // 0b01000000
85  bit_value |= (AFE_register.C_LP << 4 )& 0X30 ; // 0b00110000
86  bit_value |= (AFE_register.CLK_OUT << 3 )& 0X08 ; // 0b00001000
87  bit_value |= (AFE_register.SYNC << 2 )& 0X04 ; // 0b00000100
88  bit_value |= (AFE_register.TEMP << 1 )& 0X02 ; // 0b00000010
89  bit_value |= (AFE_register.INT << 0 )& 0X01 ; // 0b00000001
90  AFE_byte[1] = bit_value;
91 }
92 /**
93  * @brief encodes the CCP register contents of this_device into IRPyro
94  */
95 static void CCP_to_bytes(CCP_reg_type CCP_register, uint8_t *CCP_byte )
96 {
97  uint8_t bit_value = 0;
98 
99  bit_value |= (CCP_register.Feedback_transconductance << 6)& 0XC0 ; // 0b11000000
100  bit_value |= (CCP_register.High_pass_filter_setting << 4)& 0X30 ; // 0b00110000
101  bit_value |= (CCP_register.Feedback_cap << 1)& 0X0E ; // 0b00001110
102  bit_value |= (CCP_register.status_bit << 0)& 0X01 ; // 0b00000001
103  *CCP_byte = bit_value;
104 }
105 /**
106  * @brief encodes the WUP register contents of this_device into the IRPyro
107  */
108 static void WUP_to_bytes(WUP_reg_type WUP_register, uint8_t * WUP_byte)
109 {
110  uint8_t bit_value = 0;
111 
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;
117 
118  bit_value |= (WUP_register.ST << 6)& 0X40 ; // 0b01000000
119  bit_value |= (WUP_register.DP0_DP2 << 3)& 0X38 ; // 0b00111000
120  bit_value |= (WUP_register.CH0_CH2 << 0)& 0X07 ; // 0b00000111
121  WUP_byte[5] = bit_value;
122 }
123 /**
124  * @brief initialize bytes array
125 */
126 static void bytes_to_gui_init(void)
127 {
128  memset(bytes_to_gui, 0x00, BYTES_TO_GUI_SIZE);
129 }
130 /**
131  * @brief calculates the xor on bytes_to_GUI
132  * @return xor value
133 */
134 static uint8_t crc_gen(const uint8_t *current_byte, uint8_t bytes_to_process)
135 {
136  uint8_t crc_calc = 0xff; // seed crc calculation
137  do
138  {
139  uint8_t byte_to_crc;
140  byte_to_crc = *current_byte;
141  crc_calc = crc_calc ^ byte_to_crc;
142  ++ current_byte;
143  -- bytes_to_process;
144  }
145  while (bytes_to_process);
146  return crc_calc;
147 }
148 /**
149  * @brief prepares ok string for GUI
150  */
151 static void response_err(void)
152 {
153  error_flag = 0; // reset the error flag
157  response_required = 1;
158  packet_function = 3;
159 }
160 /**
161  * @brief prepares ok string for GUI
162  */
163 static void response_ok(void)
164 {
165  uint8_t crc_byte;
166  uint8_t ok_size;
167  ok_size = sizeof(ok_string);
169 
170  memmove(bytes_to_gui, ok_string, ok_size);
171  bytes_to_gui_size = ok_size;
173  memmove(bytes_to_gui + bytes_to_gui_size, &crc_byte, 1);
175  response_required = 1;
176  packet_function = 3;
177 }
178 /**
179  * @brief prepares byte array + ok + crc as a byte array for GUI
180  */
181 static void response_byte_array_ok(uint8_t *byte_array, uint8_t size_of_byte_array)
182 {
183  uint8_t crc_byte;
184  uint8_t ok_size;
185  ok_size = sizeof(ok_string);
187 
188  memcpy(bytes_to_gui, byte_array, size_of_byte_array);
189  memmove(bytes_to_gui + size_of_byte_array, ok_string, ok_size);
190  bytes_to_gui_size = size_of_byte_array + ok_size;
192  memmove(bytes_to_gui + bytes_to_gui_size, &crc_byte, 1);
194  response_required = 1;
195  packet_function = 3;
196 }
197 /**
198  * @brief responds "ok" to GUI
199  */
200 static void null_test_command(void)
201 {
202  response_ok();
203 }
204 /**
205  * @brief prepares the firmware version string
206  */
207 static void firmware_version_send(void)
208 {
209 #define FIRMWARE_STRING_SIZE 52
210  uint8_t msg[FIRMWARE_STRING_SIZE] = "_KEMET API IRPyro messaging application. "VERSION_STRING"\n";
213  response_required = 1;
214  packet_function = 3;
215 }
216 /**
217  * @brief IRPyro ASIC version byte
218  */
219 static void asic_version_read(void)
220 {
221  uint8_t asic_version_byte[] = {0x21,0x21,0x21,0x21};
223 }
224 /**
225  * @brief Get the AFE values
226  * Get byte[1] of the AFE register for:
227  * - specific sensor: indicated by wild card value
228  * - byte[1] of all the sensors present on the board
229  */
230 static void gen_AFE_read(void)
231 {
232 #define AFE_SIZE (2)
233  uint8_t afe_bytes[AFE_SIZE];
234  uint8_t sensor_selected;
235  uint8_t afe_bytes_index = 0;
236  uint8_t num_sensors_to_process;
237  uint8_t array_of_afe_bytes[NUMBER_IRPyro]= {0};
238  uint8_t num_sensors_to_process_for_byte_array;
239 
240  process_parms_load(&sensor_selected, &num_sensors_to_process);
241  num_sensors_to_process_for_byte_array = num_sensors_to_process;
242  do
243  {
244  AFE_to_bytes(IRPyro_device[sensor_selected].AFE_register,afe_bytes);
245  array_of_afe_bytes[afe_bytes_index]=afe_bytes[1];
246  ++ afe_bytes_index;
247  ++ sensor_selected;
248  -- num_sensors_to_process;
249  }
250  while (num_sensors_to_process);
251  response_byte_array_ok(array_of_afe_bytes, num_sensors_to_process_for_byte_array);
252 }
253 /**
254  * @brief AFE write successful
255  */
256 static void gen_AFE_write(void)
257 {
258  response_ok();
259 }
260 /**
261  * @brief collects CCP values according to Channel Configuration
262  */
263 static void gen_CCP_read(void)
264 {
265  uint8_t channel_count = 0;
266  uint8_t channel_ok = channel_processing(&channel_count);
267  if (channel_ok)
268  {
269  uint8_t array_of_ccp_bytes[NUMBER_OF_SCOPES_IN_THE_GUI] = {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};
273  do
274  {
275  CCP_value = IRPyro_device[channel_id_to_sensor()].CCP_register[channel_id_to_channel()];
276 
277  CCP_to_bytes(CCP_value, &array_of_ccp_bytes[byte_array_idx]);
278  channel_id_next();
279 
280  ++byte_array_idx;
281  -- channel_count;
282  }
283  while (channel_count);
284  channel_count = channel_count_for_byte_array;
285  response_byte_array_ok(array_of_ccp_bytes, channel_count);
286  }
287  else
288  {
289  response_err();
290  }
291 }
292 /**
293  * @brief CCP write successful
294  */
295 static void gen_CCP_write(void)
296 {
297  response_ok();
298 }
299 /**
300  * @brief Reads the WUP values of the selected sensor
301  */
302 static void gen_WUP_read(void)
303 {
304 #define WUP_SIZE (6)
305  uint8_t wup_bytes[WUP_SIZE];
306  uint8_t idx;
307  uint8_t num_sensors_to_process;
308  uint8_t num_sensors_to_process_for_byte_array;
309  uint8_t array_of_wup_bytes[NUMBER_IRPyro*WUP_SIZE]= {0};
310  uint8_t WUP_offset;
311 
312  process_parms_load(&idx, &num_sensors_to_process);
313  num_sensors_to_process_for_byte_array = num_sensors_to_process;
314  do
315  {
316  WUP_to_bytes(IRPyro_device[idx].WUP_register,wup_bytes);
317  if (num_sensors_to_process_for_byte_array>1)
318  WUP_offset = WUP_SIZE * idx;
319  else
320  WUP_offset = 0;
321  for(uint8_t wup_idx =0; wup_idx < WUP_SIZE; ++ wup_idx)
322  {
323  array_of_wup_bytes[wup_idx + WUP_offset]=wup_bytes[wup_idx];
324  }
325  ++ idx;
326  -- num_sensors_to_process;
327  }
328  while (num_sensors_to_process);
329  response_byte_array_ok(array_of_wup_bytes, (num_sensors_to_process_for_byte_array * WUP_SIZE));
330 }
331 /**
332  * @brief WUP write successful
333  */
334 static void gen_WUP_write(void)
335 {
336  response_ok();
337 }
338 /**
339  * @brief streaming start successful
340  */
341 static void streaming_start(void)
342 {
344  response_ok();
345 }
346 /**
347  * @brief null function to fill unimplemented gaps
348  */
349 static void fndummy(void)
350 {
351  response_required = 0;
352 }
353 /**
354  * @brief Sleep command successful
355  */
356 static void goto_sleep(void)
357 {
358  IRPyro_device_cmd.cmd = power_wakeup;
359  response_ok();
360 }
361 /**
362  * @brief Wake up command successful
363  */
364 static void wake_up(void)
365 {
366  response_ok();
367 }
368 /**
369  * @brief Sensor reset successful
370  */
371 static void reset_soft(void)
372 {
373  response_ok();
374 }
375 /**
376  * @brief board reset successful
377  */
378 static void reset_hard(void)
379 {
380  response_ok();
381 }
382 /**
383  * @brief hardware reset successful
384  */
385 static void reset_hardware(void)
386 {
387  response_ok();
388 }
389 
390 /**
391  * @brief returns the value of the sampling rate form the selected sensor
392  */
393 static void sampling_rate_read(void)
394 {
395  uint8_t afe_bytes[2];
396  AFE_to_bytes(IRPyro_device[0].AFE_register,afe_bytes);
397  response_byte_array_ok(&afe_bytes[0],1);
398 }
399 
400 /**
401  * @brief Sampling rate operation successful
402  */
403 static uint32_t sample_period_timer;
404 static void sampling_rate_write(void)
405 {
406 
407  if (IRPyro_device[0].AFE_register.LP)
408  sample_period_timer = IRPyro_device[0].AFE_register.S7_S0 * 6;
409  else
410  sample_period_timer = IRPyro_device[0].AFE_register.S7_S0;
411 
412  Micro_controller_sample_period_timer_set(sample_period_timer);
413  response_ok();
414 }
415 /**
416  * @brief returns the value of the current scopes configuration
417  */
418 static void logical_channels_read(void)
419 {
421 }
422 /**
423  * @brief operation successful
424  */
425 static void logical_channels_write(void)
426 {
427  response_ok();
428 }
429 /**
430  * @brief operation successful
431  */
432 static void set_emitter_timings(void)
433 {
434  response_ok();
435 }
436 /**
437  * @brief operation successful
438  */
439 static void set_emitter_state(void)
440 {
441  response_ok();
442 }
443 /**
444  * @brief returns the value of the internal test byte
445  */
446 static void get_failure_flags(void)
447 {
449 }
450 /**
451  * @brief returns the byte identifying the board
452  */
453 static void board_type_read(void)
454 {
456 }
457 /**
458  * @brief returns the unit id byte
459  */
460 static void unit_id_read(void)
461 {
463 }
464 /**
465  * @brief operation successful
466  */
467 static void unit_id_write(void)
468 {
469  response_ok();
470 }
471 /**
472  * @brief operation successful
473  */
474 static void second_unit_id_read(void)
475 {
477 }
478 /**
479  * @brief operation successful
480  */
481 static void get_darkpixel_state(void)
482 {
484 }
485 /**
486  * @brief operation successful
487  */
488 static void set_darkpixel_state(void)
489 {
490  response_ok();
491 }
492 /**
493  * @brief operation successful
494  */
495 static void streaming_stop(void)
496 {
497  response_ok();
498 }
499 /**
500  * @brief Prepare the "err\n" string for the GUI
501  */
502 static void report_error(void)
503 {
504  response_err();
505 }
506 /**
507  * @brief sends status start completion to GUI
508  */
509 static void status_start(void)
510 {
511  response_ok();
512 }
513 /**
514  * @brief sends status stop to GUI
515  */
516 static void status_stop(void)
517 {
518  response_ok();
519 }
520 /**
521  * @brief Places sensor collected data in a buffer according to the map
522  * @param scope GUI scope ID
523 */
524 int32_t ConfiguredSensorsSamplingDataToGUI[8] = {0}; // active channel data per device and frame counter
525 static void data_swap(uint8_t scope)
526 {
527  struct map
528  {
529  uint8_t sensor_selected;
530  uint8_t channel_selected;
531  };
532  const struct map on_board[] =
533  {
534  {0,0},
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}
539  };
540 
541  uint8_t device_selected = on_board[ChannelConfiguration[scope]].sensor_selected;
542  uint8_t channel_selected = on_board[ChannelConfiguration[scope]].channel_selected;
543  ConfiguredSensorsSamplingDataToGUI[scope] = IRPyro_device[device_selected].channel_value[channel_selected];
544 }
545 /**
546  * @brief Sorts sampling data from configured sensors
547 */
549 {
550  /*-------------------------- read_list ---------------------------------*/
551  ConfiguredSensorsSamplingDataToGUI[7] = IRPyro_device[0].channel_value[5];
552  for(uint8_t scope=0; scope < 7 ; ++ scope)
553  {
554  if (ChannelConfiguration[scope])
555  {
556  data_swap(scope);
557  }
558  }
559 }
560 static int32_t sent_sampling_data_frame_cnt = 0;
562 /**
563  * @brief evaluates conditions to send stream
564  */
566 {
567  uint8_t time_to_send_sample = 0;
568 
570  {
571  time_to_send_sample = 1;
572  }
573  return (isStreaming && time_to_send_sample && !error_flag && !JustStartedStreaming && !status_need_to_send);
574 }
575 /**
576  * @brief Enables streaming to the GUI
577  */
579 {
583  {
585  response_required = 1;
586  packet_function = 2;
587  }
588  else
589  {
591  }
592 }
593 /**
594  * @brief Send status to GUI on time
595  */
597 {
598  status_need_to_send = !Micro_controller_timeout_get();
600  {
601  Micro_controller_timeout_set(SEND_STATUS_TIME);
602  response_required = 1;
603  packet_function = 1;
604  }
605 }
606 /**
607  * @brief test the condition to send a packet.
608  */
610 {
613 }
614 /**
615  * @brief prepares packet to GUI
616 */
617 void message_generator(uint8_t cmd_to_gui, uint8_t destination)
618 {
619 #define CMD_ARRAY_SIZE (35)
620 
621  static void (* const pf[CMD_ARRAY_SIZE])(void) =
622  {
623  // CODE CHECK
624  null_test_command, // 0 - 0x00 0xFF
625  firmware_version_send, // 1 - 0x01 0xFE
626  asic_version_read, // 2 - 0x02 0xFD
627  gen_CCP_read, // 3 - 0x03 0xFC
628  gen_CCP_write, // 4 - 0x04 0xFB
629  gen_AFE_read, // 5 - 0x05 0xFA
630  gen_AFE_write, // 6 - 0x06 0xF9
631  gen_WUP_read, // 7 - 0x07 0xF8
632  gen_WUP_write, // 8 - 0x08 0xF7
633  streaming_start, // 9 - 0x09 0xF6
634  fndummy, // 10 - 0x0A 0xF5 USB_ENG_Read (DEPRECATED )
635  fndummy, // 11 - 0x0B 0xF4 USB_ENG_Write (DEPRECATED )
636  status_start, // 12 - 0x0C 0xF3
637  status_stop, // 13 - 0x0D 0xF2
638  goto_sleep, // 14 - 0x0E 0xF1
639  wake_up, // 15 - 0x0F 0xF0
640  reset_soft, // 16 - 0x10 0xEF
641  reset_hard, // 17 - 0x11 0xEE
642  reset_hardware, // 18 - 0x12 0xED
643  sampling_rate_read, // 19 - 0x13 0xEC
644  sampling_rate_write, // 20 - 0x14 0xEB
645  logical_channels_read, // 21 - 0x15 0xEA
646  logical_channels_write, // 22 - 0x16 0xE9
647  set_emitter_timings, // 23 - 0x17 0xE8
648  set_emitter_state, // 24 - 0x18 0xE7
649  get_failure_flags, // 25 - 0x19 0xE6
650  board_type_read, // 26 - 0x1A 0xE5
651  unit_id_read, // 27 - 0x1B 0xE4
652  unit_id_write, // 28 - 0x1C 0xE3
653  second_unit_id_read, // 29 - 0x1D 0xE2
654  get_darkpixel_state, // 30 - 0x1E 0xE1
655  set_darkpixel_state, // 31 - 0x1F 0xE0
656  streaming_stop, // 32 - 0x20 0xDF -- Received as code 0x77
657  report_error, // 33 - 0x21 0xDE
658  fndummy // 34 - 0x22 0xDD
659  };
660  sensor_selected = destination;
661  if (cmd_to_gui < CMD_ARRAY_SIZE)
662  {
663  (*pf[cmd_to_gui])();
664  }
666  if (response_required)
667  {
669  response_required = 0;
670  }
671 }
672 /** end of message_generator group
673  * @}
674  */
675 /** end of message_interface group
676  * @}
677  */
678 /* ********** Copyright (c) 2018 _KEMET, Ltd. **********END OF FILE************/
gen_CCP_read
static void gen_CCP_read(void)
collects CCP values according to Channel Configuration
Definition: message_generator.c:263
crc_calc
uint8_t crc_calc
Definition: message_unpack.c:151
FIRMWARE_STRING_SIZE
#define FIRMWARE_STRING_SIZE
WUP_to_bytes
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
Definition: message_generator.c:108
reset_soft
static void reset_soft(void)
Sensor reset successful.
Definition: message_generator.c:371
AFE_to_bytes
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
Definition: message_generator.c:78
bytes_to_gui_init
static void bytes_to_gui_init(void)
initialize bytes array
Definition: message_generator.c:126
message_generator
void message_generator(uint8_t cmd_to_gui, uint8_t destination)
prepares packet to GUI
Definition: message_generator.c:617
unit_id_read
static void unit_id_read(void)
returns the unit id byte
Definition: message_generator.c:460
logical_channels_read
static void logical_channels_read(void)
returns the value of the current scopes configuration
Definition: message_generator.c:418
set_emitter_timings
static void set_emitter_timings(void)
operation successful
Definition: message_generator.c:432
bytes_to_gui
uint8_t bytes_to_gui[BYTES_TO_GUI_SIZE]
Definition: message_generator.c:53
get_failure_flags
static void get_failure_flags(void)
returns the value of the internal test byte
Definition: message_generator.c:446
sample_period_timer
static uint32_t sample_period_timer
Sampling rate operation successful.
Definition: message_generator.c:403
message_prepack_data_sort
void message_prepack_data_sort(void)
Sorts sampling data from configured sensors.
Definition: message_generator.c:548
CMD_ARRAY_SIZE
#define CMD_ARRAY_SIZE
bytes_to_gui_size
uint8_t bytes_to_gui_size
Definition: message_generator.c:54
channel_processing
uint8_t channel_processing(uint8_t *channel_count)
prepares for channel_id requests
Definition: message_interface_common.c:178
CCP_to_bytes
static void CCP_to_bytes(CCP_reg_type CCP_register, uint8_t *CCP_byte)
encodes the CCP register contents of this_device into IRPyro
Definition: message_generator.c:95
sampling_rate_write
static void sampling_rate_write(void)
Definition: message_generator.c:404
get_bytes_to_GUI
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.
Definition: message_pack.c:160
error_flag
uint8_t error_flag
Definition: main.c:73
gen_AFE_read
static void gen_AFE_read(void)
Get the AFE values Get byte[1] of the AFE register for:
Definition: message_generator.c:230
AFE_SIZE
#define AFE_SIZE
ChannelConfiguration
uint8_t ChannelConfiguration[NUMBER_OF_SCOPES_IN_THE_GUI]
Definition: main.c:79
fndummy
static void fndummy(void)
null function to fill unimplemented gaps
Definition: message_generator.c:349
set_darkpixel_state
static void set_darkpixel_state(void)
operation successful
Definition: message_generator.c:488
channel_id_to_channel
uint8_t channel_id_to_channel(void)
maps the GUI scope channel_id to physical channel on the sensor
Definition: message_interface_common.c:202
gen_WUP_write
static void gen_WUP_write(void)
WUP write successful.
Definition: message_generator.c:334
BYTES_TO_GUI_SIZE
#define BYTES_TO_GUI_SIZE
Definition: message_generator.c:47
data_swap
static void data_swap(uint8_t scope)
Definition: message_generator.c:525
channel_id_to_sensor
uint8_t channel_id_to_sensor(void)
maps the GUI scope channel_id to physical sensor
Definition: message_interface_common.c:194
WUP_SIZE
#define WUP_SIZE
VERSION_STRING
#define VERSION_STRING
Definition: Version.h:47
response_ok
static void response_ok(void)
prepares ok string for GUI
Definition: message_generator.c:163
sampling_rate_read
static void sampling_rate_read(void)
returns the value of the sampling rate form the selected sensor
Definition: message_generator.c:393
response_required
uint8_t response_required
Definition: message_generator.c:50
status_start
static void status_start(void)
sends status start completion to GUI
Definition: message_generator.c:509
num_of_IRPyro_on_demo_board
uint8_t num_of_IRPyro_on_demo_board
Definition: main.c:74
report_error
static void report_error(void)
Prepare the "err\n" string for the GUI.
Definition: message_generator.c:502
status_stop
static void status_stop(void)
sends status stop to GUI
Definition: message_generator.c:516
reset_hard
static void reset_hard(void)
board reset successful
Definition: message_generator.c:378
response_err
static void response_err(void)
prepares ok string for GUI
Definition: message_generator.c:151
SEND_STATUS_TIME
#define SEND_STATUS_TIME
Definition: externals.h:31
response_byte_array_ok
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
Definition: message_generator.c:181
message_generator_select_status
static void message_generator_select_status(void)
Send status to GUI on time.
Definition: message_generator.c:596
FailureFlags
uint8_t FailureFlags
Definition: main.c:58
goto_sleep
static void goto_sleep(void)
Sleep command successful.
Definition: message_generator.c:356
UnitID
uint8_t UnitID[2]
Definition: main.c:55
on_board
const struct channel_configuration_map on_board[]
Definition: message_interface_common.c:165
gen_CCP_write
static void gen_CCP_write(void)
CCP write successful.
Definition: message_generator.c:295
status_need_to_send
uint8_t status_need_to_send
Definition: main.c:72
message_generator.h
Prepares configuration and sampling data from the sensor to be send to the GUI.
message_generator_selector
static void message_generator_selector()
test the condition to send a packet.
Definition: message_generator.c:609
error_string
const uint8_t error_string[]
Definition: message_generator.c:48
channel_id_next
void channel_id_next(void)
increments the channel index
Definition: message_interface_common.c:210
crc_gen
static uint8_t crc_gen(const uint8_t *current_byte, uint8_t bytes_to_process)
calculates the xor on bytes_to_GUI
Definition: message_generator.c:134
sensor_selected
uint8_t sensor_selected
Definition: message_generator.c:52
packet_function
uint8_t packet_function
Definition: message_generator.c:51
second_unit_id_read
static void second_unit_id_read(void)
operation successful
Definition: message_generator.c:474
streaming_start
static void streaming_start(void)
streaming start successful
Definition: message_generator.c:341
streaming_stop
static void streaming_stop(void)
operation successful
Definition: message_generator.c:495
wake_up
static void wake_up(void)
Wake up command successful.
Definition: message_generator.c:364
NUMBER_OF_SCOPES_IN_THE_GUI
#define NUMBER_OF_SCOPES_IN_THE_GUI
Definition: externals.h:30
message_generator_select_stream
static void message_generator_select_stream(void)
Enables streaming to the GUI.
Definition: message_generator.c:578
asic_version_read
static void asic_version_read(void)
IRPyro ASIC version byte.
Definition: message_generator.c:219
IRPyro_device_cmd
IRPyro_cmd_type IRPyro_device_cmd
Definition: main.c:77
isStreaming
uint8_t isStreaming
Definition: main.c:70
JustStartedStreaming
uint8_t JustStartedStreaming
Definition: message_generator.c:55
process_parms_load
void process_parms_load(uint8_t *idx, uint8_t *num_sensors_to_process)
configures for loop for single or multiple sensor operations
Definition: message_interface_common.c:139
current_sampling_data_frame_cnt
static int32_t current_sampling_data_frame_cnt
Definition: message_generator.c:561
get_darkpixel_state
static void get_darkpixel_state(void)
operation successful
Definition: message_generator.c:481
unit_id_write
static void unit_id_write(void)
operation successful
Definition: message_generator.c:467
firmware_version_send
static void firmware_version_send(void)
prepares the firmware version string
Definition: message_generator.c:207
isStatus
uint8_t isStatus
Definition: main.c:71
gen_AFE_write
static void gen_AFE_write(void)
AFE write successful.
Definition: message_generator.c:256
condition_to_send_stream
static bool condition_to_send_stream()
evaluates conditions to send stream
Definition: message_generator.c:565
set_emitter_state
static void set_emitter_state(void)
operation successful
Definition: message_generator.c:439
reset_hardware
static void reset_hardware(void)
hardware reset successful
Definition: message_generator.c:385
DarkPixelState
uint8_t DarkPixelState
Definition: main.c:57
ok_string
const uint8_t ok_string[]
Definition: message_generator.c:49
null_test_command
static void null_test_command(void)
responds "ok" to GUI
Definition: message_generator.c:200
logical_channels_write
static void logical_channels_write(void)
operation successful
Definition: message_generator.c:425
NUMBER_IRPyro
#define NUMBER_IRPyro
Definition: externals.h:32
board_type_read
static void board_type_read(void)
returns the byte identifying the board
Definition: message_generator.c:453
gen_WUP_read
static void gen_WUP_read(void)
Reads the WUP values of the selected sensor.
Definition: message_generator.c:302
sent_sampling_data_frame_cnt
static int32_t sent_sampling_data_frame_cnt
Definition: message_generator.c:560
IRPyro_device
IRPyro_devices IRPyro_device
Definition: main.c:76
BoardType
uint8_t BoardType
Definition: main.c:56
ConfiguredSensorsSamplingDataToGUI
int32_t ConfiguredSensorsSamplingDataToGUI[8]
Places sensor collected data in a buffer according to the map.
Definition: message_generator.c:524