Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ov7670class
Revision 0:21c8b8b4abbe, committed 2018-01-27
- Comitter:
- tomislavoctenjak
- Date:
- Sat Jan 27 16:17:58 2018 +0000
- Child:
- 1:8ad6f9c44937
- Commit message:
- REV1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jan 27 16:17:58 2018 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include "ov7670s.h"
+
+OV7670 camera(
+ D14, D15, // SDA,SCL(I2C / SCCB)
+ D9,D8,D10, // VSYNC,HREF,pcclk
+ D7,D6,D5,D4,D3,D2,D1,D0,
+ A5) ; // RRST
+
+Serial pc(USBTX,USBRX);
+
+#define SIZEX (160)
+#define SIZEY (120)
+#define SIZE 19200
+
+unsigned char bank0 [SIZE];
+unsigned char *bank1 = (unsigned char *)(0x2007C000);
+
+int main()
+{
+
+
+
+ // Reset camera on power up
+ camera.Reset() ;
+
+ // Set up for 160*120 pixels RGB565
+ camera.InitQQVGA() ;
+
+ // Print message to screen
+ pc.printf("Hit Any Key to stop RGBx160x120 Capture Data.\r\n");
+
+ // Kick things off by capturing an image
+ camera.CaptureNext() ;
+ while (camera.CaptureDone() == false) ;
+
+ // Now enter the main loop
+ while (!pc.readable()) {
+
+ // Start reading in the image data from the camera hardware buffer
+ camera.ReadStart();
+
+ // Read in the first half of the image
+ for (int i = 0; i < SIZE; i++) {
+ bank0[i] = camera.ReadOneByte();
+ }
+
+ // Read in the second half of the image
+ for (int i = 0; i < SIZE ; i++) {
+ bank1[i] = camera.ReadOneByte();
+ }
+
+ // Stop reading the image
+ camera.ReadStop() ;
+
+ // Immediately request the next image to be captured (takes around 45ms)
+ camera.CaptureNext() ;
+
+ // Use this time to display the image on the screen
+ // Display the top half
+ TFT.Bitmap(0,0,160,60,bank1);
+ // Display the bottom half
+ TFT.Bitmap(0,60,160,60,bank0);
+
+ /* Note: we still have around 15ms left here to do other stuff */
+
+ // Now wait for the image to finish being captured
+ while (camera.CaptureDone() == false) ;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 27 16:17:58 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ov7670s.lib Sat Jan 27 16:17:58 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/tomislavoctenjak/code/ov7670class/#f67558570689