Appiko
main.c
1 /*
2  * main.c : Application for SenseBe devices.
3  * Copyright (C) 2019 Appiko
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
30 #include <stdbool.h>
31 #include <stdint.h>
32 #include <stddef.h>
33 #include <string.h>
34 
35 #include "evt_sd_handler.h"
36 #include "nrf.h"
37 #include "boards.h"
38 
39 #include "log.h"
40 #include "hal_wdt.h"
41 #include "nrf_util.h"
42 #include "hal_gpio.h"
43 #include "ms_timer.h"
44 #include "hal_nop_delay.h"
45 #include "irq_msg_util.h"
46 #include "device_tick.h"
47 #include "pir_sense.h"
48 #include "hal_pin_analog_input.h"
49 #include "aa_aaa_battery_check.h"
50 #include "button_ui.h"
51 #include "nrf_nvic.h"
52 #include "ble.h"
53 #include "nrf_sdm.h"
54 #include "app_error.h"
55 #include "out_pattern_gen.h"
56 #include "sensebe_ble.h"
57 #include "sensebe_tx_rx_mod.h"
58 #include "sensebe_store_config.h"
59 #include "dev_id_fw_ver.h"
60 #include "led_seq.h"
61 #include "led_ui.h"
62 #include "cam_trigger.h"
63 /* ----- Defines ----- */
64 
67 #define APP_DEVICE_NAME_CHAR 'S','e','n','s','e','B','e'
68 const uint8_t app_device_name[] = { APP_DEVICE_NAME_CHAR };
69 
72 #define APP_UUID_COMPLETE 0x0a, 0xde, 0xfb, 0x07, 0x74, 0x83, 0x66, 0xb0, 0x0d, 0x48, 0xf5, 0x07, 0x60, 0xdc, 0x73, 0x3c
73 
76 #define APP_ADV_DATA { \
77  0x02, BLE_GAP_AD_TYPE_FLAGS, BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE, \
78  sizeof(app_device_name) + 1, BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, APP_DEVICE_NAME_CHAR, \
79  0x11, BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE, APP_UUID_COMPLETE \
80  }
81 
84 #define APP_SCAN_RSP_DATA { \
85  0x02, BLE_GAP_AD_TYPE_TX_POWER_LEVEL, 0 , \
86  0x11, BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME, \
87  'x', 'x','x', 'x', 'x', 'x' , 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', \
88  0x04, BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0 , 0 , 0 \
89  }
90 
93 #define WDT_PERIOD_MS 30100
94 
96 #define ENABLE_WDT 1
97 
99 #define SENSE_FAST_TICK_INTERVAL_MS 60
100 
101 #define SENSE_SLOW_TICK_INTERVAL_MS 30000
102 
104 #define ADV_FAST_TICK_INTERVAL_MS 60
105 
106 #define ADV_SLOW_TICK_INTERVAL_MS 1100
107 
109 #define CONN_FAST_TICK_INTERVAL_MS 60
110 
111 #define CONN_SLOW_TICK_INTERVAL_MS 1100
112 
114 #define CONN_TIMEOUT_MS (10*60*1000)
115 
117 typedef enum
118 {
122 }sense_states;
123 
124 /* ----- Global constants in flash ----- */
125 
126 /* ----- Global variables in RAM ----- */
129 
131 static uint32_t conn_count;
132 
133 static sensebe_config_t sensebe_ble_default_config = {
134  .tssp_conf.oper_time.day_or_night = 1,
135  .tssp_conf.oper_time.threshold = 0b0000000,
136  .tssp_conf.detect_window = 100,
137  .tssp_conf.cam_oper.mode = CAM_TRIGGER_SINGLE_SHOT,
138  .tssp_conf.cam_oper.larger_value = 0,
139  .tssp_conf.cam_oper.smaller_value = 0,
140  .tssp_conf.cam_oper.pre_focus = 0,
141  .tssp_conf.intr_trig_timer = 15,
142 
143  .timer_conf.oper_time.day_or_night = 1,
144  .timer_conf.oper_time.threshold = 0b0000000,
145  .timer_conf.cam_oper.mode = CAM_TRIGGER_SINGLE_SHOT,
146  .timer_conf.cam_oper.larger_value = 0,
147  .timer_conf.cam_oper.smaller_value = 0,
148  .timer_conf.cam_oper.pre_focus = 0,
149  .timer_conf.timer_interval = 50,
150 
151  .trig_conf = MOTION_ONLY,
152 
153  .ir_tx_conf.oper_time.day_or_night = 1,
154  .ir_tx_conf.oper_time.threshold = 0b0000000,
155  .ir_tx_conf.is_enable = 1,
156  .ir_tx_conf.ir_tx_speed = 1,
157  .ir_tx_conf.ir_tx_pwr = 1,
158 
159 };
160 
161 
162 sensebe_tx_rx_config_t default_sensebe_tx_rx_config =
163 {
164 
165  .rx_detect_config.rx_en_pin = TSSP_RX_EN,
166  .rx_detect_config.rx_out_pin = TSSP_RX_OUT,
167  .rx_detect_config.focus_pin_no = JACK_FOCUS_PIN,
168  .rx_detect_config.trigger_pin_no = JACK_TRIGGER_PIN,
169  .rx_detect_config.photodiode_pin = PIN_TO_ANALOG_INPUT(PHOTODIODE_LIGHT_SENSE),
170  .rx_detect_config.photodiode_en_pin = PHOTODIODE_LIGHT_SENSE_EN,
171 
172  .tx_transmit_config.tx_en_pin = IR_TX_REG_EN,
173  .tx_transmit_config.tx_in_pin = IR_TX_LED_EN,
174  .tx_transmit_config.tx_pwr1 = IR_TX_PWR1,
175  .tx_transmit_config.tx_pwr2 = IR_TX_PWR2,
176 
177  .sensebe_config = &sensebe_ble_default_config,
178 
179  .rx_tx_sel = SENSEBE_RX_TX_SEL_PIN,
180 };
181 
182 /* ----- Function declarations ----- */
183 
184 /* ----- Function definitions ----- */
186 void wdt_prior_reset_callback(void){
187  log_printf("WDT reset\n");
188 }
189 
190 void prepare_init_ble_adv()
191 {
192  uint8_t app_adv_data[] = APP_ADV_DATA;
193  uint8_t app_scan_rsp_data[] = APP_SCAN_RSP_DATA;
194 
195  //Add in the firmware version
196  memcpy(&app_scan_rsp_data[23], fw_ver_get(), sizeof(fw_ver_t));
197 
198  //Add the device ID
199  memcpy(&app_scan_rsp_data[5], dev_id_get(), sizeof(dev_id_t));
200 
201  sensebe_ble_adv_data_t app_adv_data_struct =
202  {
203  .adv_data = app_adv_data,
204  .scan_rsp_data = app_scan_rsp_data,
205  .adv_len = ARRAY_SIZE(app_adv_data),
206  .scan_rsp_len = ARRAY_SIZE(app_scan_rsp_data)
207  };
208 
209  sensebe_ble_adv_init(&app_adv_data_struct);
210 }
211 
218 static void ble_evt_handler(ble_evt_t * evt)
219 {
220  log_printf("ble evt %x\n", evt->header.evt_id);
221  switch (evt->header.evt_id)
222  {
223  case BLE_GAP_EVT_CONNECTED:
224  irq_msg_push(MSG_STATE_CHANGE, (void *) CONNECTED);
225  break;
226  case BLE_GAP_EVT_DISCONNECTED:
227  irq_msg_push(MSG_STATE_CHANGE, (void *) SENSING);
228  break;
229  case BLE_GAP_EVT_ADV_SET_TERMINATED:
230  irq_msg_push(MSG_STATE_CHANGE, (void *) SENSING);
231  break;
232  case BLE_GAP_EVT_CONN_PARAM_UPDATE:
233  log_printf("sup time %d s, max intvl %d ms, min intvl %d ms, slave lat %d\n",
234  evt->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout/100,
235  (5*evt->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval)/4,
236  (5*evt->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval)/4,
237  evt->evt.gap_evt.params.conn_param_update.conn_params.slave_latency);
238  break;
239  }
240 }
241 
246 static void get_sensebe_config_t(sensebe_config_t *config)
247 {
249 }
250 
256 void next_interval_handler(uint32_t interval)
257 {
258  log_printf("in %d\n", interval);
259  button_ui_add_tick(interval);
260  switch(current_state)
261  {
262  case SENSING:
263  {
264  log_printf("Nxt Evt Hndlr : SENSING\n");
265  sensebe_tx_rx_add_ticks (interval);
266 
267  }
268  break;
269  case ADVERTISING:
270  break;
271  case CONNECTED:
272  {
273  conn_count += interval;
274  if(conn_count > MS_TIMER_TICKS_MS(CONN_TIMEOUT_MS))
275  {
277  }
278  }
279  break;
280  }
281 }
282 
288 void state_change_handler(uint32_t new_state)
289 {
290  log_printf("State change %d\n", new_state);
291  if(new_state == current_state)
292  {
293  log_printf("new state same as current state\n");
294  return;
295  }
296  current_state = (sense_states) new_state;
297 
298  switch(current_state)
299  {
300  case SENSING:
301  {
302  sd_softdevice_disable();
303  log_printf("State Change : SENSING\n");
304  device_tick_cfg tick_cfg =
305  {
309  };
310  led_ui_type_stop_all(LED_UI_LOOP_SEQ);
311 
312  device_tick_init(&tick_cfg);
314 
315  }
316  break;
317  case ADVERTISING:
318  {
320  conn_count = 0;
321 
322  device_tick_cfg tick_cfg =
323  {
327  };
328  device_tick_init(&tick_cfg);
329 
330 
331  uint8_t is_sd_enabled;
332  sd_softdevice_is_enabled(&is_sd_enabled);
333  // Would be coming from the SENSING mode
334  if(is_sd_enabled == 0)
335  {
339  prepare_init_ble_adv();
340 
341  sensebe_sysinfo sysinfo;
342  memcpy(&sysinfo.id, dev_id_get(), sizeof(dev_id_t));
343  sysinfo.battery_status = aa_aaa_battery_status();
344  memcpy(&sysinfo.fw_ver, fw_ver_get(), sizeof(fw_ver_t));
345  sensebe_ble_update_sysinfo(&sysinfo);
346 
347  sensebe_config_t * config = sensebe_tx_rx_last_config ();
348  sensebe_ble_update_config (config);
349 
351  }
353 
354  led_ui_type_stop_all(LED_UI_LOOP_SEQ);
355  led_ui_loop_start(LED_SEQ_ORANGE_WAVE, LED_UI_MID_PRIORITY);
356  }
357  break;
358  case CONNECTED:
359  {
360  device_tick_cfg tick_cfg =
361  {
365  };
366  device_tick_init(&tick_cfg);
367  led_ui_type_stop_all (LED_UI_LOOP_SEQ);
368  led_ui_loop_start (LED_SEQ_GREEN_WAVE, LED_UI_MID_PRIORITY);
369 
370  break;
371  }
372  }
373 }
374 
382 {
383  log_printf("Act (0 = CROSS, 1= RELEASE) : %d\nStep : %d\n", act,step);
384  if(act == BUTTON_UI_ACT_CROSS)
385  {
386  switch(step)
387  {
388  case BUTTON_UI_STEP_WAKE:
389  log_printf("fast\n");
390  button_ui_config_wake(false);
391  device_tick_cfg tick_cfg =
392  {
396  };
397  device_tick_init(&tick_cfg);
398  break;
400  if(current_state == SENSING)
401  {
402  irq_msg_push(MSG_STATE_CHANGE, (void *) ADVERTISING);
403  }
404 
405  break;
407  break;
408  case BUTTON_UI_STEP_LONG:
409  {
410  NRF_POWER->GPREGRET = 0xB1;
411  log_printf("Trying to do system reset..!!");
412  uint8_t is_sd_enabled;
413  sd_softdevice_is_enabled(&is_sd_enabled);
414  if(is_sd_enabled == 0)
415  {
416  sd_nvic_SystemReset();
417  }
418  else
419  {
420  NVIC_SystemReset ();
421  }
422  }
423  break;
424  }
425  }
426  else //BUTTON_UI_ACT_RELEASE
427  {
429  log_printf("slow\n");
430  button_ui_config_wake(true);
431  switch(step)
432  {
433  case BUTTON_UI_STEP_WAKE:
434  break;
436  break;
438  break;
439  case BUTTON_UI_STEP_LONG:
440  break;
441  }
442  }
443 }
444 
449 void leds_init(void)
450 {
451  hal_gpio_cfg_output(LED_RED, LEDS_ACTIVE_STATE);
452  hal_gpio_cfg_output(LED_GREEN, !LEDS_ACTIVE_STATE);
453  hal_nop_delay_ms(600);
454  hal_gpio_pin_write(LED_RED, !LEDS_ACTIVE_STATE);
455  hal_gpio_pin_write(LED_GREEN, LEDS_ACTIVE_STATE);
456  hal_nop_delay_ms(600);
457  hal_gpio_pin_write(LED_RED, !LEDS_ACTIVE_STATE);
458  hal_gpio_pin_write(LED_GREEN, !LEDS_ACTIVE_STATE);
459 }
460 
466 void boot_pwr_config(void)
467 {
468  log_printf("Reset because of ");
469  if(NRF_POWER->RESETREAS == 0)
470  {
471  log_printf("power on or brownout, ");
472  }
473  if(NRF_POWER->RESETREAS & POWER_RESETREAS_DIF_Msk)
474  {
475  log_printf("entering into debug interface from Sys OFF, ");
476  }
477  if(NRF_POWER->RESETREAS & POWER_RESETREAS_DOG_Msk)
478  {
479  log_printf("watchdog bite, ");
480  }
481  if(NRF_POWER->RESETREAS & POWER_RESETREAS_LOCKUP_Msk)
482  {
483  log_printf("CPU lockup, ");
484  }
485  if(NRF_POWER->RESETREAS & POWER_RESETREAS_OFF_Msk)
486  {
487  log_printf("wake up from SYS OFF by GPIO, ");
488  }
489  if(NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk)
490  {
491  log_printf("pin reset, ");
492  }
493  if(NRF_POWER->RESETREAS & POWER_RESETREAS_SREQ_Msk)
494  {
495  log_printf("software reset, ");
496  }
497  log_printf("\n");
498 
499  //Clear the reset reason
500  NRF_POWER->RESETREAS = (POWER_RESETREAS_DIF_Msk |
501  POWER_RESETREAS_DOG_Msk |
502  POWER_RESETREAS_LOCKUP_Msk |
503  POWER_RESETREAS_OFF_Msk |
504  POWER_RESETREAS_RESETPIN_Msk |
505  POWER_RESETREAS_SREQ_Msk);
506 
507  //Enable the DCDC converter if the board supports it
508 #if DC_DC_CIRCUITRY == true //Defined in the board header file
509  NRF_POWER->DCDCEN = POWER_DCDCEN_DCDCEN_Enabled << POWER_DCDCEN_DCDCEN_Pos;
510 #endif
511  NRF_POWER->TASKS_LOWPWR = 1;
512 }
513 
517 void load_last_config()
518 {
520  {
521  sensebe_store_config_write (&sensebe_ble_default_config);
522  }
524 }
525 
529 void slumber(void)
530 {
531  uint8_t is_sd_enabled;
532  sd_softdevice_is_enabled(&is_sd_enabled);
533  // Would in the SENSING mode
534  if(is_sd_enabled == 0)
535  {
536  __WFI();
537  }
538  else
539  {
540  sd_app_evt_wait();
541  }
542 }
543 
547 int main(void)
548 {
549  leds_init();
550 
551  /* Mandatory welcome message */
552  log_init();
553  log_printf("\n\nHello SenseBe World!\n");
554  boot_pwr_config();
555 
557  ms_timer_init(APP_IRQ_PRIORITY_LOW);
558 #if ENABLE_WDT == 1
560  hal_wdt_start();
561 #endif
562 
563  button_ui_init(BUTTON_PIN, APP_IRQ_PRIORITY_LOW,
565 
566  {
567  irq_msg_callbacks cb =
569  irq_msg_init(&cb);
570  }
571 
572  sensebe_tx_rx_init(&default_sensebe_tx_rx_config);
573 
574  current_state = ADVERTISING; //So that a state change happens
575  irq_msg_push(MSG_STATE_CHANGE, (void *)SENSING);
576  sensebe_ble_init(ble_evt_handler, get_sensebe_config_t);
578  load_last_config ();
579 
580  while (true)
581  {
582 #if ENABLE_WDT == 1
583 // Since the application demands that CPU wakes up
584  hal_wdt_feed();
585 #endif
587  irq_msg_process();
588  slumber();
589  }
590 }
591 
void sensebe_ble_update_sysinfo(sensebe_sysinfo *sysinfo)
Updates the characteristic that stores the sysinfo.
Definition: sensebe_ble.c:187
uint8_t aa_aaa_battery_status()
Function to get battery status. It'll convert battery ADC value to 8bit.
sensebe_config_t * sensebe_tx_rx_last_config()
Function to get last config which is being used.
When a button press crosses a particular time.
Definition: button_ui.h:44
fw_ver_t * fw_ver_get(void)
Gets a pointer to the location where the Device ID is stored.
Definition: dev_id_fw_ver.c:35
void boot_pwr_config(void)
Prints the reason for the last reset, enables the internal DC-DC converter if the board supports it a...
Definition: main.c:451
For a short button press.
Definition: button_ui.h:54
void load_last_config()
function to load previous sensepi configuration present in flash memory
Definition: main.c:502
#define IR_TX_REG_EN
Definition: sensebe_rev1.h:107
void hal_wdt_start(void)
Definition: hal_wdt.c:71
void sensebe_ble_stack_init(void)
Function for initializing the BLE stack by enabling the SoftDevice and the BLE event interrupt.
Definition: sensebe_ble.c:216
BLE connection established with an app.
Definition: main.c:130
void sensebe_ble_service_init(void)
Create the Service and its characteristics for the SensePi device. There is a read-only characteristi...
Definition: sensebe_ble.c:251
Fast mode.
Definition: device_tick.h:56
void sensebe_ble_init(void(*ble_sd_evt)(ble_evt_t *evt), void(*config_update)(sensebe_config_t *cfg))
Initialize the handlers to pass the BLE SD events and the configuration received from the mobile app.
Definition: sensebe_ble.c:169
button_ui_action
Definition: button_ui.h:42
sense_states current_state
Definition: main.c:137
void sensebe_tx_rx_update_config(sensebe_config_t *update_sensebe_config)
Function to update SenseBe Rx configuration to config received over BLE.
#define CONN_TIMEOUT_MS
Definition: main.c:114
void button_ui_init(uint32_t button_pin, uint32_t irq_priority, void(*button_ui_handler)(button_ui_steps step, button_ui_action act))
Initialize the button ui event generator module.
Definition: button_ui.c:66
For a long button press.
Definition: button_ui.h:55
void led_ui_loop_start(led_sequences seq, led_ui_priority_t priority)
Start a sequence to play repeatedly.
Definition: led_ui.c:247
void sensebe_tx_rx_stop(void)
Function to disable detection for SenseBe Rx.
void sensebe_store_config_write(sensebe_config_t *latest_config)
Function to write the sensebe_config_t at address location received from get_next_location().
#define LEDS_ACTIVE_STATE
Definition: bluey_1v1.h:44
bool sensebe_store_config_is_memory_empty(void)
#define ADV_SLOW_TICK_INTERVAL_MS
Definition: main.c:106
button_ui_steps
Definition: button_ui.h:51
void sensebe_tx_rx_start(void)
Function to enable detection for SenseBe Rx.
void state_change_handler(uint32_t new_state)
The handler that is called whenever the application transitions to a new state.
Definition: main.c:287
#define SENSEBE_RX_TX_SEL_PIN
Definition: sensebe_rev3.h:122
void lfclk_init(lfclk_src_t lfclk_src)
Function to initialize the LF clock.
Definition: hal_clocks.c:23
Use PIR sensor to sense motion based on the set configuration.
Definition: main.c:128
void sensebe_ble_disconn(void)
Disconnect the current active connection, if already connected.
Definition: sensebe_ble.c:176
Stucture for passing the configuration for initializing the Device Tick module.
Definition: device_tick.h:64
For a short button press.
Definition: button_ui.h:53
#define APP_ADV_DATA
Definition: main.c:76
void button_handler(button_ui_steps step, button_ui_action act)
Handler for all button related events.
Definition: main.c:378
#define MS_TIMER_TICKS_MS(ms)
Definition: ms_timer.h:64
void sensebe_ble_update_config(sensebe_config_t *config)
Updates the characteristic that stores the SensePi config.
Definition: sensebe_ble.c:201
#define WDT_PERIOD_MS
Definition: main.c:93
void sensebe_ble_adv_start(void)
Function to start advertising.
Definition: sensebe_ble.c:414
#define APP_DEVICE_NAME_CHAR
Definition: main.c:67
void button_ui_config_wake(bool set_wake_on)
To enable/disable the button UI GPIOTE IRQ.
Definition: button_ui.c:128
void wdt_prior_reset_callback(void)
Definition: main.c:180
void device_tick_init(device_tick_cfg *cfg)
Initializes and starts the Device tick module. Provides a next interval event immediately....
Definition: device_tick.c:52
#define CONN_FAST_TICK_INTERVAL_MS
Definition: main.c:109
void ms_timer_init(uint32_t irq_priority)
Definition: ms_timer.c:111
void led_ui_type_stop_all(led_ui_seq_t type)
Stop all sequence of a particular type.
Definition: led_ui.c:275
dev_id_t * dev_id_get(void)
Gets a pointer to the location where the Device ID is stored.
Definition: dev_id_fw_ver.c:30
Same as previous mode.
Definition: device_tick.h:57
sensebe_config_t * sensebe_store_config_get_last_config()
LED_UI_MID_PRIORITY.
Definition: led_ui.h:42
Trigger only on timer.
Definition: sensebe_ble.h:51
void sensebe_ble_gap_params_init(void)
Generic Access Profile initialization. The device name, and the preferred connection parameters are s...
Definition: sensebe_ble.c:346
BLE advertising to get connected to an app.
Definition: main.c:129
#define ARRAY_SIZE(arr)
Definition: common_util.h:70
void sensebe_store_config_check_fw_ver()
Function to check the major number of firmware if latest major number \ firmware version is greater t...
For the moment a button is pressed.
Definition: button_ui.h:56
void device_tick_process(void)
The function to be called whenever the SoC wakes up to see if more than half the time of the current ...
Definition: device_tick.c:89
void irq_msg_init(irq_msg_callbacks *cb_ptr)
Definition: irq_msg_util.c:53
void hal_wdt_feed(void)
Definition: hal_wdt.c:64
#define SENSE_SLOW_TICK_INTERVAL_MS
Definition: main.c:101
void sensebe_tx_rx_add_ticks(uint32_t interval)
Function to handle add tick event.
void slumber(void)
Definition: main.c:180
void leds_init(void)
Initialize and blink the LEDs momentarily. To be used at the start of the program.
Definition: main.c:434
void irq_msg_process(void)
Definition: irq_msg_util.c:77
#define PHOTODIODE_LIGHT_SENSE_EN
Definition: sensebe_rev1.h:64
void device_tick_switch_mode(device_tick_mode mode)
Switches from the fast to slow mode or vice versa.
Definition: device_tick.c:73
int main(void)
Function for application main entry.
Definition: main.c:90
void button_ui_add_tick(uint32_t ui_ticks)
The ticks that need to be sent to the button UI module for its processing.
Definition: button_ui.c:86
sense_states
Definition: main.c:125
void sensebe_ble_adv_init(sensebe_ble_adv_data_t *sensebe_ble_adv_data)
Function to initializing the advertising.
Definition: sensebe_ble.c:369
#define IR_TX_PWR1
Definition: sensebe_rev1.h:109
#define APP_SCAN_RSP_DATA
Definition: main.c:84
void hal_wdt_init(uint32_t period_ms, void(*wdt_timeout_handler)(void))
Definition: hal_wdt.c:34
#define IR_TX_PWR2
Definition: sensebe_rev1.h:111
#define CONN_SLOW_TICK_INTERVAL_MS
Definition: main.c:111
#define IR_TX_LED_EN
Definition: sensebe_rev1.h:105
#define SENSE_FAST_TICK_INTERVAL_MS
Definition: main.c:99
void sensebe_tx_rx_init(sensebe_tx_rx_config_t *sensebe_rx_detect_config)
Function to initialize the Rx detect module.
void next_interval_handler(uint32_t interval)
The next interval handler is used for providing a periodic tick to be used by the various modules of ...
Definition: main.c:256
void irq_msg_push(irq_msg_types pushed_msg, void *more_data)
Definition: irq_msg_util.c:64
External crystal.
Definition: hal_clocks.h:38
#define PHOTODIODE_LIGHT_SENSE
Definition: sensebe_rev1.h:61
#define ADV_FAST_TICK_INTERVAL_MS
Definition: main.c:104
Slow mode.
Definition: device_tick.h:55