Skip to content

Commit 62da789

Browse files
committed
Feather 32u4 support, readme update and pmic fix
1 parent 7a88e02 commit 62da789

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ The code will manage the LTE-M, GSM and WiFi connection(depending on currently u
1616
| Arduino MKR 1500 NB | OK | OK | OK |
1717
| Arduino MKR VIDOR 4000 | OK | OK* | - |
1818
| Arduino Nano 33 IoT | OK | OK | - |
19-
| ESP8266 Boards(Beta) | OK | - | - |
19+
| ESP8266 Boards | OK | - | - |
20+
| ESP32 Boards | OK | OK | - |
21+
| Feather 32u4 | OK | - | OK |
2022

2123
## Prerequisites/dependecies ##
2224
This code needs 2 ~~3~~ external libraries to run, that you can install using the built-in [Library Manager](https://www.arduino.cc/en/guide/libraries) of the Arduino IDE.
@@ -48,6 +50,8 @@ This code needs 2 ~~3~~ external libraries to run, that you can install using th
4850
3. Clone or download the directory from Github.
4951
4. In the **'src/arduino_secrets.h'** file :
5052
- Paste it as initialization value for the `SECRET_LIVEOBJECTS_API_KEY` variable in the 'arduino_secrets.h' file -keep the double quotes!
53+
54+
In case of feather 32u4 you have to change type of this variable to char* from String
5155
- Fill in the connection(WIFI or GSM) credentials if needed (pin code, APN information, etc). In case of GSM connection, most of the time, APN will set up automatically. Your SIM card may have a default pin code (like "0000"), unless you deactivated it using the [Pin management](https://github.com/arduino-libraries/MKRNB/blob/master/examples/Tools/PinManagement/PinManagement.ino) sketch, provided with the MKRNB library.
5256
5. Import library into the Arduino IDE, to do this select: *Sketch-> Include Library-> Add .ZIP Library* and select folder which you cloned in the previous step(actually it doesn't need to be .ZIP-ed to be imported). After successful import you should see example sketches in *File->Examples->LiveObjectsSDK*
5357

src/LiveObjects.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
#pragma once
2+
23
/******************************************************************************
34
Arduino MKR BOARDS
45
******************************************************************************/
56
#ifdef ARDUINO_ARCH_SAMD
7+
8+
/* Power status for supported MKR boards*/
9+
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
10+
#define PMIC_PRESENT
11+
#endif
12+
613
#if defined ARDUINO_SAMD_MKRGSM1400 || defined ARDUINO_SAMD_MKRNB1500
714
#define Cellular
815
#include "LiveObjectsCellular.h"
916
#elif defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_NANO_33_IOT || defined ARDUINO_SAMD_MKRVIDOR4000 || defined ARDUINO_SAMD_MKR1000 || ADAFRUIT_FEATHER_M0
1017
#define WIFI_
1118
#include "LiveObjectsWiFi.h"
1219
#endif
13-
14-
/* Power status for supported MKR boards*/
15-
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
16-
#define PMIC_PRESENT
17-
#endif
1820
#endif
19-
2021
/******************************************************************************
2122
ESP8266 and ESP32 BOARDS
2223
******************************************************************************/

src/LiveObjectsBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void LiveObjectsBase::commandManager(String topic) {
243243

244244
void LiveObjectsBase::connect()
245245
{
246-
#ifdef PMIC_PRESENT
246+
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
247247
batteryBegin();
248248
#endif
249249
connectNetwork();

src/LiveObjectsBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ inline void LiveObjectsBase::outputDebug(LOG_MSGTYPE type,T item, Args&... args)
392392
Serial.print(item);
393393
break;
394394
default:
395-
Serial.print(item);
395+
if(m_bDebug) Serial.print(item);
396396
}
397397
if(String(item)!=".") outputDebug(TXT,args...);
398398
}

src/LiveObjectsMKR.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ void LiveObjectsMKR::stopMQTT()
9898

9999
void LiveObjectsMKR::addPowerStatus()
100100
{
101-
#ifdef PMIC_PRESENT
101+
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
102+
outputDebug(INFO, "READ BEFORE");
102103
byte DATA = readRegister(SYSTEM_STATUS_REGISTER);
104+
outputDebug(INFO, "READ AFTER");
103105
bool charging = (DATA & ((1<<5)|(1<<4)))!=0;
104106
bool bat = (DATA & (1<<0)) == 0 || charging;
105107
bool power=(DATA & (1<<2));

src/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Utils.h"
22
#include <Arduino.h>
33
//#if not defined ESP8266 && not defined ESP32
4-
#ifdef PMIC_PRESENT
4+
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
55
byte readRegister(byte address) {
66
Wire.beginTransmission(PMIC_ADDRESS);
77
Wire.write(address);

src/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ uint8_t hexBinary(char msb, char lsb);
173173
*
174174
* ****************************************************************************/
175175
//#if not defined ESP8266 && not defined ESP32
176-
#ifdef PMIC_PRESENT
176+
#if defined ARDUINO_SAMD_MKRWIFI1010 || defined ARDUINO_SAMD_MKRNB1500 || defined ARDUINO_SAMD_MKRGSM1400
177177
#define PMIC_ADDRESS 0x6B
178178
#define SYSTEM_STATUS_REGISTER 0x08
179179
#define PMIC_VERSION_REGISTER 0x0A

0 commit comments

Comments
 (0)