sforkowany z mirror/meshtastic-firmware
add initial guess at TBEAM 0.7 hardware support
rodzic
be468a2183
commit
ea250d9cd3
|
@ -33,6 +33,7 @@ for COUNTRY in $COUNTRIES; do
|
||||||
|
|
||||||
export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS"
|
export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS"
|
||||||
|
|
||||||
|
do_build "tbeam0.7"
|
||||||
do_build "ttgo-lora32-v2"
|
do_build "ttgo-lora32-v2"
|
||||||
do_build "ttgo-lora32-v1"
|
do_build "ttgo-lora32-v1"
|
||||||
do_build "tbeam"
|
do_build "tbeam"
|
||||||
|
|
|
@ -68,11 +68,20 @@ lib_deps =
|
||||||
https://github.com/meshtastic/arduino-fsm.git
|
https://github.com/meshtastic/arduino-fsm.git
|
||||||
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
|
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
|
||||||
|
|
||||||
|
; The 1.0 release of the TBEAM board
|
||||||
[env:tbeam]
|
[env:tbeam]
|
||||||
board = ttgo-t-beam
|
board = ttgo-t-beam
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
AXP202X_Library
|
AXP202X_Library
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags} -D TBEAM_V10
|
||||||
|
|
||||||
|
; The original TBEAM board without the AXP power chip and a few other changes
|
||||||
|
[env:tbeam0.7]
|
||||||
|
board = ttgo-t-beam
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags} -D TBEAM_V07
|
||||||
|
|
||||||
[env:heltec]
|
[env:heltec]
|
||||||
;build_type = debug ; to make it possible to step through our jtag debugger
|
;build_type = debug ; to make it possible to step through our jtag debugger
|
||||||
|
|
|
@ -96,7 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MOSI_GPIO 27
|
#define MOSI_GPIO 27
|
||||||
#define NSS_GPIO 18
|
#define NSS_GPIO 18
|
||||||
|
|
||||||
#if defined(ARDUINO_T_Beam)
|
#if defined(TBEAM_V10)
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
#define HW_VENDOR "tbeam"
|
#define HW_VENDOR "tbeam"
|
||||||
|
|
||||||
|
@ -117,6 +117,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// Leave undefined to disable our PMU IRQ handler
|
// Leave undefined to disable our PMU IRQ handler
|
||||||
#define PMU_IRQ 35
|
#define PMU_IRQ 35
|
||||||
|
|
||||||
|
#elif defined(TBEAM_V07)
|
||||||
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
|
#define HW_VENDOR "tbeam0.7"
|
||||||
|
|
||||||
|
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
|
||||||
|
|
||||||
|
#define I2C_SDA 21
|
||||||
|
#define I2C_SCL 22
|
||||||
|
|
||||||
|
#define BUTTON_PIN 39
|
||||||
|
|
||||||
|
#ifndef USE_JTAG
|
||||||
|
#define RESET_GPIO 23
|
||||||
|
#endif
|
||||||
|
#define DIO0_GPIO 26
|
||||||
|
#define DIO1_GPIO 33 // Note: not really used on this board
|
||||||
|
#define DIO2_GPIO 32 // Note: not really used on this board
|
||||||
|
|
||||||
|
// This board has different GPS pins than all other boards
|
||||||
|
#undef GPS_RX_PIN
|
||||||
|
#undef GPS_TX_PIN
|
||||||
|
#define GPS_RX_PIN 12
|
||||||
|
#define GPS_TX_PIN 15
|
||||||
|
|
||||||
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
#define HW_VENDOR "heltec"
|
#define HW_VENDOR "heltec"
|
||||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -39,7 +39,7 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
AXP20X_Class axp;
|
AXP20X_Class axp;
|
||||||
bool pmu_irq = false;
|
bool pmu_irq = false;
|
||||||
|
@ -81,7 +81,7 @@ void scanI2Cdevice(void)
|
||||||
ssd1306_found = true;
|
ssd1306_found = true;
|
||||||
DEBUG_MSG("ssd1306 display found\n");
|
DEBUG_MSG("ssd1306 display found\n");
|
||||||
}
|
}
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||||
axp192_found = true;
|
axp192_found = true;
|
||||||
DEBUG_MSG("axp192 PMU found\n");
|
DEBUG_MSG("axp192 PMU found\n");
|
||||||
|
@ -97,7 +97,7 @@ void scanI2Cdevice(void)
|
||||||
DEBUG_MSG("done\n");
|
DEBUG_MSG("done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
/// Reads power status to powerStatus singleton.
|
/// Reads power status to powerStatus singleton.
|
||||||
//
|
//
|
||||||
// TODO(girts): move this and other axp stuff to power.h/power.cpp.
|
// TODO(girts): move this and other axp stuff to power.h/power.cpp.
|
||||||
|
@ -110,7 +110,7 @@ void readPowerStatus()
|
||||||
powerStatus.usb = axp.isVBUSPlug();
|
powerStatus.usb = axp.isVBUSPlug();
|
||||||
powerStatus.charging = axp.isChargeing();
|
powerStatus.charging = axp.isChargeing();
|
||||||
}
|
}
|
||||||
#endif // ARDUINO_T_Beam
|
#endif // TBEAM_V10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init the power manager chip
|
* Init the power manager chip
|
||||||
|
@ -123,7 +123,7 @@ void readPowerStatus()
|
||||||
*/
|
*/
|
||||||
void axp192Init()
|
void axp192Init()
|
||||||
{
|
{
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
||||||
DEBUG_MSG("AXP192 Begin PASS\n");
|
DEBUG_MSG("AXP192 Begin PASS\n");
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
extern AXP20X_Class axp;
|
extern AXP20X_Class axp;
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,7 +48,7 @@ void setLed(bool ledOn)
|
||||||
digitalWrite(LED_PIN, ledOn);
|
digitalWrite(LED_PIN, ledOn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// blink the axp led
|
// blink the axp led
|
||||||
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
||||||
|
@ -60,7 +60,7 @@ void setGPSPower(bool on)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found)
|
if (axp192_found)
|
||||||
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,7 +124,7 @@ void doDeepSleep(uint64_t msecToWake)
|
||||||
|
|
||||||
setLed(false);
|
setLed(false);
|
||||||
|
|
||||||
#ifdef ARDUINO_T_Beam
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
||||||
// leave floating input for the IRQ line
|
// leave floating input for the IRQ line
|
||||||
|
@ -159,8 +159,9 @@ void doDeepSleep(uint64_t msecToWake)
|
||||||
/* 14, */ /* 15, */
|
/* 14, */ /* 15, */
|
||||||
#endif
|
#endif
|
||||||
/* 25, */ 26, /* 27, */
|
/* 25, */ 26, /* 27, */
|
||||||
32, 33, 34, 35, 36, 37,
|
32, 33, 34, 35,
|
||||||
/* 38, */ 39};
|
36, 37
|
||||||
|
/* 38, 39 */};
|
||||||
|
|
||||||
for (int i = 0; i < sizeof(rtcGpios); i++)
|
for (int i = 0; i < sizeof(rtcGpios); i++)
|
||||||
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
||||||
|
|
Ładowanie…
Reference in New Issue