summaryrefslogtreecommitdiff
path: root/libloragw/src/loragw_reg.c
diff options
context:
space:
mode:
authorSylvain Miermont <smiermont@semtech.com>2014-03-28 16:58:48 +0100
committerSylvain Miermont <smiermont@semtech.com>2014-03-28 16:58:48 +0100
commitf991b0e35ad1bd3b999c70e68c518bae91bd36a6 (patch)
tree7e098ae53dc1401d88efa12de3bfc24ff405d88c /libloragw/src/loragw_reg.c
parent0e2b2cfa32767e516870a4e6a2ce0b6cce827910 (diff)
downloadlora_gateway-1.3.0.tar.gz
lora_gateway-1.3.0.tar.bz2
lora_gateway-1.3.0.zip
v1.3.0v1.3.0
- Added TX power management. - Added full support for SX1301 reference board. - Changed build system with configuration for multiple chip/radio/band support. - SX125x bandwidth set to 1MHz by default (was 800 kHz). - Solved warnings with 64b integer printf when compiling on x86_64. - Renamed helper programs to reduce the concentrator vs. gateway confusion.
Diffstat (limited to 'libloragw/src/loragw_reg.c')
-rw-r--r--libloragw/src/loragw_reg.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/libloragw/src/loragw_reg.c b/libloragw/src/loragw_reg.c
index 369c216..32a8207 100644
--- a/libloragw/src/loragw_reg.c
+++ b/libloragw/src/loragw_reg.c
@@ -4,10 +4,10 @@
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
- ©2013 Semtech-Cycleo
+ (C)2013 Semtech-Cycleo
Description:
- Functions used to handle a single Lora gateway.
+ Functions used to handle a single LoRa concentrator.
Registers are addressed by name.
Multi-bytes registers are handled automatically.
Read-modify-write is handled automatically.
@@ -62,7 +62,7 @@ struct lgw_reg_s {
/*
auto generated register mapping for C code : 11-Jul-2013 13:20:40
-this file contains autogenerated C struct used to access the Lora register from the Primer firmware
+this file contains autogenerated C struct used to access the LoRa register from the Primer firmware
this file is autogenerated from registers description
293 registers are defined
*/
@@ -412,19 +412,19 @@ int page_switch(uint8_t target) {
/* -------------------------------------------------------------------------- */
/* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */
-/* Gateway connect */
+/* Concentrator connect */
int lgw_connect(void) {
int spi_stat = LGW_SPI_SUCCESS;
uint8_t u = 0;
if (lgw_spi_target != NULL) {
- DEBUG_MSG("WARNING: gateway was already connected\n");
+ DEBUG_MSG("WARNING: concentrator was already connected\n");
lgw_spi_close(lgw_spi_target);
}
/* open the SPI link */
spi_stat = lgw_spi_open(&lgw_spi_target);
if (spi_stat != LGW_SPI_SUCCESS) {
- DEBUG_MSG("ERROR CONNECTING GATEWAY\n");
+ DEBUG_MSG("ERROR CONNECTING CONCENTRATOR\n");
return LGW_REG_ERROR;
}
/* write 0 to the page/reset register */
@@ -441,7 +441,7 @@ int lgw_connect(void) {
DEBUG_MSG("ERROR READING CHIP_ID REGISTER\n");
return LGW_REG_ERROR;
} else if (u == 0) {
- DEBUG_MSG("ERROR: CHIP_ID=0, GATEWAY SEEMS DISCONNECTED\n");
+ DEBUG_MSG("ERROR: CHIP_ID=0, CONCENTRATOR SEEMS DISCONNECTED\n");
return LGW_REG_ERROR;
} else if (u != loregs[LGW_CHIP_ID].dflt) {
DEBUG_MSG("ERROR: MISMATCH BETWEEN EXPECTED REG CHIP_ID AND READ REG CHIP_ID\n");
@@ -453,27 +453,27 @@ int lgw_connect(void) {
DEBUG_MSG("ERROR READING VERSION REGISTER\n");
return LGW_REG_ERROR;
} else if (u == 0) {
- DEBUG_MSG("ERROR: VERSION=0, GATEWAY SEEMS DISCONNECTED\n");
+ DEBUG_MSG("ERROR: VERSION=0, CONCENTRATOR SEEMS DISCONNECTED\n");
return LGW_REG_ERROR;
} else if (u != loregs[LGW_VERSION].dflt) {
DEBUG_MSG("ERROR: MISMATCH BETWEEN EXPECTED REG VERSION AND READ REG VERSION\n");
return LGW_REG_ERROR;
}
- DEBUG_MSG("Note: success connecting the gateway\n");
+ DEBUG_MSG("Note: success connecting the concentrator\n");
return LGW_REG_SUCCESS;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/* Gateway disconnect */
+/* Concentrator disconnect */
int lgw_disconnect(void) {
if (lgw_spi_target != NULL) {
lgw_spi_close(lgw_spi_target);
lgw_spi_target = NULL;
- DEBUG_MSG("Note: success disconnecting the gateway\n");
+ DEBUG_MSG("Note: success disconnecting the concentrator\n");
return LGW_REG_SUCCESS;
} else {
- DEBUG_MSG("WARNING: gateway was already disconnected\n");
+ DEBUG_MSG("WARNING: concentrator was already disconnected\n");
return LGW_REG_ERROR;
}
}
@@ -484,7 +484,7 @@ int lgw_disconnect(void) {
int lgw_soft_reset(void) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}
lgw_spi_w(lgw_spi_target, 0, 0x80); /* 1 -> SOFT_RESET bit */
@@ -505,8 +505,8 @@ int lgw_reg_check(FILE *f) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
- fprintf(f, "ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
+ fprintf(f, "ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}
@@ -542,7 +542,7 @@ int lgw_reg_w(uint16_t register_id, int32_t reg_value) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}
@@ -625,7 +625,7 @@ int lgw_reg_r(uint16_t register_id, int32_t *reg_value) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}
@@ -695,7 +695,7 @@ int lgw_reg_wb(uint16_t register_id, uint8_t *data, uint16_t size) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}
@@ -744,7 +744,7 @@ int lgw_reg_rb(uint16_t register_id, uint8_t *data, uint16_t size) {
/* check if SPI is initialised */
if ((lgw_spi_target == NULL) || (lgw_regpage < 0)) {
- DEBUG_MSG("ERROR: GATEWAY UNCONNECTED\n");
+ DEBUG_MSG("ERROR: CONCENTRATOR UNCONNECTED\n");
return LGW_REG_ERROR;
}