Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
EEPROM.cpp
00001 //********************** 00002 // EEPROM.cpp for TG-LPC11U35-501 00003 // TG-LPC11U35-501 has 4K EEPROM. 00004 // 00005 // usage: 00006 // EEPROM eeprom; 00007 // char RAM[100] 00008 // eeprom.write(0, RAM, 100); 00009 // eeprom.read(0, RAM, 100); 00010 // eeprom.put(0, 0x00); 00011 // i=eeprom.get(0); 00012 // 00013 // note: 00014 // valid EEPROM address range is between 0 to 4031 00015 // top 64 bytes are reserved 00016 // 00017 // (C)Copyright 2014 All rights reserved by Y.Onodera 00018 // http://einstlab.web.fc2.com 00019 //********************** 00020 #include "EEPROM.h" 00021 00022 int EEPROM::write( unsigned int EEPROM_addr, char *RAM_addr, unsigned int n ) { 00023 command[0] = EEPROM_Write; 00024 command[1] = EEPROM_addr; 00025 command[2] = (unsigned int)RAM_addr; 00026 command[3] = n; 00027 command[4] = cclk_kHz; 00028 00029 iap_entry( command, status ); 00030 00031 return ( (int)status[0] ); 00032 } 00033 00034 00035 int EEPROM::read( unsigned int EEPROM_addr, char *RAM_addr, unsigned int n ) { 00036 command[0] = EEPROM_Read; 00037 command[1] = EEPROM_addr; 00038 command[2] = (unsigned int)RAM_addr; 00039 command[3] = n; 00040 command[4] = cclk_kHz; 00041 00042 iap_entry( command, status ); 00043 00044 return ( (int)status[0] ); 00045 } 00046 00047 00048 int EEPROM::put( unsigned int EEPROM_addr, char data ) { 00049 dat[0]=data; 00050 command[0] = EEPROM_Write; 00051 command[1] = EEPROM_addr; 00052 command[2] = (unsigned int)dat; 00053 command[3] = 1; 00054 command[4] = cclk_kHz; 00055 00056 iap_entry( command, status ); 00057 00058 return ( (int)status[0] ); 00059 } 00060 00061 00062 char EEPROM::get( unsigned int EEPROM_addr ) { 00063 command[0] = EEPROM_Read; 00064 command[1] = EEPROM_addr; 00065 command[2] = (unsigned int)dat; 00066 command[3] = 1; 00067 command[4] = cclk_kHz; 00068 00069 iap_entry( command, status ); 00070 00071 return ( dat[0] ); 00072 }
Generated on Thu Jul 14 2022 18:15:07 by
1.7.2