variants: Wio WM1110: Use common implementation of startOTAUpdate()
Signed-off-by: Frieder Schrempf <frieder@fris.de>
This commit is contained in:
@@ -1,24 +1,9 @@
|
|||||||
#ifdef WIO_WM1110
|
#ifdef WIO_WM1110
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
#include <bluefruit.h>
|
|
||||||
|
|
||||||
#include "WioWM1110Board.h"
|
#include "WioWM1110Board.h"
|
||||||
|
|
||||||
static BLEDfu bledfu;
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
static void connect_callback(uint16_t conn_handle) {
|
|
||||||
(void)conn_handle;
|
|
||||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
|
||||||
(void)conn_handle;
|
|
||||||
(void)reason;
|
|
||||||
|
|
||||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
|
||||||
}
|
|
||||||
|
|
||||||
void WioWM1110Board::begin() {
|
void WioWM1110Board::begin() {
|
||||||
NRF52BoardDCDC::begin();
|
NRF52BoardDCDC::begin();
|
||||||
@@ -42,31 +27,5 @@ void WioWM1110Board::begin() {
|
|||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WioWM1110Board::startOTAUpdate(const char *id, char reply[]) {
|
|
||||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
|
||||||
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
|
||||||
|
|
||||||
Bluefruit.begin(1, 0);
|
|
||||||
Bluefruit.setTxPower(4);
|
|
||||||
Bluefruit.setName("WM1110_OTA");
|
|
||||||
|
|
||||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
|
||||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
|
||||||
|
|
||||||
bledfu.begin();
|
|
||||||
|
|
||||||
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
|
||||||
Bluefruit.Advertising.addTxPower();
|
|
||||||
Bluefruit.Advertising.addName();
|
|
||||||
Bluefruit.Advertising.restartOnDisconnect(true);
|
|
||||||
Bluefruit.Advertising.setInterval(32, 244);
|
|
||||||
Bluefruit.Advertising.setFastTimeout(30);
|
|
||||||
Bluefruit.Advertising.start(0);
|
|
||||||
|
|
||||||
strcpy(reply, "OK - started");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#define Serial Serial1
|
#define Serial Serial1
|
||||||
|
|
||||||
class WioWM1110Board : public NRF52BoardDCDC {
|
class WioWM1110Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||||
public:
|
public:
|
||||||
|
WioWM1110Board() : NRF52BoardOTA("WM1110_OTA") {}
|
||||||
void begin();
|
void begin();
|
||||||
|
|
||||||
#if defined(LED_GREEN)
|
#if defined(LED_GREEN)
|
||||||
@@ -37,8 +38,6 @@ public:
|
|||||||
return "Seeed Wio WM1110";
|
return "Seeed Wio WM1110";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool startOTAUpdate(const char* id, char reply[]) override;
|
|
||||||
|
|
||||||
void enableSensorPower(bool enable) {
|
void enableSensorPower(bool enable) {
|
||||||
digitalWrite(SENSOR_POWER_PIN, enable ? HIGH : LOW);
|
digitalWrite(SENSOR_POWER_PIN, enable ? HIGH : LOW);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user