Skip to content

Commit 3c9c2a4

Browse files
committed
add compatibility with mbed boards
1 parent 3fb6a8e commit 3c9c2a4

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

examples/MKRWANFWUpdate_standalone/MKRWANFWUpdate_standalone.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void setup() {
3535
};
3636

3737
port.flags = PORT_CMD_INIT | PORT_GVR_ETX | PORT_BYTE | PORT_RETRY;
38-
port.dev = &Serial2;
38+
port.dev = &SerialLoRa;
3939
port.ops = &port_opts;
4040

4141
assignCallbacks(&port);
@@ -53,7 +53,7 @@ void setup() {
5353

5454
Serial.println("Press a key to start FW update");
5555
port.open(&port);
56-
port.flush(&port);
56+
//port.flush(&port);
5757

5858
stm = stm32_init(&port, 1);
5959

@@ -267,8 +267,8 @@ again:
267267

268268
void resetModuleRunning() {
269269
digitalWrite(LORA_BOOT0, LOW);
270-
Serial2.end();
271-
Serial2.begin(19200);
270+
SerialLoRa.end();
271+
SerialLoRa.begin(19200);
272272
delay(100);
273273
digitalWrite(LORA_RESET, HIGH);
274274
delay(100);
@@ -282,6 +282,7 @@ void loop() {
282282
// put your main code here, to run repeatedly:
283283
if (ret == 0) {
284284
Serial.println("Flashing ok :)");
285+
SerialLoRa.end();
285286
LoRaModem* modem = new LoRaModem();
286287
modem->begin(EU868);
287288
Serial.println(modem->version());

examples/MKRWANFWUpdate_standalone/serial_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#ifndef _H_PORT
22
#define _H_PORT
33

4-
#include "Uart.h"
54
#include "Arduino.h"
65

76
#define usleep(x) delayMicroseconds(x)
87

8+
#ifndef __MBED__
9+
#include "Uart.h"
10+
#define UART Uart
11+
#endif
912

1013
#define fprintf(output, ...) { \
1114
do { \
@@ -56,7 +59,7 @@ struct port_interface {
5659
port_err_t (*read)(struct port_interface *port, void *buf, size_t nbyte);
5760
port_err_t (*write)(struct port_interface *port, void *buf, size_t nbyte);
5861
struct varlen_cmd *cmd_get_reply = NULL;
59-
Uart *dev;
62+
UART *dev;
6063
struct port_options *ops;
6164
};
6265

examples/MKRWANFWUpdate_standalone/stm32.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <stdio.h>
2424
#include <string.h>
2525
#include <time.h>
26-
#include <unistd.h>
2726

2827
#include "stm32.h"
2928
#include "serial_arduino.h"

src/MKRWAN_v2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class SerialFifo
164164
};
165165

166166
#ifndef YIELD
167-
#define YIELD() { delay(0); }
167+
#define YIELD() { delay(2); }
168168
#endif
169169

170170
typedef const char* ConstStr;

0 commit comments

Comments
 (0)