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.
Revision 1:3a2023b0563c, committed 2016-10-14
- Comitter:
- stefkpl
- Date:
- Fri Oct 14 10:10:52 2016 +0000
- Parent:
- 0:392956e976ae
- Commit message:
- Test is OK
Changed in this revision
| FastPWM.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FastPWM.lib Fri Oct 14 10:10:52 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/FastPWM/#10e2e171f430
--- a/main.cpp Fri Oct 14 08:42:47 2016 +0000
+++ b/main.cpp Fri Oct 14 10:10:52 2016 +0000
@@ -1,26 +1,58 @@
+/***************************************************************************
+ DUMP I2C
+ +----------+
+Do an I2C Dump for testing.
+
+Fast PWM is use for dump ov7670 REG, I must have xclock for using I2C.
+You can remove them.
+
+Stéphane PEREZ (stefkpl)
+
+****************************************************************************/
+
#include "mbed.h"
+#include "FastPWM.h"
+
// Test DUMP I2C
-#define _ADDR (0x43)
+#define _ADDR (0x42)
+#define CAMERA_CLK_PERIOD .1// ==> 10Mhz 100nS
+#define VSYNC D9
I2C i2c(I2C_SDA, I2C_SCL);
DigitalOut myled(LED1);
-
+
+FastPWM __xclk(VSYNC);
+
Serial pc(SERIAL_TX, SERIAL_RX);
-
+char value;
+char cmd;
int main()
{
- int status = i2c.write(_ADDR);
+ __xclk.period_us(CAMERA_CLK_PERIOD);
+ __xclk.write(0.5);
+
pc.printf("Begin Scan\r\n");
+
+ for (char n=0; n<0xFF; n++){
+
+ i2c.write(_ADDR, &n, 1);
+ i2c.read(_ADDR, &value, 1);
+ pc.printf("addresse 0x%x \t- reg:0x%x \t- value:%d \t- 0x%X\r\n",_ADDR, n, value, value);
+
+ }
+ // because n cannot be upper than 0xFF on the loop, and I don't want use another ... ;-)
+ value = 0xFF;
+ i2c.write(_ADDR, &value, 1);
+ i2c.read(_ADDR, &value, 1);
+ pc.printf("addresse 0x%x \t- reg:0x%x \t- value:%d \t- 0x%X\r\n",_ADDR, 0xFF, value, value);
+
+ pc.printf("End Scan\r\n");
- // Read all register
- data_write[0] = LM75_REG_TEMP;
- i2c.write(LM75_ADDR, data_write, 1, 1); // no stop
- i2c.read(LM75_ADDR, data_read, 2, 0);
-
while (1) {
myled = !myled;
wait(0.2);
+ }
}