OV528 Camera Module Library

Revision:
1:06afc809909b
Parent:
0:3f9d7ef7266c
Child:
2:7a563410b23d
--- a/CameraOV528.h	Fri Jul 07 16:52:18 2017 +0000
+++ b/CameraOV528.h	Fri Jul 07 20:40:26 2017 +0000
@@ -22,9 +22,9 @@
 public:
     Camera(void) {};
     virtual ~Camera(void) {};
-    virtual void powerup(void) = 0;
-    virtual void powerdown(void) = 0;
-    virtual void take_picture(void) = 0;
+    virtual int powerup(void) = 0;
+    virtual int powerdown(void) = 0;
+    virtual int take_picture(void) = 0;
     virtual uint32_t get_picture_size(void) = 0;
     virtual uint32_t read_picture_data(uint8_t *data, uint32_t size) = 0;
 };
@@ -50,10 +50,10 @@
 
     CameraOV528(PinName rx, PinName tx);
     virtual ~CameraOV528(void);
-    virtual void powerup(void);
-    virtual void powerup(uint32_t baud);
-    virtual void powerdown(void);
-    virtual void take_picture(void);
+    virtual int powerup(void);
+    virtual int powerup(uint32_t baud);
+    virtual int powerdown(void);
+    virtual int take_picture(void);
     virtual uint32_t get_picture_size(void);
     virtual uint32_t read_picture_data(uint8_t *data, uint32_t size);
 
@@ -61,13 +61,16 @@
     void set_format(Format format);
     void set_baud(uint32_t baud);
 
+    void attach_debug_function(void (*func)(const char* fmt, ...));
+    int camera_error(const char* message);
+
 private:
 
     bool _init_sequence();
     void _set_baud(uint32_t baud);
     void _set_package_size(uint32_t size);
     void _set_fmt_and_res(Format fmt, Resolution res);
-    void _read_picture_block();
+    int _read_picture_block();
 
     void _rx_irq(void);
 
@@ -102,6 +105,8 @@
     uint32_t _read_buf_tail;
     uint32_t _read_wake_pos;
     Semaphore _read_sem;
+
+    void (*log_func)(const char* fmt, ...);
 };
 
 #endif