ISP example program.

Dependencies:   SLCD mbed USBLocalFileSystem

/media/uploads/va009039/lpc81isp-360x240.jpg

FRDM-KL46ZLPC810
UART RXDPTE23p2(P0_4)
UART TXDPTE22p8(P0_0)
nRESETD6p1(P0_5)
nISPD8p5(P0_1)
GNDGNDp7
3.3VP3V3p6

Copy binary image to the disk called LPC81ISP.
Push sw1 or sw3, start write to LPC810 flash.

Revision:
0:ad2b1fc04955
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mymap.h	Sat Feb 15 10:15:42 2014 +0000
@@ -0,0 +1,68 @@
+#pragma once
+
+template<class K,class T>
+class mymap {
+    struct mypair {
+        K first;
+        T second;
+    };
+public:
+    mymap() {
+        m_size = 0;
+    }
+    T& operator[](const K& key) {
+        int it;
+        if (count(key) == 0) {
+            it = insert(key, 0);
+        } else {
+            it = find(key);
+        }
+        return m_buf[it].second;
+    }
+    bool empty() { return m_size == 0 ? true : false; }
+    int size() { return m_size; }
+    void clear() { m_size = 0; }
+    int count(K key) {
+        for(int i = 0; i < m_size; i++) {
+            if (m_buf[i].first == key) {
+                return 1;
+            }
+        }
+        return 0;
+    }
+    K getKey(int index) {
+        return m_buf[index].first;
+    }
+
+private:
+    int find(K key) {
+        for(int i = 0; i < m_size; i++) {
+            if (m_buf[i].first == key) {
+                return i;
+            }
+        }
+        return -1;
+    }
+    int insert(K key, T value) {
+        int it = find(key);
+        if (it != -1) {
+            m_buf[it].second = value;
+            return it;
+        }
+        mypair* new_buf = new mypair[m_size+1];
+        if (m_size > 0) {
+            for(int i = 0; i < m_size; i++) {
+                new_buf[i] = m_buf[i];
+            }
+            delete[] m_buf;
+        }
+        m_buf = new_buf;
+        it = m_size++;
+        m_buf[it].first = key;
+        m_buf[it].second = value;
+        return it;
+    }
+
+    int m_size;
+    mypair *m_buf;
+};