-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
Copy pathSSU_LoadBinary.ino
57 lines (38 loc) · 1.38 KB
/
SSU_LoadBinary.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <MKRGSM.h>
/**************************************************************************************
* CONSTANTS
**************************************************************************************/
static char const BINARY[] =
{
#include "Binary.h"
};
GSMFileUtils fileUtils;
/**************************************************************************************
* SETUP/LOOP
**************************************************************************************/
void setup() {
Serial.begin(9600);
unsigned long const start = millis();
for(unsigned long now = millis(); !Serial && ((now - start) < 5000); now = millis()) { };
Serial.print("Accessing SARA U-201 Filesystem... ");
if(!fileUtils.begin()) {
Serial.println("failed.");
return;
}
Serial.println("OK");
Serial.print("Writing \"UPDATE.BIN\" ... ");
uint32_t bytes_to_write = sizeof(BINARY);
auto bytes_written = fileUtils.downloadFile("UPDATE.BIN", BINARY, bytes_to_write);
if(bytes_written != bytes_to_write) {
Serial.println("downloadFile failed.");return;
} else {
Serial.print("OK (");
Serial.print(bytes_written);
Serial.println(" bytes written)");
}
}
void loop() {
}