Arnaud VALLEY / Mbed 2 deprecated Pinscape_Controller_V2_arnoz

Dependencies:   mbed FastIO FastPWM USBDevice

Revision:
79:682ae3171a08
Parent:
76:7f5912b6340e
--- a/FreescaleIAP/FreescaleIAP.h	Sun Mar 19 05:30:53 2017 +0000
+++ b/FreescaleIAP/FreescaleIAP.h	Thu Mar 23 05:19:05 2017 +0000
@@ -6,23 +6,16 @@
 #include "mbed.h"
 #include "FreescaleIAP.h"
   
-int main() {
-    int address = flash_size() - SECTOR_SIZE;           //Write in last sector
+int main() 
+{
+    int address = flashSize() - SECTOR_SIZE;           //Write in last sector
     
     int *data = (int*)address;
     printf("Starting\r\n"); 
     erase_sector(address);
     int numbers[10] = {0, 1, 10, 100, 1000, 10000, 1000000, 10000000, 100000000, 1000000000};
-    program_flash(address, (char*)&numbers, 40);        //10 integers of 4 bytes each: 40 bytes length
-    printf("Resulting flash: \r\n");
-    for (int i = 0; i<10; i++)
-        printf("%d\r\n", data[i]);
-    
-    printf("Done\r\n\n");
-        
- 
-    while (true) {
-    }
+    programFlash(address, (char*)&numbers, 40);        //10 integers of 4 bytes each: 40 bytes length
+    while (true) ;
 }
 
 */
@@ -42,22 +35,22 @@
 #define SECTOR_SIZE     1024
 #endif
 
-enum IAPCode {
-    BoundaryError = -99,    //Commands may not span several sectors
-    AlignError,             //Data must be aligned on longword (two LSBs zero)
-    ProtectionError,        //Flash sector is protected
-    AccessError,            //Something went wrong
-    CollisionError,         //During writing something tried to flash which was written to
-    LengthError,            //The length must be multiples of 4
-    RuntimeError,           
-    EraseError,             //The flash was not erased before writing to it
-    Success = 0
-};
- 
-
 class FreescaleIAP
 {
 public:
+    enum IAPCode {
+        BoundaryError = -99,    // Commands may not span several sectors
+        AlignError,             // Data must be aligned on longword (two LSBs zero)
+        ProtectionError,        // Flash sector is protected
+        AccessError,            // Something went wrong
+        CollisionError,         // During writing something tried to flash which was written to
+        LengthError,            // The length must be multiples of 4
+        RuntimeError,           // FTFA runtime error reports
+        EraseError,             // The flash was not erased before writing to it
+        VerifyError,            // The data read back from flash didn't match what we wrote
+        Success = 0
+    };
+
     FreescaleIAP() { }
     ~FreescaleIAP() { }
  
@@ -68,7 +61,7 @@
      * @param length number of bytes to program (must be a multiple of 4)
      * @param return Success if no errors were encountered, otherwise one of the error states
      */
-    IAPCode program_flash(int address, const void *data, unsigned int length);
+    IAPCode programFlash(int address, const void *data, unsigned int length);
      
     /**
      * Returns size of flash memory
@@ -77,7 +70,7 @@
      *
      * @param return length of flash memory in bytes
      */
-    uint32_t flash_size(void);
+    uint32_t flashSize(void);
     
 private:
     // program a word of flash