PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Social
libbadgetools
peb_retrieve.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
void
retrieve
(
char
*contact,
int
recIdx)
13
{
14
if
(!eeBadgeOk) ee_badgeCheck();
15
if
(recIdx >= eeRecs)
return
;
16
int
a = EE_BADGE_DATA_END - (4 * recIdx);
17
while
(
lockset
(eei2cLock));
18
a =
ee_getInt
(a);
19
int
ss = a >> 16;
20
a &= 0x0000FFFF;
21
//print("ee_retireve a = %d\n", a);
22
//print("ee_retireve ss = %d\n", ss);
23
memset(contact, 0, ss);
// ? ss +/- 1 ?
24
ee_getStr
((
unsigned
char
*)contact, ss, a);
25
//stringView(contact, ss);
26
lockclr
(eei2cLock);
27
}
28
29
/*
30
TERMS OF USE: MIT License
31
32
Permission is hereby granted, free of charge, to any person obtaining a
33
copy of this software and associated documentation files (the "Software"),
34
to deal in the Software without restriction, including without limitation
35
the rights to use, copy, modify, merge, publish, distribute, sublicense,
36
and/or sell copies of the Software, and to permit persons to whom the
37
Software is furnished to do so, subject to the following conditions:
38
39
The above copyright notice and this permission notice shall be included in
40
all copies or substantial portions of the Software.
41
42
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
48
DEALINGS IN THE SOFTWARE.
49
*/
50
ee_getInt
int ee_getInt(int addr)
Get an int value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching...
Definition:
eeprom_getInt.c:24
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
lockset
#define lockset(lockid)
Set a lock.
Definition:
propeller.h:163
retrieve
void retrieve(char *contact, int recIdx)
Copy string with a certain index number from EEPROM to a character array.
Definition:
peb_retrieve.c:12
lockclr
#define lockclr(lockid)
Clear lock.
Definition:
propeller.h:170
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
ee_getStr
unsigned char * ee_getStr(unsigned char *s, int n, int addr)
Fetch a string of byte values starting at a certain address in Propeller Chip's dedicated EEPROM.
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17