|
|
@@ -1,24 +1,9 @@
|
|
|
#ifdef WIO_WM1110
|
|
|
|
|
|
-#include <Arduino.h>
|
|
|
-#include <Wire.h>
|
|
|
-#include <bluefruit.h>
|
|
|
-
|
|
|
#include "WioWM1110Board.h"
|
|
|
|
|
|
-static BLEDfu bledfu;
|
|
|
-
|
|
|
-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");
|
|
|
-}
|
|
|
+#include <Arduino.h>
|
|
|
+#include <Wire.h>
|
|
|
|
|
|
void WioWM1110Board::begin() {
|
|
|
NRF52BoardDCDC::begin();
|
|
|
@@ -42,31 +27,5 @@ void WioWM1110Board::begin() {
|
|
|
|
|
|
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
|
|
|
|