東北大学学友会準加盟団体 From The Earth の高高度ロケットFTE-06(通称:海豚)にて使用したソフトウェアです.ご自由にお使いください.このプログラムによって生じた損害について当団体は一切責任を負いません.また,各モジュールのライブラリは当団体が作成したものではないので再配布は禁止します.

Dependencies:   mbed FATFileSystem

Fork of FTE-06 by Tetsushi Amano

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers 24LCXXX.h Source File

24LCXXX.h

00001 /**
00002  *****************************************************************************
00003  * File Name    : _24LCXXX.h
00004  *
00005  * Title        : I2C EEPROM 24LCXXX Claass Header File
00006  * Revision     : 0.1
00007  * Notes        :
00008  * Target Board : mbed NXP LPC1768, mbed LPC1114FN28  etc
00009  * Tool Chain   : ????
00010  *
00011  * Revision History:
00012  * When         Who         Description of change
00013  * -----------  ----------- -----------------------
00014  * 2012/12/06   Hiroshi M   init
00015  *****************************************************************************
00016  *
00017  * Copyright (C) 2013 Hiroshi M, MIT License
00018  *
00019  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00020  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00021  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00022  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00023  * furnished to do so, subject to the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be included in all copies or
00026  * substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00029  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00030  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00031  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00032  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00033  *
00034  **/
00035 
00036 #ifndef __24LCXXX_H_
00037 #define __24LCXXX_H_
00038 
00039 /* Includes ----------------------------------------------------------------- */
00040 #include "mbed.h"
00041 
00042 /* typedef ------------------------------------------------------------------ */
00043 
00044 /* define ------------------------------------------------------------------- */
00045 #define     I2C_ADDR_24LCXXX        0x50
00046 #define     __AT24C1024B__
00047 
00048 #if defined(__AT24C1024B__)
00049 #define     MAXADR_24LCXXX          130816
00050 #define     PAGE_SIZE_24LCXXX       256
00051 #endif
00052 
00053 #if defined(__24LC64__)
00054 #define     MAXADR_24LCXXX          8192
00055 #define     PAGE_SIZE_24LCXXX       32
00056 #endif
00057 
00058 #if defined(__24LC128__)
00059 #define     MAXADR_24LCXXX          16384
00060 #define     PAGE_SIZE_24LCXXX       64
00061 #endif
00062 
00063 #if defined(__24LC256__)
00064 #define     MAXADR_24LCXXX          32768
00065 #define     PAGE_SIZE_24LCXXX       64
00066 #endif
00067 
00068 /* macro -------------------------------------------------------------------- */
00069 /* variables ---------------------------------------------------------------- */
00070 /* class -------------------------------------------------------------------- */
00071 
00072 class _24LCXXX
00073 {
00074 private:
00075     int _i2c_address;
00076     I2C *_i2c;
00077     Serial *_pc;
00078     bool _debug;
00079 
00080 public:
00081     _24LCXXX(I2C *i2c, const int address=I2C_ADDR_24LCXXX );
00082     _24LCXXX(I2C *i2c, Serial *pc, const int address=I2C_ADDR_24LCXXX );
00083     int byte_write( int mem_addr, char data );
00084     int nbyte_write( int mem_addr, void *data, int size );
00085     int page_write( int mem_addr, char *data );
00086     int nbyte_read( int mem_addr, void *data, int size );
00087 };
00088 
00089 #endif /* __24LCXXX_H_ */