code.patch 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. diff -Naur Lora/sx1302_hal/libloragw/inc/loragw_i2c.h Lora/sx1302_hal/libloragw/inc/loragw_i2c.h
  2. --- sx1302_hal/libloragw/inc/loragw_i2c.h 2024-07-22 12:16:23.221274900 +0800
  3. +++ sx1302_hal/libloragw/inc/loragw_i2c.h 2023-08-03 19:18:09.000000000 +0800
  4. @@ -29,7 +29,7 @@
  5. #define LGW_I2C_SUCCESS 0
  6. #define LGW_I2C_ERROR -1
  7. -#define I2C_DEVICE "/dev/i2c-1"
  8. +#define I2C_DEVICE "/dev/i2c-4"
  9. /* -------------------------------------------------------------------------- */
  10. /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
  11. diff -Naur Lora/sx1302_hal/libloragw/src/loragw_stts751.c Lora/sx1302_hal/libloragw/src/loragw_stts751.c
  12. --- sx1302_hal/libloragw/src/loragw_stts751.c 2024-07-22 12:16:23.248274400 +0800
  13. +++ sx1302_hal/libloragw/src/loragw_stts751.c 2023-08-03 19:18:09.000000000 +0800
  14. @@ -81,6 +81,8 @@
  15. int err;
  16. uint8_t val;
  17. +#if 0
  18. +
  19. /* Check Input Params */
  20. if (i2c_fd <= 0) {
  21. printf("ERROR: invalid I2C file descriptor\n");
  22. @@ -141,6 +143,7 @@
  23. DEBUG_PRINTF("ERROR: failed to write I2C device 0x%02X (err=%i)\n", i2c_addr, err);
  24. return LGW_I2C_ERROR;
  25. }
  26. +#endif
  27. return LGW_I2C_SUCCESS;
  28. }
  29. @@ -148,6 +151,8 @@
  30. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  31. int stts751_get_temperature(int i2c_fd, uint8_t i2c_addr, float * temperature) {
  32. +
  33. +#if 0
  34. int err;
  35. uint8_t high_byte, low_byte;
  36. int8_t h;
  37. @@ -176,6 +181,9 @@
  38. *temperature = ((h << 8) | low_byte) / 256.0;
  39. DEBUG_PRINTF("Temperature: %f C (h:0x%02X l:0x%02X)\n", *temperature, high_byte, low_byte);
  40. +#endif
  41. +
  42. + *temperature = 25.0;
  43. return LGW_I2C_SUCCESS;
  44. }
  45. diff -Naur Lora/sx1302_hal/tools/reset_lgw.sh Lora/sx1302_hal/tools/reset_lgw.sh
  46. --- sx1302_hal/tools/reset_lgw.sh 2024-07-25 15:57:22.548646500 +0800
  47. +++ sx1302_hal/tools/reset_lgw.sh 2023-08-03 19:18:10.000000000 +0800
  48. @@ -12,10 +12,10 @@
  49. # GPIO mapping has to be adapted with HW
  50. #
  51. -SX1302_RESET_PIN=23 # SX1302 reset
  52. -SX1302_POWER_EN_PIN=18 # SX1302 power enable
  53. -SX1261_RESET_PIN=22 # SX1261 reset (LBT / Spectral Scan)
  54. -AD5338R_RESET_PIN=13 # AD5338R reset (full-duplex CN490 reference design)
  55. +SX1302_RESET_PIN=53 # SX1302 reset
  56. +#SX1302_POWER_EN_PIN=18 # SX1302 power enable
  57. +#SX1261_RESET_PIN=22 # SX1261 reset (LBT / Spectral Scan)
  58. +#AD5338R_RESET_PIN=13 # AD5338R reset (full-duplex CN490 reference design)
  59. WAIT_GPIO() {
  60. sleep 0.1
  61. @@ -24,34 +24,34 @@
  62. init() {
  63. # setup GPIOs
  64. echo "$SX1302_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
  65. - echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
  66. - echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/export; WAIT_GPIO
  67. - echo "$AD5338R_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
  68. + #echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
  69. + #echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/export; WAIT_GPIO
  70. + #echo "$AD5338R_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
  71. # set GPIOs as output
  72. echo "out" > /sys/class/gpio/gpio$SX1302_RESET_PIN/direction; WAIT_GPIO
  73. - echo "out" > /sys/class/gpio/gpio$SX1261_RESET_PIN/direction; WAIT_GPIO
  74. - echo "out" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/direction; WAIT_GPIO
  75. - echo "out" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/direction; WAIT_GPIO
  76. + #echo "out" > /sys/class/gpio/gpio$SX1261_RESET_PIN/direction; WAIT_GPIO
  77. + #echo "out" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/direction; WAIT_GPIO
  78. + #echo "out" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/direction; WAIT_GPIO
  79. }
  80. reset() {
  81. echo "CoreCell reset through GPIO$SX1302_RESET_PIN..."
  82. - echo "SX1261 reset through GPIO$SX1302_RESET_PIN..."
  83. - echo "CoreCell power enable through GPIO$SX1302_POWER_EN_PIN..."
  84. - echo "CoreCell ADC reset through GPIO$AD5338R_RESET_PIN..."
  85. + #echo "SX1261 reset through GPIO$SX1302_RESET_PIN..."
  86. + #echo "CoreCell power enable through GPIO$SX1302_POWER_EN_PIN..."
  87. + #echo "CoreCell ADC reset through GPIO$AD5338R_RESET_PIN..."
  88. # write output for SX1302 CoreCell power_enable and reset
  89. - echo "1" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/value; WAIT_GPIO
  90. + #echo "1" > /sys/class/gpio/gpio$SX1302_POWER_EN_PIN/value; WAIT_GPIO
  91. echo "1" > /sys/class/gpio/gpio$SX1302_RESET_PIN/value; WAIT_GPIO
  92. echo "0" > /sys/class/gpio/gpio$SX1302_RESET_PIN/value; WAIT_GPIO
  93. - echo "0" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
  94. - echo "1" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
  95. + #echo "0" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
  96. + #echo "1" > /sys/class/gpio/gpio$SX1261_RESET_PIN/value; WAIT_GPIO
  97. - echo "0" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
  98. - echo "1" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
  99. + #echo "0" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
  100. + #echo "1" > /sys/class/gpio/gpio$AD5338R_RESET_PIN/value; WAIT_GPIO
  101. }
  102. term() {
  103. @@ -60,18 +60,18 @@
  104. then
  105. echo "$SX1302_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  106. fi
  107. - if [ -d /sys/class/gpio/gpio$SX1261_RESET_PIN ]
  108. - then
  109. - echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  110. - fi
  111. - if [ -d /sys/class/gpio/gpio$SX1302_POWER_EN_PIN ]
  112. - then
  113. - echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  114. - fi
  115. - if [ -d /sys/class/gpio/gpio$AD5338R_RESET_PIN ]
  116. - then
  117. - echo "$AD5338R_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  118. - fi
  119. + #if [ -d /sys/class/gpio/gpio$SX1261_RESET_PIN ]
  120. + #then
  121. + # echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  122. + #fi
  123. + #if [ -d /sys/class/gpio/gpio$SX1302_POWER_EN_PIN ]
  124. + #then
  125. + # echo "$SX1302_POWER_EN_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  126. + #fi
  127. + #if [ -d /sys/class/gpio/gpio$AD5338R_RESET_PIN ]
  128. + #then
  129. + # echo "$AD5338R_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
  130. + #fi
  131. }
  132. case "$1" in
  133. @@ -90,4 +90,4 @@
  134. ;;
  135. esac
  136. -exit 0
  137. \ No newline at end of file
  138. +exit 0