You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/Camera/src/camera.h
+146-3Lines changed: 146 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@
21
21
* @brief Header file for the Arduino Camera library.
22
22
*
23
23
* This library allows capturing pixels from supported cameras on Arduino products.
24
-
* Supported cameras: OV7670, Himax HM0360, and GC2145.
24
+
* Supported cameras: OV7670, HM0360, HM01B0, and GC2145.
25
25
* The pixels are returned in a frame buffer from which frames can be retrieved continuously.
26
26
*/
27
27
@@ -153,28 +153,158 @@ class FrameBuffer {
153
153
typedefvoid (*md_callback_t)();
154
154
155
155
156
+
/**
157
+
* @class ImageSensor
158
+
* @brief Abstract base class for image sensor drivers.
159
+
*/
156
160
classImageSensor {
157
161
public:
158
162
virtual~ImageSensor() { }
163
+
164
+
/**
165
+
* @brief Initialize the image sensor.
166
+
* This prepares the sensor for capturing frames by setting the registers to their default values.
167
+
* @return int 0 on success, non-zero on failure
168
+
*/
159
169
virtualintinit() = 0;
170
+
171
+
/**
172
+
* @brief Reset the image sensor.
173
+
* The effect differs between the camera models.
174
+
* It has no effect on the GC2145. On the OV7670, it resets all configuration registers to the default values.
175
+
* On HM0360 and HM01B0 the registers are reset to the defaults. The camera also enters Standby Mode, where there is no video output and the power consumption is lowered.
176
+
* @return int 0 on success, non-zero on failure
177
+
*/
160
178
virtualintreset() = 0;
179
+
180
+
/**
181
+
* @brief Get the I2C address of the image sensor.
182
+
* @return int The sensor ID
183
+
*/
161
184
virtualintgetID() = 0;
185
+
186
+
/**
187
+
* @brief Check if the image sensor is monochrome aka grayscale.
188
+
*
189
+
* @return true If the sensor is monochrome
190
+
* @return false Otherwise
191
+
*/
162
192
virtualboolgetMono() = 0;
193
+
194
+
/**
195
+
* @brief Get the clock frequency of the image sensor.
196
+
*
197
+
* @return uint32_t The clock frequency in Hz
198
+
*/
163
199
virtualuint32_tgetClockFrequency() = 0;
200
+
201
+
/**
202
+
* @brief Set the frame rate of the image sensor.
203
+
* @note This has no effect on cameras that do not support variable frame rates.
204
+
* @param framerate The desired frame rate in frames per second
205
+
* @return int 0 on success, non-zero on failure
206
+
*/
164
207
virtualintsetFrameRate(int32_t framerate) = 0;
208
+
209
+
/**
210
+
* @brief Set the resolution of the image sensor.
211
+
* @note This has no effect on cameras that do not support variable resolutions.
212
+
* @param resolution The desired resolution, as defined in the resolution enum
213
+
* @return int 0 on success, non-zero on failure
214
+
*/
165
215
virtualintsetResolution(int32_t resolution) = 0;
216
+
217
+
/**
218
+
* @brief Set the pixel (color) format of the image sensor.
219
+
* @note This has no effect on cameras that do not support variable pixel formats.
220
+
* e.g. the Himax HM01B0 only supports grayscale.
221
+
* @param pixelformat The desired pixel format, as defined in the pixel format enum
0 commit comments