PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
eeprom_getInt.c
1
/*
2
* @file eeprom.c
3
*
4
* @author Andy Lindsay
5
*
6
* @version 0.85
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2013. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief eeprom functions source, see simpletools.h for documentation.
12
*
13
* @detail Please submit bug reports, suggestions, and improvements to
14
* this code to editor@parallax.com.
15
*/
16
17
#include "
simpletools.h
"
// simpletools function prototypes
18
19
i2c
*
st_eeprom
;
20
int
st_eeInitFlag
;
21
22
void
ee_init();
23
24
int
ee_getInt
(
int
addr)
25
{
26
if
(!
st_eeInitFlag
) ee_init();
27
//unsigned char val[4] = {0, 0, 0, 0};
28
int
value;
29
// const unsigned char addrArray[] = {(char)(addr >> 8), (char)(addr&0xFF)};
30
// i2c_in(st_eeprom, 0xA0, addrArray, 2, val, 4);
31
i2c_in
(
st_eeprom
, 0x50, addr, 2, (
unsigned
char
*) &value, 4);
32
// int value = (int)((int)(val[0]) | (int)(val[1] << 8) | (int)(val[2] << 16) | (int)(val[3] << 24));
33
return
value;
34
}
35
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
i2c_in
HUBTEXT int i2c_in(i2c *busID, int i2cAddr, int memAddr, int memAddrCount, unsigned char *data, int dataCount)
Receive data from device using I2C protocol.
Definition:
i2c_in.c:20
st_eeprom
i2c * st_eeprom
The busID for the Propeller Activity Board's EEPROM bus.
Definition:
accel_shaken.c:9
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
i2c_st
Definition:
simplei2c.h:25
st_eeInitFlag
int st_eeInitFlag
Initialization flag used by ee_ functions.
Definition:
accel_shaken.c:10
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17