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

Dependencies:   mbed FATFileSystem

Fork of FTE-06 by Tetsushi Amano

Committer:
mizuki_akaike
Date:
Sun Jun 11 11:37:11 2017 +0000
Revision:
10:ef6fb2d8e2c8
eeprom????????????; eeprom?????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mizuki_akaike 10:ef6fb2d8e2c8 1 /**
mizuki_akaike 10:ef6fb2d8e2c8 2 *****************************************************************************
mizuki_akaike 10:ef6fb2d8e2c8 3 * File Name : _24LCXXX.h
mizuki_akaike 10:ef6fb2d8e2c8 4 *
mizuki_akaike 10:ef6fb2d8e2c8 5 * Title : I2C EEPROM 24LCXXX Claass Header File
mizuki_akaike 10:ef6fb2d8e2c8 6 * Revision : 0.1
mizuki_akaike 10:ef6fb2d8e2c8 7 * Notes :
mizuki_akaike 10:ef6fb2d8e2c8 8 * Target Board : mbed NXP LPC1768, mbed LPC1114FN28 etc
mizuki_akaike 10:ef6fb2d8e2c8 9 * Tool Chain : ????
mizuki_akaike 10:ef6fb2d8e2c8 10 *
mizuki_akaike 10:ef6fb2d8e2c8 11 * Revision History:
mizuki_akaike 10:ef6fb2d8e2c8 12 * When Who Description of change
mizuki_akaike 10:ef6fb2d8e2c8 13 * ----------- ----------- -----------------------
mizuki_akaike 10:ef6fb2d8e2c8 14 * 2012/12/06 Hiroshi M init
mizuki_akaike 10:ef6fb2d8e2c8 15 *****************************************************************************
mizuki_akaike 10:ef6fb2d8e2c8 16 *
mizuki_akaike 10:ef6fb2d8e2c8 17 * Copyright (C) 2013 Hiroshi M, MIT License
mizuki_akaike 10:ef6fb2d8e2c8 18 *
mizuki_akaike 10:ef6fb2d8e2c8 19 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mizuki_akaike 10:ef6fb2d8e2c8 20 * and associated documentation files (the "Software"), to deal in the Software without restriction,
mizuki_akaike 10:ef6fb2d8e2c8 21 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
mizuki_akaike 10:ef6fb2d8e2c8 22 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
mizuki_akaike 10:ef6fb2d8e2c8 23 * furnished to do so, subject to the following conditions:
mizuki_akaike 10:ef6fb2d8e2c8 24 *
mizuki_akaike 10:ef6fb2d8e2c8 25 * The above copyright notice and this permission notice shall be included in all copies or
mizuki_akaike 10:ef6fb2d8e2c8 26 * substantial portions of the Software.
mizuki_akaike 10:ef6fb2d8e2c8 27 *
mizuki_akaike 10:ef6fb2d8e2c8 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mizuki_akaike 10:ef6fb2d8e2c8 29 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mizuki_akaike 10:ef6fb2d8e2c8 30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mizuki_akaike 10:ef6fb2d8e2c8 31 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mizuki_akaike 10:ef6fb2d8e2c8 32 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mizuki_akaike 10:ef6fb2d8e2c8 33 *
mizuki_akaike 10:ef6fb2d8e2c8 34 **/
mizuki_akaike 10:ef6fb2d8e2c8 35
mizuki_akaike 10:ef6fb2d8e2c8 36 #ifndef __24LCXXX_H_
mizuki_akaike 10:ef6fb2d8e2c8 37 #define __24LCXXX_H_
mizuki_akaike 10:ef6fb2d8e2c8 38
mizuki_akaike 10:ef6fb2d8e2c8 39 /* Includes ----------------------------------------------------------------- */
mizuki_akaike 10:ef6fb2d8e2c8 40 #include "mbed.h"
mizuki_akaike 10:ef6fb2d8e2c8 41
mizuki_akaike 10:ef6fb2d8e2c8 42 /* typedef ------------------------------------------------------------------ */
mizuki_akaike 10:ef6fb2d8e2c8 43
mizuki_akaike 10:ef6fb2d8e2c8 44 /* define ------------------------------------------------------------------- */
mizuki_akaike 10:ef6fb2d8e2c8 45 #define I2C_ADDR_24LCXXX 0x50
mizuki_akaike 10:ef6fb2d8e2c8 46 #define __AT24C1024B__
mizuki_akaike 10:ef6fb2d8e2c8 47
mizuki_akaike 10:ef6fb2d8e2c8 48 #if defined(__AT24C1024B__)
mizuki_akaike 10:ef6fb2d8e2c8 49 #define MAXADR_24LCXXX 130816
mizuki_akaike 10:ef6fb2d8e2c8 50 #define PAGE_SIZE_24LCXXX 256
mizuki_akaike 10:ef6fb2d8e2c8 51 #endif
mizuki_akaike 10:ef6fb2d8e2c8 52
mizuki_akaike 10:ef6fb2d8e2c8 53 #if defined(__24LC64__)
mizuki_akaike 10:ef6fb2d8e2c8 54 #define MAXADR_24LCXXX 8192
mizuki_akaike 10:ef6fb2d8e2c8 55 #define PAGE_SIZE_24LCXXX 32
mizuki_akaike 10:ef6fb2d8e2c8 56 #endif
mizuki_akaike 10:ef6fb2d8e2c8 57
mizuki_akaike 10:ef6fb2d8e2c8 58 #if defined(__24LC128__)
mizuki_akaike 10:ef6fb2d8e2c8 59 #define MAXADR_24LCXXX 16384
mizuki_akaike 10:ef6fb2d8e2c8 60 #define PAGE_SIZE_24LCXXX 64
mizuki_akaike 10:ef6fb2d8e2c8 61 #endif
mizuki_akaike 10:ef6fb2d8e2c8 62
mizuki_akaike 10:ef6fb2d8e2c8 63 #if defined(__24LC256__)
mizuki_akaike 10:ef6fb2d8e2c8 64 #define MAXADR_24LCXXX 32768
mizuki_akaike 10:ef6fb2d8e2c8 65 #define PAGE_SIZE_24LCXXX 64
mizuki_akaike 10:ef6fb2d8e2c8 66 #endif
mizuki_akaike 10:ef6fb2d8e2c8 67
mizuki_akaike 10:ef6fb2d8e2c8 68 /* macro -------------------------------------------------------------------- */
mizuki_akaike 10:ef6fb2d8e2c8 69 /* variables ---------------------------------------------------------------- */
mizuki_akaike 10:ef6fb2d8e2c8 70 /* class -------------------------------------------------------------------- */
mizuki_akaike 10:ef6fb2d8e2c8 71
mizuki_akaike 10:ef6fb2d8e2c8 72 class _24LCXXX
mizuki_akaike 10:ef6fb2d8e2c8 73 {
mizuki_akaike 10:ef6fb2d8e2c8 74 private:
mizuki_akaike 10:ef6fb2d8e2c8 75 int _i2c_address;
mizuki_akaike 10:ef6fb2d8e2c8 76 I2C *_i2c;
mizuki_akaike 10:ef6fb2d8e2c8 77 Serial *_pc;
mizuki_akaike 10:ef6fb2d8e2c8 78 bool _debug;
mizuki_akaike 10:ef6fb2d8e2c8 79
mizuki_akaike 10:ef6fb2d8e2c8 80 public:
mizuki_akaike 10:ef6fb2d8e2c8 81 _24LCXXX(I2C *i2c, const int address=I2C_ADDR_24LCXXX );
mizuki_akaike 10:ef6fb2d8e2c8 82 _24LCXXX(I2C *i2c, Serial *pc, const int address=I2C_ADDR_24LCXXX );
mizuki_akaike 10:ef6fb2d8e2c8 83 int byte_write( int mem_addr, char data );
mizuki_akaike 10:ef6fb2d8e2c8 84 int nbyte_write( int mem_addr, void *data, int size );
mizuki_akaike 10:ef6fb2d8e2c8 85 int page_write( int mem_addr, char *data );
mizuki_akaike 10:ef6fb2d8e2c8 86 int nbyte_read( int mem_addr, void *data, int size );
mizuki_akaike 10:ef6fb2d8e2c8 87 };
mizuki_akaike 10:ef6fb2d8e2c8 88
mizuki_akaike 10:ef6fb2d8e2c8 89 #endif /* __24LCXXX_H_ */