Add support for LoRa32 v2.0

This commit is contained in:
Mark Qvist 2022-01-24 20:33:58 +01:00
parent c9511f7294
commit 7416c9c663
3 changed files with 44 additions and 11 deletions

View File

@ -103,11 +103,11 @@
const int pin_reset = 12;
const int pin_dio = 26;
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 15;
const int pin_led_tx = 4;
const int pin_led_rx = 2;
const int pin_led_tx = 0;
#else
const int pin_led_rx = 23;
const int pin_led_tx = 23;
const int pin_led_rx = 22;
const int pin_led_tx = 22;
#endif
#elif BOARD_MODEL == BOARD_LORA32_V2_1
const int pin_cs = 18;

View File

@ -48,7 +48,7 @@ upload-tbeam:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:t-beam
upload-lora32_v20:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
upload-lora32_v21:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32

View File

@ -42,10 +42,17 @@ uint8_t boot_vector = 0x00;
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
#elif BOARD_MODEL == BOARD_LORA32_V2_0
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#if defined(EXTERNAL_LEDS)
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#else
void led_rx_on() { digitalWrite(pin_led_rx, LOW); }
void led_rx_off() { digitalWrite(pin_led_rx, HIGH); }
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
#endif
#elif BOARD_MODEL == BOARD_LORA32_V2_1
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
@ -143,6 +150,19 @@ void led_indicate_warning(int cycles) {
}
led_rx_off();
}
#elif BOARD_MODEL == BOARD_LORA32_V2_0
void led_indicate_info(int cycles) {
bool forever = (cycles == 0) ? true : false;
cycles = forever ? 1 : cycles;
while(cycles > 0) {
led_rx_off();
delay(100);
led_rx_on();
delay(100);
if (!forever) cycles--;
}
led_rx_off();
}
#else
void led_indicate_info(int cycles) {
bool forever = (cycles == 0) ? true : false;
@ -214,10 +234,13 @@ int8_t led_standby_direction = 0;
#if defined(EXTERNAL_LEDS)
led_rx_off();
#endif
#elif BOARD_MODEL == BOARD_LORA32_V2_0
#if defined(EXTERNAL_LEDS)
led_rx_off();
#endif
#else
led_rx_off();
#endif
}
}
#endif
@ -253,7 +276,17 @@ int8_t led_standby_direction = 0;
} else {
led_tx_off();
}
led_rx_off();
#if BOARD_MODEL == BOARD_LORA32_V2_1
#if defined(EXTERNAL_LEDS)
led_rx_off();
#endif
#elif BOARD_MODEL == BOARD_LORA32_V2_0
#if defined(EXTERNAL_LEDS)
led_rx_off();
#endif
#else
led_rx_off();
#endif
}
}
#endif