PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
eeprom_putInt.c
1
/*
2
* @file eeprom.c
3
*
4
* @author Andy Lindsay
5
*
6
* @version 0.86
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
void
ee_putInt
(
int
value,
int
addr)
25
{
26
unsigned
char
val[4] = {(
char
) value, (
char
) (value >> 8), (
char
) (value >> 16), (
char
) (value >> 24)};
27
ee_putStr
(val, 4, addr);
28
return
;
29
30
/*
31
if(!st_eeInitFlag) ee_init();
32
33
unsigned char val[4] = {(char) value, (char) (value >> 8), (char) (value >> 16), (char) (value >> 24)};
34
unsigned char addrArray[] = {(char)(addr >> 8), (char)(addr&0xFF)};
35
36
int pageAddr = addr % 128;
37
int byteCnt = 128 - pageAddr;
38
if(byteCnt > 4) byteCnt = 4;
39
40
int n = i2c_out(st_eeprom, 0xA0, addrArray, 2, val, byteCnt);
41
while(i2c_poll(st_eeprom, 0xA0));
42
43
if(byteCnt < 4)
44
{
45
int offset = byteCnt;
46
byteCnt = 4 - byteCnt;
47
addr += offset;
48
addrArray[0] = (char)(addr >> 8);
49
addrArray[1] = (char)(addr & 0xFF);
50
n += i2c_out(st_eeprom, 0xA0, addrArray, 2, &val[offset], byteCnt);
51
while(i2c_poll(st_eeprom, 0xA0));
52
}
53
*/
54
}
55
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
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,...
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
i2c_st
Definition:
simplei2c.h:25
st_eeInitFlag
int st_eeInitFlag
Initialization flag used by ee_ functions.
Definition:
accel_shaken.c:10
char
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17