![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
reset camera Switch Sciencee 1160
Revision 0:dada4198c169, committed 2014-05-28
- Comitter:
- kyattonippu
- Date:
- Wed May 28 11:22:42 2014 +0000
- Commit message:
- init camera Switch Science 1160
Changed in this revision
diff -r 000000000000 -r dada4198c169 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed May 28 11:22:42 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r dada4198c169 camera.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camera.cpp Wed May 28 11:22:42 2014 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7 + + +Serial pc(USBTX, USBRX); // tx, rx +Serial device(p9, p10); // tx, rx + +char buf[] = "hello"; +char reset[] = {0x56, 0x00, 0x26, 0x00}; +int i_buf = 0; +int i_reset = 0; + +void pc_rx () { + char c = pc.getc(); + device.putc(c); + lcd.putc(c); +} + +void dev_rx () { + char c = device.getc(); + pc.putc(c); + lcd.putc(c); +} + +void pc_tx () { + pc.putc(buf[i_buf]); + i_buf++; + if (i_buf >= sizeof buf) { + pc.attach(NULL, Serial::TxIrq); + } +} + +void device_tx () { + device.putc(reset[i_reset]); + i_reset++; + lcd.putc('-'); + if (i_reset >= sizeof(reset)) { + device.attach(NULL, Serial::TxIrq); + } +} + +int main() { + device.baud(38400); + //pc.baud(9600); + + pc.attach(pc_rx, Serial::RxIrq); + //pc.attach(pc_tx, Serial::TxIrq); + + device.attach(dev_rx, Serial::RxIrq); + device.attach(device_tx, Serial::TxIrq); + + //lcd.putc('m'); + //pc.putc('m'); + device.putc('!'); + pc.readable(); + device.readable(); + wait(2.0); + lcd.printf("OK!\n"); + while(1); +}
diff -r 000000000000 -r dada4198c169 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed May 28 11:22:42 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file