123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- diff -Naur Lora/sx1302_hal/libloragw/inc/loragw_i2c.h Lora/sx1302_hal/libloragw/inc/loragw_i2c.h
- --- sx1302_hal/libloragw/inc/loragw_i2c.h 2024-07-22 12:16:23.221274900 +0800
- +++ sx1302_hal/libloragw/inc/loragw_i2c.h 2023-08-03 19:18:09.000000000 +0800
- @@ -29,7 +29,7 @@
- #define LGW_I2C_SUCCESS 0
- #define LGW_I2C_ERROR -1
- -#define I2C_DEVICE "/dev/i2c-1"
- +#define I2C_DEVICE "/dev/i2c-4"
- /* -------------------------------------------------------------------------- */
- /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
- diff -Naur Lora/sx1302_hal/libloragw/src/loragw_stts751.c Lora/sx1302_hal/libloragw/src/loragw_stts751.c
- --- sx1302_hal/libloragw/src/loragw_stts751.c 2024-07-22 12:16:23.248274400 +0800
- +++ sx1302_hal/libloragw/src/loragw_stts751.c 2023-08-03 19:18:09.000000000 +0800
- @@ -81,6 +81,8 @@
- int err;
- uint8_t val;
- +#if 0
- +
- /* Check Input Params */
- if (i2c_fd <= 0) {
- printf("ERROR: invalid I2C file descriptor\n");
- @@ -141,6 +143,7 @@
- DEBUG_PRINTF("ERROR: failed to write I2C device 0x%02X (err=%i)\n", i2c_addr, err);
- return LGW_I2C_ERROR;
- }
- +#endif
- return LGW_I2C_SUCCESS;
- }
- @@ -148,6 +151,8 @@
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- int stts751_get_temperature(int i2c_fd, uint8_t i2c_addr, float * temperature) {
- +
- +#if 0
- int err;
- uint8_t high_byte, low_byte;
- int8_t h;
- @@ -176,6 +181,9 @@
- *temperature = ((h << 8) | low_byte) / 256.0;
- DEBUG_PRINTF("Temperature: %f C (h:0x%02X l:0x%02X)\n", *temperature, high_byte, low_byte);
- +#endif
- +
- + *temperature = 25.0;
- return LGW_I2C_SUCCESS;
- }
- diff -Naur Lora/sx1302_hal/tools/reset_lgw.sh Lora/sx1302_hal/tools/reset_lgw.sh
- --- sx1302_hal/tools/reset_lgw.sh 2024-07-25 15:57:22.548646500 +0800
- +++ sx1302_hal/tools/reset_lgw.sh 2023-08-03 19:18:10.000000000 +0800
- @@ -12,10 +12,10 @@
- # GPIO mapping has to be adapted with HW
- #
- -SX1302_RESET_PIN=23 # SX1302 reset
- -SX1302_POWER_EN_PIN=18 # SX1302 power enable
- -SX1261_RESET_PIN=22 # SX1261 reset (LBT / Spectral Scan)
- -AD5338R_RESET_PIN=13 # AD5338R reset (full-duplex CN490 reference design)
- +SX1302_RESET_PIN=53 # SX1302 reset
- +#SX1302_POWER_EN_PIN=18 # SX1302 power enable
- +#SX1261_RESET_PIN=22 # SX1261 reset (LBT / Spectral Scan)
- +#AD5338R_RESET_PIN=13 # AD5338R reset (full-duplex CN490 reference design)
- WAIT_GPIO() {
- sleep 0.1
- @@ -24,34 +24,34 @@
- init() {
- # setup GPIOs
- echo "$SX1302_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
- - echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
- - echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/export; WAIT_GPIO
- - echo "$AD5338R_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
- + #echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
- + #echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/export; WAIT_GPIO
- + #echo "$AD5338R_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
- # set GPIOs as output
- echo "out" > /sys/class/gpio/gpio$SX1302_RESET_PIN/direction; WAIT_GPIO
- - echo "out" > /sys/class/gpio/gpio$SX1261_RESET_PIN/direction; WAIT_GPIO
- - echo "out" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/direction; WAIT_GPIO
- - echo "out" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/direction; WAIT_GPIO
- + #echo "out" > /sys/class/gpio/gpio$SX1261_RESET_PIN/direction; WAIT_GPIO
- + #echo "out" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/direction; WAIT_GPIO
- + #echo "out" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/direction; WAIT_GPIO
- }
- reset() {
- echo "CoreCell reset through GPIO$SX1302_RESET_PIN..."
- - echo "SX1261 reset through GPIO$SX1302_RESET_PIN..."
- - echo "CoreCell power enable through GPIO$SX1302_POWER_EN_PIN..."
- - echo "CoreCell ADC reset through GPIO$AD5338R_RESET_PIN..."
- + #echo "SX1261 reset through GPIO$SX1302_RESET_PIN..."
- + #echo "CoreCell power enable through GPIO$SX1302_POWER_EN_PIN..."
- + #echo "CoreCell ADC reset through GPIO$AD5338R_RESET_PIN..."
- # write output for SX1302 CoreCell power_enable and reset
- - echo "1" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/value; WAIT_GPIO
- + #echo "1" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/value; WAIT_GPIO
- echo "1" > /sys/class/gpio/gpio$SX1302_RESET_PIN/value; WAIT_GPIO
- echo "0" > /sys/class/gpio/gpio$SX1302_RESET_PIN/value; WAIT_GPIO
- - echo "0" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
- - echo "1" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
- + #echo "0" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
- + #echo "1" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
- - echo "0" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
- - echo "1" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
- + #echo "0" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
- + #echo "1" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
- }
- term() {
- @@ -60,18 +60,18 @@
- then
- echo "$SX1302_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- fi
- - if [ -d /sys/class/gpio/gpio$SX1261_RESET_PIN ]
- - then
- - echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- - fi
- - if [ -d /sys/class/gpio/gpio$SX1302_POWER_EN_PIN ]
- - then
- - echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- - fi
- - if [ -d /sys/class/gpio/gpio$AD5338R_RESET_PIN ]
- - then
- - echo "$AD5338R_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- - fi
- + #if [ -d /sys/class/gpio/gpio$SX1261_RESET_PIN ]
- + #then
- + # echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- + #fi
- + #if [ -d /sys/class/gpio/gpio$SX1302_POWER_EN_PIN ]
- + #then
- + # echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- + #fi
- + #if [ -d /sys/class/gpio/gpio$AD5338R_RESET_PIN ]
- + #then
- + # echo "$AD5338R_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
- + #fi
- }
- case "$1" in
- @@ -90,4 +90,4 @@
- ;;
- esac
- -exit 0
- \ No newline at end of file
- +exit 0
|