C++ API Reference
- Author
Arducam
- Date
2023/3/3
- Version
V2.0.1
- Copyright
Arducam
-
class Arducam_Mega
- #include <Arducam_Mega.h>
Arducam Mega Class.
Public Functions
-
Arducam_Mega(int cs)
Constructor of camera class.
- Parameters:
cs – enable pin
-
CamStatus begin(void)
Initialize the configuration of the camera module.
- Returns:
Return operation status
-
CamStatus takePicture(CAM_IMAGE_MODE mode, CAM_IMAGE_PIX_FMT pixel_format)
Start a snapshot with specified resolution and pixel format.
Note
The mode parameter must be the resolution which the current camera supported
- Parameters:
mode – Resolution of the camera module
pixel_format – Output image pixel format,which supports JPEG, RGB, YUV
- Returns:
Return operation status
-
CamStatus takeMultiPictures(CAM_IMAGE_MODE mode, CAM_IMAGE_PIX_FMT pixel_format, uint8_t number)
Start multi capture with specified number of image.
Note
The mode parameter must be the resolution which the current camera supported
- Parameters:
mode – Resolution of the camera module
pixel_format – Output image pixel format,which supports JPEG, RGB, YUV
number – Number of pictures taken
- Returns:
Return operation status
-
CamStatus startPreview(CAM_VIDEO_MODE mode)
Start preview with specified resolution mode.
Note
Before calling this function, you need to register the callback function.The default image pixel format is JPEG
- Parameters:
mode – Resolution of the camera module
- Returns:
Return operation status
-
void captureThread(void)
The camera’s stream processing thread.
-
CamStatus setAutoExposure(uint8_t val)
Set the exposure mode.
- Parameters:
val –
0
Turn on automatic exposure1
Turn off automatic exposure- Returns:
Return operation status
-
CamStatus setAbsoluteExposure(uint32_t val)
Set the exposure time Manually.
Note
Before calling this function, you need to turn off the auto exposure function
- Parameters:
val – Value of exposure line
- Returns:
Return operation status
-
CamStatus setAutoISOSensitive(uint8_t val)
Set the gain mode.
- Parameters:
val –
0
turn on automatic gain1
turn off automatic gain- Returns:
Return operation status
-
CamStatus setISOSensitivity(int val)
Set the gain time Manually.
Note
Before calling this function, you need to turn off the auto gain function
- Parameters:
val – Value of gain
- Returns:
Return operation status
-
CamStatus setAutoWhiteBalance(uint8_t val)
Set white balance mode.
- Parameters:
val –
0
turn on automatic white balance1
turn off automatic white balance- Returns:
Return operation status
-
CamStatus setAutoWhiteBalanceMode(CAM_WHITE_BALANCE mode)
Set the white balance mode Manually.
- Parameters:
mode – White balance mode
- Returns:
Return operation status
-
CamStatus setColorEffect(CAM_COLOR_FX effect)
Set special effects.
- Parameters:
effect – Special effects mode
- Returns:
Return operation status
-
CamStatus setAutoFocus(uint8_t val)
Set auto focus mode.
Note
Only
5MP
cameras support auto focus control- Parameters:
val – mode of autofocus
- Returns:
Return operation status
-
CamStatus setSaturation(CAM_STAURATION_LEVEL level)
Set saturation level.
- Parameters:
level – Saturation level
- Returns:
Return operation status
-
CamStatus setEV(CAM_EV_LEVEL level)
Set EV level.
- Parameters:
level – EV level
- Returns:
Return operation status
-
CamStatus setContrast(CAM_CONTRAST_LEVEL level)
Set Contrast level.
- Parameters:
level – Contrast level
- Returns:
Return operation status
-
CamStatus setBrightness(CAM_BRIGHTNESS_LEVEL level)
Set Brightness level.
- Parameters:
level – Brightness level
- Returns:
Return operation status
-
CamStatus setSharpness(CAM_SHARPNESS_LEVEL level)
Set Sharpness level.
Note
Only
3MP
cameras support sharpness control- Parameters:
level – Sharpness level
- Returns:
Return operation status
-
CamStatus setImageQuality(IMAGE_QUALITY qualtiy)
Set jpeg image quality.
- Parameters:
qualtiy – Image Quality
- Returns:
Return operation status
-
uint8_t readBuff(uint8_t*, uint8_t)
Read image data with specified length to buffer.
Note
Transmission length should be less than
255
- Parameters:
buff – Buffer for storing camera data
length – The length of the available data to be read
- Returns:
Returns the length actually read
-
uint8_t readByte(void)
Read a byte from FIFO.
Note
Before calling this function, make sure that the data is available in the buffer
- Returns:
Returns Camera data
-
void debugWriteRegister(uint8_t*)
Debug mode.
- Parameters:
buff – There are four bytes of buff Byte 1 indicates the device address, Byte 2 indicates the high octet of the register, Byte 3 indicates the low octet of the register, and Byte 4 indicates the value written to the register
-
void registerCallBack(BUFFER_CALLBACK, uint8_t, STOP_HANDLE)
Create callback function.
Note
Transmission length should be less than
255
- Parameters:
function – Callback function name
blockSize – The length of the data transmitted by the callback function at one time
handle – stop function Callback function name
-
void lowPowerOn(void)
Turn on low power mode.
-
void lowPowerOff(void)
Turn off low power mode.
-
uint32_t getTotalLength(void)
Get the length of the picture.
- Returns:
Return the length of the picture
-
uint32_t getReceivedLength(void)
Get the length of the unread image.
- Returns:
Returns the length of the unread image
-
ArducamCamera *getCameraInstance(void)
return a camera instance
- Returns:
Return a ArducamCamera instance
Private Members
-
ArducamCamera cameraInfo
Camera drive interface and information.
-
Arducam_Mega(int cs)