fixed: added back pin inits when SDA and SCL are set.
This commit is contained in:
@@ -24,6 +24,10 @@ void RAK4631Board::begin() {
|
|||||||
pinMode(PIN_VBAT_READ, INPUT);
|
pinMode(PIN_VBAT_READ, INPUT);
|
||||||
pinMode(PIN_USER_BTN, INPUT_PULLUP);
|
pinMode(PIN_USER_BTN, INPUT_PULLUP);
|
||||||
|
|
||||||
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
#include <bluefruit.h>
|
#include <bluefruit.h>
|
||||||
|
|
||||||
void T1000eBoard::begin()
|
void T1000eBoard::begin() {
|
||||||
{
|
|
||||||
// for future use, sub-classes SHOULD call this from their begin()
|
// for future use, sub-classes SHOULD call this from their begin()
|
||||||
startup_reason = BD_STARTUP_NORMAL;
|
startup_reason = BD_STARTUP_NORMAL;
|
||||||
btn_prev_state = HIGH;
|
btn_prev_state = HIGH;
|
||||||
@@ -16,6 +15,10 @@ void T1000eBoard::begin()
|
|||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
delay(10); // give sx1262 some time to power up
|
delay(10); // give sx1262 some time to power up
|
||||||
@@ -24,59 +27,57 @@ void T1000eBoard::begin()
|
|||||||
#if 0
|
#if 0
|
||||||
static BLEDfu bledfu;
|
static BLEDfu bledfu;
|
||||||
|
|
||||||
static void connect_callback(uint16_t conn_handle)
|
static void connect_callback(uint16_t conn_handle) {
|
||||||
{
|
(void)conn_handle;
|
||||||
(void)conn_handle;
|
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||||
{
|
(void)conn_handle;
|
||||||
(void)conn_handle;
|
(void)reason;
|
||||||
(void)reason;
|
|
||||||
|
|
||||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TrackerT1000eBoard::startOTAUpdate() {
|
bool TrackerT1000eBoard::startOTAUpdate() {
|
||||||
// Config the peripheral connection with maximum bandwidth
|
// Config the peripheral connection with maximum bandwidth
|
||||||
// more SRAM required by SoftDevice
|
// more SRAM required by SoftDevice
|
||||||
// Note: All config***() function must be called before begin()
|
// Note: All config***() function must be called before begin()
|
||||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||||
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
||||||
|
|
||||||
Bluefruit.begin(1, 0);
|
Bluefruit.begin(1, 0);
|
||||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||||
Bluefruit.setTxPower(4);
|
Bluefruit.setTxPower(4);
|
||||||
// Set the BLE device name
|
// Set the BLE device name
|
||||||
Bluefruit.setName("T1000E_OTA");
|
Bluefruit.setName("T1000E_OTA");
|
||||||
|
|
||||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||||
|
|
||||||
// To be consistent OTA DFU should be added first if it exists
|
// To be consistent OTA DFU should be added first if it exists
|
||||||
bledfu.begin();
|
bledfu.begin();
|
||||||
|
|
||||||
// Set up and start advertising
|
// Set up and start advertising
|
||||||
// Advertising packet
|
// Advertising packet
|
||||||
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
||||||
Bluefruit.Advertising.addTxPower();
|
Bluefruit.Advertising.addTxPower();
|
||||||
Bluefruit.Advertising.addName();
|
Bluefruit.Advertising.addName();
|
||||||
|
|
||||||
/* Start Advertising
|
/* Start Advertising
|
||||||
- Enable auto advertising if disconnected
|
- Enable auto advertising if disconnected
|
||||||
- Interval: fast mode = 20 ms, slow mode = 152.5 ms
|
- Interval: fast mode = 20 ms, slow mode = 152.5 ms
|
||||||
- Timeout for fast mode is 30 seconds
|
- Timeout for fast mode is 30 seconds
|
||||||
- Start(timeout) with timeout = 0 will advertise forever (until connected)
|
- Start(timeout) with timeout = 0 will advertise forever (until connected)
|
||||||
|
|
||||||
For recommended advertising interval
|
For recommended advertising interval
|
||||||
https://developer.apple.com/library/content/qa/qa1931/_index.html
|
https://developer.apple.com/library/content/qa/qa1931/_index.html
|
||||||
*/
|
*/
|
||||||
Bluefruit.Advertising.restartOnDisconnect(true);
|
Bluefruit.Advertising.restartOnDisconnect(true);
|
||||||
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
||||||
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
||||||
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ void T114Board::begin() {
|
|||||||
|
|
||||||
pinMode(PIN_VBAT_READ, INPUT);
|
pinMode(PIN_VBAT_READ, INPUT);
|
||||||
|
|
||||||
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
#ifdef P_LORA_TX_LED
|
#ifdef P_LORA_TX_LED
|
||||||
|
|||||||
@@ -6,14 +6,12 @@
|
|||||||
|
|
||||||
static BLEDfu bledfu;
|
static BLEDfu bledfu;
|
||||||
|
|
||||||
static void connect_callback(uint16_t conn_handle)
|
static void connect_callback(uint16_t conn_handle) {
|
||||||
{
|
|
||||||
(void)conn_handle;
|
(void)conn_handle;
|
||||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||||
{
|
|
||||||
(void)conn_handle;
|
(void)conn_handle;
|
||||||
(void)reason;
|
(void)reason;
|
||||||
|
|
||||||
@@ -26,6 +24,10 @@ void TechoBoard::begin() {
|
|||||||
|
|
||||||
pinMode(PIN_VBAT_READ, INPUT);
|
pinMode(PIN_VBAT_READ, INPUT);
|
||||||
|
|
||||||
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||||
|
|||||||
@@ -6,58 +6,56 @@
|
|||||||
|
|
||||||
static BLEDfu bledfu;
|
static BLEDfu bledfu;
|
||||||
|
|
||||||
static void connect_callback(uint16_t conn_handle)
|
static void connect_callback(uint16_t conn_handle) {
|
||||||
{
|
(void)conn_handle;
|
||||||
(void)conn_handle;
|
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||||
{
|
(void)conn_handle;
|
||||||
(void)conn_handle;
|
(void)reason;
|
||||||
(void)reason;
|
|
||||||
|
|
||||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool faketecBoard::startOTAUpdate() {
|
bool faketecBoard::startOTAUpdate() {
|
||||||
// Config the peripheral connection with maximum bandwidth
|
// Config the peripheral connection with maximum bandwidth
|
||||||
// more SRAM required by SoftDevice
|
// more SRAM required by SoftDevice
|
||||||
// Note: All config***() function must be called before begin()
|
// Note: All config***() function must be called before begin()
|
||||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||||
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
||||||
|
|
||||||
Bluefruit.begin(1, 0);
|
Bluefruit.begin(1, 0);
|
||||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||||
Bluefruit.setTxPower(4);
|
Bluefruit.setTxPower(4);
|
||||||
// Set the BLE device name
|
// Set the BLE device name
|
||||||
Bluefruit.setName("Faketec_OTA");
|
Bluefruit.setName("Faketec_OTA");
|
||||||
|
|
||||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||||
|
|
||||||
// To be consistent OTA DFU should be added first if it exists
|
// To be consistent OTA DFU should be added first if it exists
|
||||||
bledfu.begin();
|
bledfu.begin();
|
||||||
|
|
||||||
// Set up and start advertising
|
// Set up and start advertising
|
||||||
// Advertising packet
|
// Advertising packet
|
||||||
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
||||||
Bluefruit.Advertising.addTxPower();
|
Bluefruit.Advertising.addTxPower();
|
||||||
Bluefruit.Advertising.addName();
|
Bluefruit.Advertising.addName();
|
||||||
|
|
||||||
/* Start Advertising
|
/* Start Advertising
|
||||||
- Enable auto advertising if disconnected
|
- Enable auto advertising if disconnected
|
||||||
- Interval: fast mode = 20 ms, slow mode = 152.5 ms
|
- Interval: fast mode = 20 ms, slow mode = 152.5 ms
|
||||||
- Timeout for fast mode is 30 seconds
|
- Timeout for fast mode is 30 seconds
|
||||||
- Start(timeout) with timeout = 0 will advertise forever (until connected)
|
- Start(timeout) with timeout = 0 will advertise forever (until connected)
|
||||||
|
|
||||||
For recommended advertising interval
|
For recommended advertising interval
|
||||||
https://developer.apple.com/library/content/qa/qa1931/_index.html
|
https://developer.apple.com/library/content/qa/qa1931/_index.html
|
||||||
*/
|
*/
|
||||||
Bluefruit.Advertising.restartOnDisconnect(true);
|
Bluefruit.Advertising.restartOnDisconnect(true);
|
||||||
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
||||||
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
||||||
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ public:
|
|||||||
|
|
||||||
pinMode(PIN_VBAT_READ, INPUT);
|
pinMode(PIN_VBAT_READ, INPUT);
|
||||||
|
|
||||||
|
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||||
|
#endif
|
||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||||
|
|||||||
Reference in New Issue
Block a user