Encapsulates access to the Cypress CY14B101P nvSRAM module.
Diff: CY14B101P.cpp
- Revision:
- 2:50ca90120eb6
- Parent:
- 1:0f4063d68380
- Child:
- 4:e5c61356fb09
--- a/CY14B101P.cpp Mon Jul 11 17:08:39 2011 +0000 +++ b/CY14B101P.cpp Mon Jul 11 17:10:14 2011 +0000 @@ -1,3 +1,55 @@ +/* This library encapsulates (or will when completely implemented) + * all software functions for reading and writing to the Cypress Semiconductor + * CY14B101P nvSRAM module. + * + * As of July 11, 2011 RTC functions are not implemented. + * + * Author: Dr. Jeffrey Craighead + * Copyright 2011 + */ + +/** Example: + * @code + * #include "CY14B101P.h" + * #include "mbed.h" + * + * NVSRAM mem(p11,p12,p13,p14,40000000,8,0); + * Serial pc(USBTX,USBRX); + * + * int main() { + * static char myString[] = "A Test String!\r\n"; + * char readString[sizeof(myString)]; + * + * Timer s; //This timer is just to monitor read & write speed + * s.start(); + * s.reset(); + * + * mem.init(); + * while (true) { + * int start = s.read_us(); + * //Write bytes + * mem.writeBytes(myString,0,sizeof(myString)); + * int writeEnd = s.read_us(); + * + * //Read bytes + * mem.readBytes(readString,0,sizeof(readString)); + * int end = s.read_us(); + * + * //Print read bytes to Serial to verify correctness + * for (int i=0; i<sizeof(readString); i++) pc.printf("%c",readString[i]); + * pc.printf("\r\n"); + * pc.printf("Write completed in %d microsecs.\r\n",writeEnd-start); + * pc.printf("Read completed in %d microsecs.\r\n",end-writeEnd); + * pc.printf("Status byte: 0x%x\r\n",mem.readStatusRegister()); + * wait(0.5); + * } + *} + *@endcode + */ + + + + #include "CY14B101P.h" Serial pc_(USBTX,USBRX);