summaryrefslogtreecommitdiff
path: root/libloragw
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2020-03-20 09:11:11 -0500
committerJason Reiss <jreiss@multitech.com>2020-03-20 09:11:11 -0500
commitb3a4461b3dfc5588111a88fd735d058888b8d3d4 (patch)
tree8202ae8c3a554552f3fa4015e63c1385add605bb /libloragw
parent6de119daaed517a0916ef889505bc6ccdaa372be (diff)
downloadlora_gateway_mtac_full-b3a4461b3dfc5588111a88fd735d058888b8d3d4.tar.gz
lora_gateway_mtac_full-b3a4461b3dfc5588111a88fd735d058888b8d3d4.tar.bz2
lora_gateway_mtac_full-b3a4461b3dfc5588111a88fd735d058888b8d3d4.zip
Add function to get cur sx1301 reg page
Diffstat (limited to 'libloragw')
-rw-r--r--libloragw/inc/loragw_hal.h2
-rw-r--r--libloragw/src/loragw_hal.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h
index 15bf918..e1e4644 100644
--- a/libloragw/inc/loragw_hal.h
+++ b/libloragw/inc/loragw_hal.h
@@ -401,6 +401,8 @@ int lgw_abort_tx(void);
*/
int lgw_get_trigcnt(uint32_t* trig_cnt_us);
+int lgw_get_cur_page(uint8_t* page);
+
/**
@brief Allow user to check the version/options of the library once compiled
@return pointer on a human-readable null terminated string
diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c
index a891fbf..d77c693 100644
--- a/libloragw/src/loragw_hal.c
+++ b/libloragw/src/loragw_hal.c
@@ -1702,6 +1702,19 @@ int lgw_get_trigcnt(uint32_t* trig_cnt_us) {
}
}
+int lgw_get_cur_page(uint8_t* page) {
+ int i;
+ int32_t val;
+
+ i = lgw_reg_r(LGW_PAGE_REG, &val);
+ if (i == LGW_REG_SUCCESS) {
+ *page = (uint32_t)val;
+ return LGW_HAL_SUCCESS;
+ } else {
+ return LGW_HAL_ERROR;
+ }
+}
+
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
const char* lgw_version_info() {