63 Micro_controller_template_init();
100 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
102 IRPyro_single_sensor.INT_Port = 1;
103 IRPyro_single_sensor.CS_Port = 2;
104 IRPyro_single_sensor.CS_Pin = 1;
105 IRPyro_single_sensor.INT_Pin = 4;
107 IRPyro_single_sensor.read_mode = 0;
108 IRPyro_single_sensor.address = 0x08;
109 IRPyro_single_sensor.number_of_active_channels = 1;
112 UART_PutString(USART2, (uint8_t*)
"01 Initialize a single device for INTERRUPT CONFIGURATION \n\n");
121 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
123 IRPyro_single_sensor.INT_Port = 1;
124 IRPyro_single_sensor.CS_Port = 2;
125 IRPyro_single_sensor.CS_Pin = 1;
126 IRPyro_single_sensor.INT_Pin = 4;
128 IRPyro_single_sensor.read_mode = 1;
129 IRPyro_single_sensor.address = 0x08;
130 IRPyro_single_sensor.number_of_active_channels = 1;
133 UART_PutString(USART2, (uint8_t*)
"02 Initialize a single device for POLLED CONFIGURATION \n");
142 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
144 IRPyro_single_sensor.INT_Port = 1;
145 IRPyro_single_sensor.CS_Port = 2;
146 IRPyro_single_sensor.CS_Pin = 1;
147 IRPyro_single_sensor.INT_Pin = 4;
149 IRPyro_single_sensor.read_mode = 2;
150 IRPyro_single_sensor.address = 0x08;
151 IRPyro_single_sensor.number_of_active_channels = 1;
154 UART_PutString(USART2, (uint8_t*)
"03 Initialize a single device for DAISY CHAIN CONFIGURATION \n");
163 IRPyro_devices IRPyro_device = {0};
165 AFE_reg_type IRPyro_AFE_configuration =
167 .CLK_OUT = CLK_DISABLE,
172 IRPyro_device[0].INT_Port = 1;
173 IRPyro_device[0].CS_Port = 2;
174 IRPyro_device[0].CS_Pin = 1;
175 IRPyro_device[0].INT_Pin = 4;
176 IRPyro_device[0].address = 0x70;
178 IRPyro_device[1].CS_Port = 2;
179 IRPyro_device[1].INT_Port = 1;
180 IRPyro_device[1].CS_Pin = 5;
181 IRPyro_device[1].INT_Pin = 5;
182 IRPyro_device[1].address = 0x69;
184 IRPyro_device[2].CS_Port = 2;
185 IRPyro_device[2].INT_Port = 1;
186 IRPyro_device[2].CS_Pin = 4;
187 IRPyro_device[2].INT_Pin = 6;
188 IRPyro_device[2].address = 0x68;
190 IRPyro_device[3].CS_Port = 2;
191 IRPyro_device[3].INT_Port = 1;
192 IRPyro_device[3].CS_Pin = 3;
193 IRPyro_device[3].INT_Pin = 7;
194 IRPyro_device[3].address = 0x67;
197 IRPyro_device[0].AFE_register = IRPyro_AFE_configuration;
198 IRPyro_device[0].read_mode = 0;
199 IRPyro_device[0].number_of_active_channels = 1;
200 IRPyro_device[1].AFE_register = IRPyro_AFE_configuration;
201 IRPyro_device[1].read_mode = 0;
202 IRPyro_device[1].number_of_active_channels = 1;
203 IRPyro_device[2].AFE_register = IRPyro_AFE_configuration;
204 IRPyro_device[2].read_mode = 0;
205 IRPyro_device[2].number_of_active_channels = 1;
206 IRPyro_device[3].AFE_register = IRPyro_AFE_configuration;
207 IRPyro_device[3].read_mode = 0;
208 IRPyro_device[3].number_of_active_channels = 1;
210 UART_PutString(USART2, (uint8_t*)
"04 Initialize multiple devices for INTERRUPT CONFIGURATION\n");
219 IRPyro_devices IRPyro_device = {0};
221 AFE_reg_type IRPyro_AFE_configuration =
223 .CLK_OUT = CLK_DISABLE,
228 IRPyro_device[0].INT_Port = 1;
229 IRPyro_device[0].CS_Port = 2;
230 IRPyro_device[0].CS_Pin = 1;
231 IRPyro_device[0].INT_Pin = 4;
232 IRPyro_device[0].address = 0x70;
234 IRPyro_device[1].CS_Port = 2;
235 IRPyro_device[1].INT_Port = 1;
236 IRPyro_device[1].CS_Pin = 5;
237 IRPyro_device[1].INT_Pin = 5;
238 IRPyro_device[1].address = 0x69;
240 IRPyro_device[2].CS_Port = 2;
241 IRPyro_device[2].INT_Port = 1;
242 IRPyro_device[2].CS_Pin = 4;
243 IRPyro_device[2].INT_Pin = 6;
244 IRPyro_device[2].address = 0x68;
246 IRPyro_device[3].CS_Port = 2;
247 IRPyro_device[3].INT_Port = 1;
248 IRPyro_device[3].CS_Pin = 3;
249 IRPyro_device[3].INT_Pin = 7;
250 IRPyro_device[3].address = 0x67;
253 IRPyro_device[0].AFE_register = IRPyro_AFE_configuration;
254 IRPyro_device[0].read_mode = 1;
255 IRPyro_device[0].number_of_active_channels = 1;
256 IRPyro_device[1].AFE_register = IRPyro_AFE_configuration;
257 IRPyro_device[1].read_mode = 1;
258 IRPyro_device[1].number_of_active_channels = 1;
259 IRPyro_device[2].AFE_register = IRPyro_AFE_configuration;
260 IRPyro_device[2].read_mode = 1;
261 IRPyro_device[2].number_of_active_channels = 1;
262 IRPyro_device[3].AFE_register = IRPyro_AFE_configuration;
263 IRPyro_device[3].read_mode = 1;
264 IRPyro_device[3].number_of_active_channels = 1;
266 UART_PutString(USART2, (uint8_t*)
"05 Initialize multiple devices for POLLED CONFIGURATION \n");
277 IRPyro_devices IRPyro_device = {0};
279 AFE_reg_type IRPyro_AFE_configuration =
281 .CLK_OUT = CLK_DISABLE,
286 IRPyro_device[0].INT_Port = 1;
287 IRPyro_device[0].CS_Port = 2;
288 IRPyro_device[0].CS_Pin = 1;
289 IRPyro_device[0].INT_Pin = 4;
290 IRPyro_device[0].address = 0x70;
292 IRPyro_device[1].CS_Port = 2;
293 IRPyro_device[1].INT_Port = 1;
294 IRPyro_device[1].CS_Pin = 5;
295 IRPyro_device[1].INT_Pin = 5;
296 IRPyro_device[1].address = 0x69;
298 IRPyro_device[2].CS_Port = 2;
299 IRPyro_device[2].INT_Port = 1;
300 IRPyro_device[2].CS_Pin = 4;
301 IRPyro_device[2].INT_Pin = 6;
302 IRPyro_device[2].address = 0x68;
304 IRPyro_device[3].CS_Port = 2;
305 IRPyro_device[3].INT_Port = 1;
306 IRPyro_device[3].CS_Pin = 3;
307 IRPyro_device[3].INT_Pin = 7;
308 IRPyro_device[3].address = 0x67;
311 IRPyro_device[0].AFE_register = IRPyro_AFE_configuration;
312 IRPyro_device[0].read_mode = 2;
313 IRPyro_device[0].number_of_active_channels = 1;
314 IRPyro_device[1].AFE_register = IRPyro_AFE_configuration;
315 IRPyro_device[1].read_mode = 2;
316 IRPyro_device[1].number_of_active_channels = 1;
317 IRPyro_device[2].AFE_register = IRPyro_AFE_configuration;
318 IRPyro_device[2].read_mode = 2;
319 IRPyro_device[2].number_of_active_channels = 1;
320 IRPyro_device[3].AFE_register = IRPyro_AFE_configuration;
321 IRPyro_device[3].read_mode = 2;
322 IRPyro_device[3].number_of_active_channels = 1;
324 UART_PutString(USART2, (uint8_t*)
"06 Initialize multiple devices for DAISY CHAIN CONFIGURATION\n");
336 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
338 IRPyro_single_sensor.INT_Port = 1;
339 IRPyro_single_sensor.CS_Port = 2;
340 IRPyro_single_sensor.CS_Pin = 1;
341 IRPyro_single_sensor.INT_Pin = 4;
343 IRPyro_single_sensor.read_mode = 1;
344 IRPyro_single_sensor.address = 0x08;
345 IRPyro_single_sensor.number_of_active_channels = 4;
348 UART_PutString(USART2, (uint8_t*)
"07 READ DATA FROM A SINGLE SENSOR and detect frames missing with the sensor CONFIGURED FOR INTERRUPT.\n");
360 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
362 IRPyro_single_sensor.INT_Port = 1;
363 IRPyro_single_sensor.CS_Port = 2;
364 IRPyro_single_sensor.CS_Pin = 1;
365 IRPyro_single_sensor.INT_Pin = 4;
367 IRPyro_single_sensor.read_mode = 1;
368 IRPyro_single_sensor.address = 0x08;
369 IRPyro_single_sensor.number_of_active_channels = 1;
372 UART_PutString(USART2, (uint8_t*)
"08 READ DATA FROM A SINGLE SENSOR and detect frames missing with the sensor CONFIGURED FOR POLLED\n");
384 IRPyro_devices IRPyro_device = {0};
386 AFE_reg_type IRPyro_AFE_configuration =
388 .CLK_OUT = CLK_ENABLE,
391 AFE_reg_type IRPyro_AFE_Slave =
398 IRPyro_device[0].INT_Port = 1;
399 IRPyro_device[0].CS_Port = 2;
400 IRPyro_device[0].CS_Pin = 1;
401 IRPyro_device[0].INT_Pin = 4;
402 IRPyro_device[0].address = 0x70;
404 IRPyro_device[1].CS_Port = 2;
405 IRPyro_device[1].INT_Port = 1;
406 IRPyro_device[1].CS_Pin = 5;
407 IRPyro_device[1].INT_Pin = 5;
408 IRPyro_device[1].address = 0x69;
410 IRPyro_device[0].AFE_register = IRPyro_AFE_configuration;
411 IRPyro_device[0].read_mode = 0;
412 IRPyro_device[0].number_of_active_channels = 1;
413 IRPyro_device[1].AFE_register = IRPyro_AFE_Slave;
414 IRPyro_device[1].read_mode = 2;
415 IRPyro_device[1].number_of_active_channels = 1;
418 UART_PutString(USART2, (uint8_t*)
"09 READ DATA FROM A SINGLE SENSOR and detect frames missing with the sensor CONFIGURED FOR DAISY CHAIN\n");
430 IRPyro_devices IRPyro_device = {0};
432 AFE_reg_type IRPyro_AFE_Master =
435 .LP = LOW_POWER_DISABLE,
437 .C_LP = LOW_PASS_180,
438 .CLK_OUT = CLK_ENABLE,
443 AFE_reg_type IRPyro_AFE_Slave =
446 .LP = LOW_POWER_DISABLE,
448 .C_LP = LOW_PASS_180,
449 .CLK_OUT = CLK_DISABLE,
456 IRPyro_device[0].INT_Port = 1;
457 IRPyro_device[0].CS_Port = 2;
458 IRPyro_device[0].CS_Pin = 1;
459 IRPyro_device[0].INT_Pin = 4;
460 IRPyro_device[0].address = 0x0A;
462 IRPyro_device[1].CS_Port = 2;
463 IRPyro_device[1].INT_Port = 1;
464 IRPyro_device[1].CS_Pin = 5;
465 IRPyro_device[1].INT_Pin = 5;
466 IRPyro_device[1].address = 0x0B;
468 IRPyro_device[2].CS_Port = 2;
469 IRPyro_device[2].INT_Port = 1;
470 IRPyro_device[2].CS_Pin = 4;
471 IRPyro_device[2].INT_Pin = 6;
472 IRPyro_device[2].address = 0x0C;
474 IRPyro_device[3].CS_Port = 2;
475 IRPyro_device[3].INT_Port = 1;
476 IRPyro_device[3].CS_Pin = 3;
477 IRPyro_device[3].INT_Pin = 7;
478 IRPyro_device[3].address = 0x0D;
481 IRPyro_device[0].AFE_register = IRPyro_AFE_Master;
482 IRPyro_device[0].read_mode = 0;
483 IRPyro_device[0].number_of_active_channels = 1;
485 IRPyro_device[1].AFE_register = IRPyro_AFE_Slave;
486 IRPyro_device[1].read_mode = 0;
487 IRPyro_device[1].number_of_active_channels = 1;
489 IRPyro_device[2].AFE_register = IRPyro_AFE_Slave;
490 IRPyro_device[2].read_mode = 0;
491 IRPyro_device[2].number_of_active_channels = 1;
493 IRPyro_device[3].AFE_register = IRPyro_AFE_Slave;
494 IRPyro_device[3].read_mode = 0;
495 IRPyro_device[3].number_of_active_channels = 1;
497 UART_PutString(USART2, (uint8_t*)
"10 READ DATA FROM MULTIPLE SENSORS and detect frames missing with the sensors CONFIGURED FOR INTERRUPT\n");
512 IRPyro_devices IRPyro_device = {0};
514 AFE_reg_type IRPyro_AFE_Master =
517 .LP = LOW_POWER_DISABLE,
519 .C_LP = LOW_PASS_180,
520 .CLK_OUT = CLK_ENABLE,
525 AFE_reg_type IRPyro_AFE_Slave =
528 .LP = LOW_POWER_DISABLE,
530 .C_LP = LOW_PASS_180,
531 .CLK_OUT = CLK_DISABLE,
538 IRPyro_device[0].INT_Port = 1;
539 IRPyro_device[0].CS_Port = 2;
540 IRPyro_device[0].CS_Pin = 1;
541 IRPyro_device[0].INT_Pin = 4;
542 IRPyro_device[0].address = 0x70;
544 IRPyro_device[1].CS_Port = 2;
545 IRPyro_device[1].INT_Port = 1;
546 IRPyro_device[1].CS_Pin = 5;
547 IRPyro_device[1].INT_Pin = 5;
548 IRPyro_device[1].address = 0x69;
550 IRPyro_device[2].CS_Port = 2;
551 IRPyro_device[2].INT_Port = 1;
552 IRPyro_device[2].CS_Pin = 4;
553 IRPyro_device[2].INT_Pin = 6;
554 IRPyro_device[2].address = 0x68;
556 IRPyro_device[3].CS_Port = 2;
557 IRPyro_device[3].INT_Port = 1;
558 IRPyro_device[3].CS_Pin = 3;
559 IRPyro_device[3].INT_Pin = 7;
560 IRPyro_device[3].address = 0x67;
563 IRPyro_device[0].AFE_register = IRPyro_AFE_Master;
564 IRPyro_device[0].read_mode = 1;
565 IRPyro_device[0].number_of_active_channels = 1;
567 IRPyro_device[1].AFE_register = IRPyro_AFE_Slave;
568 IRPyro_device[1].read_mode = 1;
569 IRPyro_device[1].number_of_active_channels = 1;
571 IRPyro_device[2].AFE_register = IRPyro_AFE_Slave;
572 IRPyro_device[2].read_mode = 1;
573 IRPyro_device[2].number_of_active_channels = 1;
575 IRPyro_device[3].AFE_register = IRPyro_AFE_Slave;
576 IRPyro_device[3].read_mode = 1;
577 IRPyro_device[3].number_of_active_channels = 1;
580 UART_PutString(USART2, (uint8_t*)
"11 READ DATA FROM MULTIPLE SENSORS and detect frames missing with the sensors CONFIGURED FOR POLLED\n");
593 IRPyro_devices IRPyro_device = {0};
595 AFE_reg_type IRPyro_AFE_Master =
598 .LP = LOW_POWER_DISABLE,
600 .C_LP = LOW_PASS_180,
601 .CLK_OUT = CLK_ENABLE,
606 AFE_reg_type IRPyro_AFE_Slave =
609 .LP = LOW_POWER_DISABLE,
611 .C_LP = LOW_PASS_180,
612 .CLK_OUT = CLK_DISABLE,
619 IRPyro_device[0].INT_Port = 1;
620 IRPyro_device[0].CS_Port = 2;
621 IRPyro_device[0].CS_Pin = 1;
622 IRPyro_device[0].INT_Pin = 4;
623 IRPyro_device[0].address = 0x70;
625 IRPyro_device[1].CS_Port = 2;
626 IRPyro_device[1].INT_Port = 1;
627 IRPyro_device[1].CS_Pin = 5;
628 IRPyro_device[1].INT_Pin = 5;
629 IRPyro_device[1].address = 0x69;
631 IRPyro_device[2].CS_Port = 2;
632 IRPyro_device[2].INT_Port = 1;
633 IRPyro_device[2].CS_Pin = 4;
634 IRPyro_device[2].INT_Pin = 6;
635 IRPyro_device[2].address = 0x68;
637 IRPyro_device[3].CS_Port = 2;
638 IRPyro_device[3].INT_Port = 1;
639 IRPyro_device[3].CS_Pin = 3;
640 IRPyro_device[3].INT_Pin = 7;
641 IRPyro_device[3].address = 0x67;
644 IRPyro_device[0].AFE_register = IRPyro_AFE_Master;
645 IRPyro_device[0].read_mode = 0;
646 IRPyro_device[0].number_of_active_channels = 1;
648 IRPyro_device[1].AFE_register = IRPyro_AFE_Slave;
649 IRPyro_device[1].read_mode = 0;
650 IRPyro_device[1].number_of_active_channels = 1;
652 IRPyro_device[2].AFE_register = IRPyro_AFE_Slave;
653 IRPyro_device[2].read_mode = 0;
654 IRPyro_device[2].number_of_active_channels = 1;
656 IRPyro_device[3].AFE_register = IRPyro_AFE_Slave;
657 IRPyro_device[3].read_mode = 0;
658 IRPyro_device[3].number_of_active_channels = 1;
661 UART_PutString(USART2, (uint8_t*)
"12 READ DATA FROM MULTIPLE SENSORS and detect frames missing with the sensors CONFIGURED FOR DAISY CHAIN\n");
673 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
675 IRPyro_single_sensor.INT_Port = 1;
676 IRPyro_single_sensor.CS_Port = 2;
677 IRPyro_single_sensor.CS_Pin = 1;
678 IRPyro_single_sensor.INT_Pin = 4;
680 IRPyro_single_sensor.read_mode = 2;
681 IRPyro_single_sensor.address = 0x08;
682 IRPyro_single_sensor.number_of_active_channels = 1;
685 UART_PutString(USART2, (uint8_t*)
"14 Change sensor POWER CONFIGURATION\n");
700 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
702 IRPyro_single_sensor.INT_Port = 1;
703 IRPyro_single_sensor.CS_Port = 2;
704 IRPyro_single_sensor.CS_Pin = 1;
705 IRPyro_single_sensor.INT_Pin = 4;
707 IRPyro_single_sensor.read_mode = 2;
708 IRPyro_single_sensor.address = 0x70;
709 IRPyro_single_sensor.number_of_active_channels = 1;
711 IRPyro_single_sensor.WUP_register.UHT = MAX_WUP_THRESHOLD;
712 IRPyro_single_sensor.WUP_register.ULT = SAFE_WUP_THRESHOLD;
713 IRPyro_single_sensor.WUP_register.LHT = MIN_WUP_THRESHOLD;
714 IRPyro_single_sensor.WUP_register.LLT = MIN_WUP_THRESHOLD;
715 IRPyro_single_sensor.WUP_register.WT_Threshold = DEFAULT_NO_EVENTS;
716 IRPyro_single_sensor.WUP_register.DP0_DP2 = SEL_CH_2;
717 IRPyro_single_sensor.WUP_register.CH0_CH2 = SEL_CH_2;
718 IRPyro_single_sensor.WUP_register.ST = SLEEP_MODE_ONE_CH;
721 UART_PutString(USART2, (uint8_t*)
"15 Configure sensor WAKE UP EVENT, SEND TO SLEEP, DETECT WAKE UP \n");
732 IRPyro_sensor_device_type IRPyro_single_sensor = {0};
734 IRPyro_single_sensor.INT_Port = 1;
735 IRPyro_single_sensor.CS_Port = 2;
736 IRPyro_single_sensor.CS_Pin = 1;
737 IRPyro_single_sensor.INT_Pin = 4;
739 IRPyro_single_sensor.read_mode = 2;
740 IRPyro_single_sensor.address = 0x08;
741 IRPyro_single_sensor.number_of_active_channels = 1;
744 UART_PutString(USART2, (uint8_t*)
"16 Change PARAMETERS on the fly\n");