mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-07-23 13:03:13 +00:00
GPS support was implemented incorrectly for the ThinkNode M3. The reset pin was being driven when it should be left floating for this unit. The enable pin also wasn't being picked up by `MicroNMEALocationProvider` because of a mismatch in constant naming conventions. I did a general cleanup of the GPS and ThinkNode M3 bring-up code so that constant names line up and "*_ACTIVE" constants are used consistently vs hardcoding `HIGH`/`LOW`. After making these changes, serial data immediately starts streaming in from the NMEA on boot and GPS detection just works. LED handling was also not quite right for the ThinkNode M3. The LoRa TX LED was being driven high to turn it on when it should actually be driven low. I changed the code to use the `LED_STATE_ON` constant and also added a little code to the shutdown path to properly make sure that all LEDs are turned off. Tested and confirmed working on real hardware. Resolves both #1864 and #2879.
98 lines
1.7 KiB
C++
98 lines
1.7 KiB
C++
/*
|
|
* variant.cpp
|
|
* Copyright (C) 2023 Seeed K.K.
|
|
* MIT License
|
|
*/
|
|
|
|
#include "variant.h"
|
|
#include "wiring_constants.h"
|
|
#include "wiring_digital.h"
|
|
|
|
const uint32_t g_ADigitalPinMap[] =
|
|
{
|
|
0, // P0.00
|
|
1, // P0.01
|
|
2, // P0.02
|
|
3, // P0.03
|
|
4, // P0.04
|
|
5, // P0.05
|
|
6, // P0.06
|
|
7, // P0.07
|
|
8, // P0.08
|
|
9, // P0.09
|
|
10, // P0.10
|
|
11, // P0.11
|
|
12, // P0.12
|
|
13, // P0.13
|
|
14, // P0.14
|
|
15, // P0.15
|
|
16, // P0.16
|
|
17, // P0.17
|
|
18, // P0.18
|
|
19, // P0.19
|
|
20, // P0.20
|
|
21, // P0.21
|
|
22, // P0.22
|
|
23, // P0.23
|
|
24, // P0.24
|
|
25, // P0.25
|
|
26, // P0.26
|
|
27, // P0.27
|
|
28, // P0.28
|
|
29, // P0.29
|
|
30, // P0.30
|
|
31, // P0.31
|
|
32, // P1.00
|
|
33, // P1.01
|
|
34, // P1.02
|
|
35, // P1.03
|
|
36, // P1.04
|
|
37, // P1.05
|
|
38, // P1.06
|
|
39, // P1.07
|
|
40, // P1.08
|
|
41, // P1.09
|
|
42, // P1.10
|
|
43, // P1.11
|
|
44, // P1.12
|
|
45, // P1.13
|
|
46, // P1.14
|
|
47, // P1.15
|
|
};
|
|
|
|
void initVariant()
|
|
{
|
|
/* TODO */
|
|
pinMode(PIN_PWR_EN, OUTPUT);
|
|
digitalWrite(PIN_PWR_EN, HIGH);
|
|
|
|
pinMode(BAT_POWER, OUTPUT);
|
|
digitalWrite(BAT_POWER, HIGH);
|
|
pinMode(EEPROM_POWER, OUTPUT);
|
|
digitalWrite(EEPROM_POWER, HIGH);
|
|
|
|
pinMode(36, OUTPUT);
|
|
digitalWrite(36, HIGH);
|
|
pinMode(34, OUTPUT);
|
|
digitalWrite(34, HIGH);
|
|
|
|
pinMode(LED_POWER, OUTPUT);
|
|
digitalWrite(LED_POWER, HIGH);
|
|
|
|
pinMode(PIN_LED_BLUE, OUTPUT);
|
|
digitalWrite(PIN_LED_BLUE, !LED_STATE_ON);
|
|
pinMode(PIN_LED_GREEN, OUTPUT);
|
|
digitalWrite(PIN_LED_GREEN, !LED_STATE_ON);
|
|
pinMode(PIN_LED_RED, OUTPUT);
|
|
digitalWrite(PIN_LED_RED, !LED_STATE_ON);
|
|
|
|
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
|
|
|
pinMode(PIN_GPS_POWER, OUTPUT);
|
|
pinMode(PIN_GPS_EN, OUTPUT);
|
|
|
|
// Power on gps but in standby
|
|
digitalWrite(PIN_GPS_EN, !GPS_EN_ACTIVE);
|
|
digitalWrite(PIN_GPS_POWER, GPS_POWER_ACTIVE);
|
|
}
|