-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.cpp
More file actions
32 lines (27 loc) · 725 Bytes
/
util.cpp
File metadata and controls
32 lines (27 loc) · 725 Bytes
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
/*
* util.cpp
*
* Created on: Feb 27, 2020
* Author: raltmeyer
*
* Util functions
*
*/
#include <Arduino.h>
char string_ram[40]; // Temporary buffer used to copy strings from arduino flash
//*********
//* Copy string content from the arduino flash (progmem) to RAM
char* getProgMemString(const char *str) {
strcpy_P(string_ram, (char*) str);
return string_ram;
}
//*********
//* Verify if the address is valid and inside the range
const static char msg_addressspaceerror[] PROGMEM = "#ERROR_INVALID_ADDRESS";
int checkAddress(int address) {
if (address < 0 || address > 0x7FFF) { //32k range (28c256 address space)
Serial.println(getProgMemString(msg_addressspaceerror));
return 0;
}
return 1;
}