Appiko
radio_trigger.h
1 /*
2  * radio_trigger.h : Module to send trigger wireless-ly using radio peripheral.
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 
19 
20 #ifndef RADIO_TRIGGER_H
21 #define RADIO_TRIGGER_H
22 
23 #include "stdint.h"
24 #include "stdbool.h"
25 #include "nrf_util.h"
26 
27 #if SYS_CFG_PRESENT == 1
28 #include "sys_config.h"
29 #endif
30 
31 #ifndef TIMER_USED_RADIO_TRIGGER
32 #define TIMER_USED_RADIO_TRIGGER 0 //
33 #endif
34 
35 #ifndef TIMER_CHANNEL_USED_RADIO_TRIGGER_0
36 #define TIMER_CHANNEL_USED_RADIO_TRIGGER_0 0
37 #endif
38 
39 #ifndef TIMER_CHANNEL_USED_RADIO_TRIGGER_1
40 #define TIMER_CHANNEL_USED_RADIO_TRIGGER_1 1
41 #endif
42 
43 #ifndef TIMER_CHANNEL_USED_RADIO_TRIGGER_2
44 #define TIMER_CHANNEL_USED_RADIO_TRIGGER_2 2
45 #endif
46 
47 
48 typedef enum
49 {
50  RADIO_TRIGGER_Tx,
51  RADIO_TRIGGER_Rx,
52 }radio_trigger_dir_t;
53 
54 
55 typedef struct
56 {
57  radio_trigger_dir_t comm_direction;
58  uint32_t comm_freq;
59  uint32_t tx_on_time_ms;
60  uint32_t tx_on_freq_us;
61  uint32_t rx_on_time_ms;
62  app_irq_priority_t irq_priority;
63  void (* radio_trigger_tx_callback) (void * data, uint32_t len);
64  void (* radio_trigger_rx_callback) (void * data, uint32_t len);
65 
66 }radio_trigger_init_t;
67 
68 void radio_trigger_init (radio_trigger_init_t * radio_trig_init);
69 
70 void radio_trigger_yell ();
71 
72 void radio_trigger_listen ();
73 
74 void radio_trigger_shut ();
75 
76 void radio_trigger_memorize_data (void * data, uint32_t len);
77 
78 bool is_radio_trigger_availabel ();
79 #endif /* RADIO_TRIGGER_H */
app_irq_priority_t
Priority levels that the application can use based on whether the SoftDevice (SD) is used.
Definition: nrf_util.h:63