summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-gateway-usb/lora-gateway-sync-word.patch
blob: e51e02aa00a554b60504703295aacea527ed1908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h
index 1516b65..24c5969 100644
--- a/libloragw/inc/loragw_hal.h
+++ b/libloragw/inc/loragw_hal.h
@@ -302,6 +312,11 @@ struct lgw_pkt_tx_s {
 
 /* -------------------------------------------------------------------------- */
 /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
+/**
+ * @brief Configure the lora synch word
+ * @param word for synch
+ */
+void lgw_conf_lora_synch_word(uint8_t word);
 
 /**
 @brief Configure an RF chain (must configure before start)
diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c
index 5dbdf45..d0fe288 100644
--- a/libloragw/src/loragw_hal.c
+++ b/libloragw/src/loragw_hal.c
@@ -827,6 +851,19 @@ void lgw_constant_adjust(void) {
 /* -------------------------------------------------------------------------- */
 /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */
 
+void lgw_conf_lora_synch_word(uint8_t word) {
+    uint8_t peak1 = word >> 4;
+    uint8_t peak2 = word & 0x0F;
+
+  	lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS, peak1);   /* default 1 */
+    lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */
+    lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */
+    lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */
+    lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */
+    lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */
+}
+
+
 int lgw_rxrf_setconf(uint8_t rf_chain, struct lgw_conf_rxrf_s conf) {
 	
 	/* check if the concentrator is running */