IAP class library for LPC1768, LPC11U24, LPC1114, LPC812 and LPC824

Dependents:   MakerBotServer SystemManagement IAP_testing Arch_Pro_TCPSocket ... more

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Thu Aug 16 06:11:23 2018 +0000
Parent:
7:c8bf974ecb33
Child:
9:26095608ac1a
Commit message:
"write_page" function added for LPC81X/LPC82X

Changed in this revision

IAP.cpp Show annotated file Show diff for this revision Revisions of this file
IAP.h Show annotated file Show diff for this revision Revisions of this file
--- a/IAP.cpp	Tue Mar 10 04:19:23 2015 +0000
+++ b/IAP.cpp	Thu Aug 16 06:11:23 2018 +0000
@@ -25,6 +25,8 @@
  *        revision 3.0  09-Jan-2015   LPC812 and LPC824 support added
  *        revision 3.1  13-Jan-2015   LPC1114 support added
  *        revision 3.1.1 16-Jan-2015  Target MCU name changed for better compatibility across the platforms
+ *        revision 3.1.2 10-Mar-2015  merged with pull requests. reinvoke_isp() added and modified read_serial() to return a pointer.
+ *        revision 3.1.3 16-Aug-2018  "write_page" function added for LPC81X/LPC82X
  */
 
 #include    "mbed.h"
@@ -218,4 +220,10 @@
     return ( (int)IAP_result[ 0 ] );
 }
 
+int IAP::write_page( char *source_addr, int target_page )
+{
+    prepare( target_page / (LPC8XX_SCTR_SIZE / LPC8XX_PAGE_SIZE), target_page / (LPC8XX_SCTR_SIZE / LPC8XX_PAGE_SIZE) );
+    return ( write( source_addr, (char *)(target_page * LPC8XX_PAGE_SIZE), LPC8XX_PAGE_SIZE ) );
+}
+
 #endif
--- a/IAP.h	Tue Mar 10 04:19:23 2015 +0000
+++ b/IAP.h	Thu Aug 16 06:11:23 2018 +0000
@@ -25,6 +25,8 @@
  *        revision 3.0  09-Jan-2015   LPC812 and LPC824 support added
  *        revision 3.1  13-Jan-2015   LPC1114 support added
  *        revision 3.1.1 16-Jan-2015  Target MCU name changed for better compatibility across the platforms
+ *        revision 3.1.2 10-Mar-2015  merged with pull requests. reinvoke_isp() added and modified read_serial() to return a pointer.
+ *        revision 3.1.3 16-Aug-2018  "write_page" function added for LPC81X/LPC82X
  */
 
 
@@ -473,6 +475,8 @@
     int read_eeprom( char *source_addr, char *target_addr, int size );
 
 #elif defined(TARGET_LPC81X) || defined(TARGET_LPC82X)
+#define LPC8XX_SCTR_SIZE   1024
+#define LPC8XX_PAGE_SIZE   64
 
     /** Erase page(s) (LPC812, LPC824)
      *
@@ -482,6 +486,14 @@
      */
     int erase_page( int start, int end );
 
+    /** Write page (LPC812, LPC824)
+     *
+     *  @param    source_addr   Source EEPROM address from which data bytes are to be read.
+     *  @param    target_page   Target page number.
+     *  @return   error code: CMD_SUCCESS | SRC_ADDR_ERROR (Address not a word boundary) | DST_ADDR_ERROR (Address not on correct boundary) | SRC_ADDR_NOT_MAPPED | DST_ADDR_NOT_MAPPED | COUNT_ERROR (Byte count is not 256 | 512 | 1024 | 4096) | SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION | BUSY BUSY | INVALID_SECTOR (error from parepare command)
+     */
+    int write_page( char *source_addr, int target_page );
+
 #endif
 
 private: