a test program for my SPI_IS25LQ032B library. please set local-echo on for the terminal program.

Dependencies:   SPI_IS25LQ032B mbed vt100

At start up the program show the list of available commands

起動すると、使用出来るコマンドの一覧が表示されます。

/media/uploads/Rhyme/000_is25_startup.jpg

To see the contents of the first 256 bytes of memory, type

dump 0x00

最初の256バイトを表示させるのには dump 0x00 と入力してください。

/media/uploads/Rhyme/001_is25_dump_0x00.jpg

Let's write a value 0xA5 to address 0x10

write 0x10 0xA5

Then see the result with

dump 0x00

先ず、アドレス 0x10 に 0xA5 を書き込みます。 write 0x10 0xA5

その結果を再度 dump 0x00 コマンドで表示させると

/media/uploads/Rhyme/002_is25_write_read_dump.jpg

To erase the entire memory, use command

cer

メモリ全体を初期化するのには cer コマンドを使用してください。

/media/uploads/Rhyme/003_is25_cer_dump.jpg

Revision:
2:05ddb1d95e2a
Parent:
1:c92b1fb10573
diff -r c92b1fb10573 -r 05ddb1d95e2a main.cpp
--- a/main.cpp	Tue Mar 28 00:48:14 2017 +0000
+++ b/main.cpp	Tue Mar 28 01:24:40 2017 +0000
@@ -1,20 +1,24 @@
 #include <ctype.h>
 #include "mbed.h"
-#include "serial_api.h"
+// #include "serial_api.h"
+#include "vt100.h"
 #include "SPI_IS25LQ032B.h"
 
+vt100 *tty = 0 ;
+
 // SPI_IS25LQ032B(PinName mosi, PinName miso, PinName sclk, PinName cs) ;
-// FRDM_KL25Z
-// D13 SPI0_SCK  (PTD1)
-// D12 SPI0_MISO (PTD3) 
-// D11 SPI0_MOSI (PTD2)
-// D10 SPI0_PCS0 (PTD0)
-#if FRDM_KL25Z
-SPI_IS25LQ032B spi_mem(PTD2, PTD3, PTD1, PTD0) ;
+#if defined (TARGET_KL25Z)
+#define SPI1_SCLK PTD1
+#define SPI1_MISO PTD3
+#define SPI1_MOSI PTD2
+#define SPI1_PCS0 PTD0
+#elif defined (TARGET_K22F) 
+#define SPI1_SCLK PTD5
+#define SPI1_MISO PTD7
+#define SPI1_MOSI PTD6
+#define SPI1_PCS0 PTC0
 #endif
-#if FSHAFT_II
-SPI_IS25LQ032B spi_mem(PTD5, PTD7, PTD6, PTC0) ;
-#endif
+SPI_IS25LQ032B spi_mem(SPI1_MOSI, SPI1_MISO, SPI1_SCLK, SPI1_PCS0) ;
 
 void usage(void)
 {
@@ -70,8 +74,10 @@
     unsigned long address = 0 ;
     unsigned char data[256] ;
     
-   extern serial_t stdio_uart ;
-   serial_baud(&stdio_uart, 115200) ;
+//   extern serial_t stdio_uart ;
+//   serial_baud(&stdio_uart, 115200) ;
+    tty = new vt100() ;
+    tty->cls() ;
     
     printf("\n\r============================\n\r") ;
     printf("IS25LQ032B test program\n\r") ;