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.
E-Badge MiniNote Project on mbed/NXP LPC1114 platform
- About E-Badge MiniNote Project
- E-Badge Firmware Design
- Enclosure ID in 3D step format
- Python utilities
- Demo applications
- New applications with cloud server
- make mbed looks Arduino compatible
- debug in Keil, shared with mbed
- make it bigger with more memory
- make it smaller with mini connector
- make it stronger with mikroBUS
- Make it pretty with line art
- Developement Status Update
main.cpp@3:1fa000d4da94, 2014-06-11 (annotated)
- Committer:
- allankliu
- Date:
- Wed Jun 11 09:12:36 2014 +0000
- Revision:
- 3:1fa000d4da94
- Parent:
- 2:bb9f154ea2f4
Demo tested on hardware.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
allankliu | 0:33994cfad0c2 | 1 | #include "mbed.h" |
allankliu | 0:33994cfad0c2 | 2 | #include "ssd1606.h" |
allankliu | 2:bb9f154ea2f4 | 3 | #include "_24LCXXX.h" |
allankliu | 2:bb9f154ea2f4 | 4 | #include "rom_image.h" |
allankliu | 3:1fa000d4da94 | 5 | //#include "eeprom.h" |
allankliu | 0:33994cfad0c2 | 6 | |
allankliu | 3:1fa000d4da94 | 7 | // Check mbed LPC1114 LPCXpresso board at mbed.org |
allankliu | 3:1fa000d4da94 | 8 | // http://mbed.org/users/okano/notebook/pinout-picture/ |
allankliu | 3:1fa000d4da94 | 9 | // Check LPCXpresso LPC1114 schematics at embeddedartists.com |
allankliu | 3:1fa000d4da94 | 10 | // http://www.embeddedartists.com/sites/default/files/docs/schematics/LPCXpressoLPC1114revA.pdf |
allankliu | 3:1fa000d4da94 | 11 | |
allankliu | 3:1fa000d4da94 | 12 | // WARNING: xp5/xp6/xp7 (P0_9/P0_8/P2_11) are reserved for SPI |
allankliu | 3:1fa000d4da94 | 13 | // Check source code at github.com |
allankliu | 3:1fa000d4da94 | 14 | // https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c |
allankliu | 3:1fa000d4da94 | 15 | |
allankliu | 3:1fa000d4da94 | 16 | // In LPC1114FN28, SPI uses dp2/dp1/dp6 (P0_9/P0_8/P0_6) with different SCK pin |
allankliu | 0:33994cfad0c2 | 17 | |
allankliu | 0:33994cfad0c2 | 18 | // naked LPC1114 on breadboard, install LED pin28, pasive piezo-buzzer pin1 |
allankliu | 0:33994cfad0c2 | 19 | DigitalOut myled(dp28); // LED ... P0_7 (pin 28) |
allankliu | 0:33994cfad0c2 | 20 | Serial uart(dp16, dp15); // UART .. P1_7: TX (pin 16), P1_6: RX (pin 15) |
allankliu | 2:bb9f154ea2f4 | 21 | //PwmOut pwm(dp1); // PWM ... P0_8: CT16B0_MAT0 (pin1); sorry, blocking SPI! |
allankliu | 0:33994cfad0c2 | 22 | |
allankliu | 3:1fa000d4da94 | 23 | // EPD interface: CS | RST | DC | BUSY | MOSI | SCK |
allankliu | 3:1fa000d4da94 | 24 | // Consider move P2_3 & P2_1 (xp37, xp13) for MOSI & SCK as 2nd SPI |
allankliu | 3:1fa000d4da94 | 25 | // Don't follow schematics from EA, since its silkscreen is wrong for SPI1 |
allankliu | 3:1fa000d4da94 | 26 | //SSD1606 epd(P0_6,P0_7,P2_0,P1_5,P2_3,P2_1); |
allankliu | 3:1fa000d4da94 | 27 | SSD1606 epd(P0_6,P2_2,P2_0,P1_5,P2_3,P2_1); |
allankliu | 0:33994cfad0c2 | 28 | |
allankliu | 3:1fa000d4da94 | 29 | //SSD1606 epd(P0_6,P0_7,P2_0,P1_5,P1_11,P1_10); |
allankliu | 3:1fa000d4da94 | 30 | //SSD1606 epd2(xp23,xp11,xp12,xp21,xp38,xp39); |
allankliu | 2:bb9f154ea2f4 | 31 | |
allankliu | 3:1fa000d4da94 | 32 | |
allankliu | 3:1fa000d4da94 | 33 | I2C i2c(xp42, xp41); // I2C ... P0_5: SDA, P0_4: SCL |
allankliu | 2:bb9f154ea2f4 | 34 | _24LCXXX nvmem(&i2c, 0x50); |
allankliu | 0:33994cfad0c2 | 35 | |
allankliu | 2:bb9f154ea2f4 | 36 | //enum EEPROM::TypeEeprom T24C256; |
allankliu | 3:1fa000d4da94 | 37 | //EEPROM nvmem(P0_5,P0_4,0xA0,T24C256); |
allankliu | 2:bb9f154ea2f4 | 38 | |
allankliu | 2:bb9f154ea2f4 | 39 | char c = '0'; |
allankliu | 2:bb9f154ea2f4 | 40 | unsigned char sbuf[128]; |
allankliu | 0:33994cfad0c2 | 41 | |
allankliu | 3:1fa000d4da94 | 42 | void setup() |
allankliu | 3:1fa000d4da94 | 43 | { |
allankliu | 3:1fa000d4da94 | 44 | |
allankliu | 3:1fa000d4da94 | 45 | //pwm.period(0.001); // PWM period 1ms (1kHz) |
allankliu | 3:1fa000d4da94 | 46 | uart.baud(115200); // Baud rate |
allankliu | 3:1fa000d4da94 | 47 | //uart.puts("E-Badge MiniNote LPC1114 Demo Start.\n\r"); |
allankliu | 2:bb9f154ea2f4 | 48 | //nvmem.write(0x10,0x55); |
allankliu | 3:1fa000d4da94 | 49 | epd.reset(); |
allankliu | 2:bb9f154ea2f4 | 50 | epd.initialize(); |
allankliu | 2:bb9f154ea2f4 | 51 | epd.rom_image(gImage_one); |
allankliu | 3:1fa000d4da94 | 52 | epd.set_command_between_images(); |
allankliu | 3:1fa000d4da94 | 53 | wait(5); |
allankliu | 3:1fa000d4da94 | 54 | epd.rom_image(gImage_sushi); |
allankliu | 3:1fa000d4da94 | 55 | epd.set_command_between_images(); |
allankliu | 3:1fa000d4da94 | 56 | wait(5); |
allankliu | 2:bb9f154ea2f4 | 57 | |
allankliu | 2:bb9f154ea2f4 | 58 | nvmem.byte_write(0,1); |
allankliu | 2:bb9f154ea2f4 | 59 | nvmem.byte_write(1,2); |
allankliu | 2:bb9f154ea2f4 | 60 | nvmem.byte_write(2,3); |
allankliu | 2:bb9f154ea2f4 | 61 | nvmem.byte_write(3,4); |
allankliu | 3:1fa000d4da94 | 62 | nvmem.nbyte_read(0x00,sbuf,16); |
allankliu | 3:1fa000d4da94 | 63 | |
allankliu | 3:1fa000d4da94 | 64 | |
allankliu | 0:33994cfad0c2 | 65 | } |
allankliu | 0:33994cfad0c2 | 66 | |
allankliu | 3:1fa000d4da94 | 67 | void loop() |
allankliu | 3:1fa000d4da94 | 68 | { |
allankliu | 3:1fa000d4da94 | 69 | /* |
allankliu | 3:1fa000d4da94 | 70 | myled = 0; // LED on |
allankliu | 3:1fa000d4da94 | 71 | //pwm = 0.5; // PWM duty cycle 50%, tone 1kHz |
allankliu | 3:1fa000d4da94 | 72 | wait(0.5); |
allankliu | 3:1fa000d4da94 | 73 | uart.putc(c++); if (c > '9') c = '0'; // Put Character & rotate 0,1,2,... 9 |
allankliu | 3:1fa000d4da94 | 74 | myled = 1; // LED off |
allankliu | 3:1fa000d4da94 | 75 | //pwm = 0; // PWM stop, silent |
allankliu | 3:1fa000d4da94 | 76 | wait(0.5); |
allankliu | 3:1fa000d4da94 | 77 | */ |
allankliu | 3:1fa000d4da94 | 78 | uart.putc(c++); if (c > '9') c = '0'; // Put Character & rotate 0,1,2,... 9 |
allankliu | 0:33994cfad0c2 | 79 | } |
allankliu | 0:33994cfad0c2 | 80 | |
allankliu | 0:33994cfad0c2 | 81 | int main() { |
allankliu | 3:1fa000d4da94 | 82 | |
allankliu | 0:33994cfad0c2 | 83 | setup(); |
allankliu | 0:33994cfad0c2 | 84 | while(1) { // repeat (period 1sec) |
allankliu | 0:33994cfad0c2 | 85 | loop(); |
allankliu | 3:1fa000d4da94 | 86 | } |
allankliu | 0:33994cfad0c2 | 87 | } |