FOSSASAT-1B
Loading...
Searching...
No Matches
system_info.cpp
1
#include "
system_info.h
"
2
3
void
System_Info_Set_Callsign(
char
*
newCallsign
) {
4
// get length of the new callsign (callsign is saved to EEPROM including terminating NULL)
5
uint8_t
newCallsignLen
= (
uint8_t
)
strlen
(
newCallsign
) + 1;
6
7
// check new callsign length
8
if
(
newCallsignLen
>
MAX_STRING_LENGTH
) {
9
return
;
10
}
11
12
// write new callsign length
13
Persistent_Storage_Write<uint8_t>
(
EEPROM_CALLSIGN_LEN_ADDR
,
newCallsignLen
);
14
15
// write new callsign (including terminating NULL)
16
for
(
uint8_t
i
= 0;
i
<
newCallsignLen
;
i
++) {
17
Persistent_Storage_Write<uint8_t>
(
EEPROM_CALLSIGN_ADDR
+
i
, (
uint8_t
)
newCallsign
[
i
]);
18
}
19
}
20
21
void
System_Info_Get_Callsign(
char
*
buff
,
uint8_t
len
) {
22
// get callsign from EEPROM
23
for
(
uint8_t
i
= 0;
i
<
len
;
i
++) {
24
buff
[
i
] = (
char
)
Persistent_Storage_Read<uint8_t>
(
EEPROM_CALLSIGN_ADDR
+
i
);
25
}
26
}
EEPROM_CALLSIGN_LEN_ADDR
#define EEPROM_CALLSIGN_LEN_ADDR
Definition
configuration.h:268
EEPROM_CALLSIGN_ADDR
#define EEPROM_CALLSIGN_ADDR
Definition
configuration.h:276
MAX_STRING_LENGTH
#define MAX_STRING_LENGTH
Definition
configuration.h:29
Persistent_Storage_Read
T Persistent_Storage_Read(uint16_t addr)
This function reads a value of type T from EEPROM.
Definition
persistent_storage.h:22
system_info.h
FossaSat1B
system_info.cpp
Generated by
1.9.8