code for taking image and saving to SD card
Dependencies: SDFileSystem mbed
Diff: main.cpp
- Revision:
- 2:2b3a04c086da
- Parent:
- 1:43abfc6827c6
- Child:
- 3:2f9cbbda52e8
--- a/main.cpp Tue Mar 10 21:18:45 2015 +0000 +++ b/main.cpp Wed Mar 11 05:09:18 2015 +0000 @@ -111,14 +111,15 @@ <5> 0xAE : 128000 <6> 0x56 : 256000 *************************************/ -void SetBaudRateCmd(char baudrate) +void SetBaudRateCmd(char baudrateHigh, char baudrateLow) { cam.putc(0x56); cam.putc(ZERO); cam.putc(0x24); cam.putc(0x03); cam.putc(0x01); - cam.putc(baudrate); + cam.putc(baudrateHigh); + cam.putc(baudrateLow); } void SendTakePhotoCmd() @@ -164,21 +165,29 @@ int main(void) { - pc.baud(115200); // for PC terminal display/communications + pc.baud(128000); // for PC terminal display/communications pc.printf("\n\rStarting...\n\r"); // cam.attach(&cam_Rx_interrupt, Serial::RxIrq); // attach ISR to cam UART recieve uint8_t a[32]; int j, count, ii; - cam.baud(115200); + cam.baud(38400); wait(0.200); SendResetCmd();//Wait 2-3 second to send take picture command wait(2.000); - SetBaudRateCmd(0x2A); + // baud bytes = ((27E6 / baudrate) * 16 ) - 256 + // 0x2A, 0xF2 = 38400 + // 0x1C, 0x4C = 57600 + // 0x0D, 0xA6 = 115200 + // 0x0C, 0x2F = 128000 ??? (0xAE from DS) ??? + // 0x56, 0x = 256000 ??? (0x56 from DS) + SetBaudRateCmd(0x0D, 0xA6); wait(0.100); - cam.baud(38400); + cam.baud(115200); wait(0.100); + // 0x22 = 160*120, 0x11 = 320*240, 0x00 = 640*480, 0x1D = 800*600 + // 0x1C = 1024*768, 0x1B = 1280*960, 0x21 = 1600*1200 SetImageSizeCmd(0x00); wait(0.100); SendTakePhotoCmd();