PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Social
libbadgetools
peb_store.c
1
#include "
simpletools.h
"
2
#include "
badgetools.h
"
3
4
int
i2cLock;
5
volatile
int
eei2cLock;
6
volatile
int
eei2cLockFlag;
7
volatile
int
eeRecCount, eeNextAddr, eeBadgeOk,
8
eeNext, eeRecsAddr, eeRecs,
9
eeRecHome, eeRecOffice;
10
volatile
int
eeHome;
11
12
int
store
(
char
*contact)
13
{
14
if
(!eeBadgeOk) ee_badgeCheck();
15
int
ss = 1 + strlen(contact);
16
if
(eeNext + ss >= eeRecOffice)
17
return
-1;
18
while
(
lockset
(eei2cLock));
19
ee_putInt
(eeNext | (ss << 16), eeRecOffice);
20
eeRecOffice -= 4;
21
ee_putStr
((
unsigned
char
*) contact, ss, eeNext);
22
eeNext += ss;
23
ee_putInt
(eeNext, eeNextAddr);
24
eeRecs++;
25
ee_putInt
(eeRecs, eeRecsAddr);
26
lockclr
(eei2cLock);
27
return
eeRecs;
28
}
29
30
/*
31
TERMS OF USE: MIT License
32
33
Permission is hereby granted, free of charge, to any person obtaining a
34
copy of this software and associated documentation files (the "Software"),
35
to deal in the Software without restriction, including without limitation
36
the rights to use, copy, modify, merge, publish, distribute, sublicense,
37
and/or sell copies of the Software, and to permit persons to whom the
38
Software is furnished to do so, subject to the following conditions:
39
40
The above copyright notice and this permission notice shall be included in
41
all copies or substantial portions of the Software.
42
43
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
46
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
48
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
49
DEALINGS IN THE SOFTWARE.
50
*/
51
ee_putInt
void ee_putInt(int value, int addr)
Store an int value at a certain address in the Propeller Chip's dedicated EEPROM. An int value occupi...
Definition:
eeprom_putInt.c:24
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
ee_putStr
void ee_putStr(unsigned char *s, int n, int addr)
Store a string of byte values starting at a certain address in the Propeller Chip's dedicated EEPROM.
Definition:
eeprom_putStr.c:25
lockset
#define lockset(lockid)
Set a lock.
Definition:
propeller.h:163
lockclr
#define lockclr(lockid)
Clear lock.
Definition:
propeller.h:170
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
store
int store(char *contact)
Store a character string of up to 128 characters to EEPROM. Example: char s[] = "abcd"; store(s);.
Definition:
peb_store.c:12
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17