E-Paper Device (EPD) based MiniNote module, powered by mbed on LPC1114FBD48. Shared in public domain with enclosure in 3D step format, hardware interface compatible with microBUS interface. Anyone can contribute on this project.

Dependencies:   mbed _24LCXXX

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ssd1606.h"
00003 #include "_24LCXXX.h"
00004 #include "rom_image.h"
00005 //#include "eeprom.h"
00006 
00007 // Check mbed LPC1114 LPCXpresso board at mbed.org
00008 //  http://mbed.org/users/okano/notebook/pinout-picture/
00009 // Check LPCXpresso LPC1114 schematics at embeddedartists.com
00010 //  http://www.embeddedartists.com/sites/default/files/docs/schematics/LPCXpressoLPC1114revA.pdf
00011 
00012 // WARNING: xp5/xp6/xp7 (P0_9/P0_8/P2_11) are reserved for SPI
00013 // Check source code at github.com
00014 //  https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c
00015 
00016 // In LPC1114FN28, SPI uses dp2/dp1/dp6 (P0_9/P0_8/P0_6) with different SCK pin
00017 
00018 // naked LPC1114 on breadboard, install LED pin28, pasive piezo-buzzer pin1
00019 DigitalOut myled(dp28);  // LED ... P0_7 (pin 28)
00020 Serial uart(dp16, dp15); // UART .. P1_7: TX (pin 16), P1_6: RX (pin 15)
00021 //PwmOut pwm(dp1);         // PWM ... P0_8: CT16B0_MAT0 (pin1); sorry, blocking SPI!  
00022 
00023 // EPD interface: CS | RST | DC | BUSY | MOSI | SCK
00024 // Consider move P2_3 & P2_1 (xp37, xp13) for MOSI & SCK as 2nd SPI
00025 // Don't follow schematics from EA, since its silkscreen is wrong for SPI1
00026 //SSD1606 epd(P0_6,P0_7,P2_0,P1_5,P2_3,P2_1);
00027 SSD1606 epd(P0_6,P2_2,P2_0,P1_5,P2_3,P2_1);
00028 
00029 //SSD1606 epd(P0_6,P0_7,P2_0,P1_5,P1_11,P1_10);
00030 //SSD1606 epd2(xp23,xp11,xp12,xp21,xp38,xp39);
00031 
00032 
00033 I2C i2c(xp42, xp41);    // I2C ... P0_5: SDA, P0_4: SCL
00034 _24LCXXX nvmem(&i2c, 0x50);
00035 
00036 //enum EEPROM::TypeEeprom T24C256;
00037 //EEPROM nvmem(P0_5,P0_4,0xA0,T24C256);
00038 
00039 char c = '0';
00040 unsigned char sbuf[128];
00041 
00042 void setup()
00043 {
00044     
00045   //pwm.period(0.001);  // PWM period 1ms (1kHz)   
00046   uart.baud(115200);  // Baud rate
00047   //uart.puts("E-Badge MiniNote LPC1114 Demo Start.\n\r");
00048     //nvmem.write(0x10,0x55);
00049     epd.reset();
00050     epd.initialize();
00051     epd.rom_image(gImage_one);
00052     epd.set_command_between_images();
00053     wait(5);
00054     epd.rom_image(gImage_sushi);
00055     epd.set_command_between_images();
00056     wait(5);
00057 
00058     nvmem.byte_write(0,1);
00059     nvmem.byte_write(1,2);
00060     nvmem.byte_write(2,3);
00061     nvmem.byte_write(3,4);
00062     nvmem.nbyte_read(0x00,sbuf,16);
00063 
00064 
00065 }
00066 
00067 void loop()
00068 {
00069     /*
00070     myled = 0;  // LED on
00071     //pwm = 0.5;  // PWM duty cycle 50%, tone 1kHz
00072     wait(0.5);
00073     uart.putc(c++); if (c > '9') c = '0';  // Put Character & rotate 0,1,2,... 9
00074     myled = 1;  // LED off
00075     //pwm = 0;    // PWM stop, silent
00076     wait(0.5);
00077     */
00078     uart.putc(c++); if (c > '9') c = '0';  // Put Character & rotate 0,1,2,... 9
00079 }
00080 
00081 int main() {
00082     
00083     setup();
00084   while(1) {    // repeat (period 1sec)
00085         loop();
00086     }
00087 }