Skip to content

SDK API

There are a set of API functions that issue different commands to ArduCAM shield.

1. void InitCAM (void)


InitCAM function initializes the hardware information of the user system, such as the SPI chip select port initialization and image sensor slave address initialization.

2. void flush_fifo (void)


flash fifo function is used to reset the fifo read pointer to ZERO.

3. void start_capture (void)


start_capture function is used to issue a capture command. After this command the ArduCAM hardware will wait for a start of a new frame then store the entire frame data to onboard frame buffer.

4. void clear_fifo_flag (void)


Once a frame image is buffed to onboard memory, the capture completion flag is asserted automatically. The clear_fifo_flag function is used to clear this flag before issuing next capture command.

5. void write_reg(uint8_t addr, uint8_t data)


Param1: ArduChip register address (or command code)

Param2: data to be written into the register

write_reg is a basic function to write the ArduChip internal registers.

6. uint8_t read_reg(uint8_t addr)


Param1: ArduChip register address (or command code)

read_reg is a basic function to read ArduChip internal register value.

7. uint32_t read_fifo_length(void)


Return value: 32 bit length of captured image

read_fifo_length function is used to determine the length of current captured image. Note the Rev.C shield doesn’t support this feature.

8. void set_fifo_burst(void)


set_fifo_burst function is used to set the read memory into burst read mode. It should be called before burst memory read operation. Note the Rev.C shield doesn’t support this feature.

9. int wrSensorRegs8_8(const struct sensor_reg*)


Param1: sensor setting data array

Return value: error status

wrSensorRegs8_8 function is used to write array of settings into sensor’s internal register over I2C interface and sensor’s register is accessed with 8bit address and 8bit data.

10. int wrSensorRegs8_16(const struct sensor_reg*)


Param1: sensor setting data array

Return value: error status

wrSensorRegs8_16 function is used to write array of settings into sensor’s internal register over I2C interface and sensor’s register is accessed with 8bit address and 16bit data.

11. int wrSensorRegs16_8(const struct sensor_reg*)


Param1: sensor setting data array

Return value: error status

wrSensorRegs16_8 function is used to write array of settings into sensor’s internal register over I2C interface and sensor’s register is accessed with 16bit address and 8bit data.

12. int wrSensorRegs16_16(const struct sensor_reg*)


Param1: sensor setting data array

Return value: error status

wrSensorRegs16_16 function is used to write array of settings into sensor’s internal register over I2C interface and sensor’s register is accessed with 16bit address and 16bit data.

13. byte wrSensorReg8_8(int regID, int regDat)


Param1: sensor internal register address

Param2: value to be written into the register

Return value: error status

wrSensorReg8_8 function is used to write a single sensor’s internal register over I2C interface and sensor’s register is accessed with 8bit address and 8bit data.

14. byte wrSensorReg8_16(int regID, int regDat)


Param1: sensor internal register address

Param2: value to be written into the register

Return value: error status

wrSensorReg8_16 function is used to write a single sensor’s internal register over I2C interface and sensor’s register is accessed with 8bit address and 16bit data.

15. byte wrSensorReg16_8(int regID, int regDat)


Param1: sensor internal register address

Param2: value to be written into the register

Return value: error status

wrSensorReg16_8 function is used to write a single sensor’s internal register over I2C interface and sensor’s register is accessed with 16bit address and 8bit data.

16. byte wrSensorReg16_16(int regID, int regDat)


Param1: sensor internal register address

Param2: value to be written into the register

Return value: error status

wrSensorReg16_16 function is used to write a single sensor’s internal register over I2C interface and sensor’s register is accessed with 16bit address and 16bit data.

17. byte rdSensorReg8_8(uint8_t regID, uint8_t* regDat)


Param1: sensor internal register address

Param2: value read from the register

Return value: error status

rdSensorReg8_8 function is used to read a single sensor’s internal register value over I2C interface and sensor’s register is accessed with 8bit address and 8bit data.

18. byte rdSensorReg16_8(uint16_t regID, uint8_t* regDat)


Param1: sensor internal register address

Param2: value read from the register

Return value: error status

rdSensorReg16_8 function is used to read a single sensor’s internal register value over I2C interface and sensor’s register is accessed with 16bit address and 8bit data.

19. byte rdSensorReg8_16(uint8_t regID, uint16_t* regDat)


Param1: sensor internal register address

Param2: value read from the register

Return value: error status

rdSensorReg8_16 function is used to read a single sensor’s internal register value over I2C interface and sensor’s register is accessed with 8bit address and 8bit data.

20. byte rdSensorReg16_16(uint16_t regID, uint16_t* regDat)


Param1: sensor internal register address

Param2: value read from the register

Return value: error status

rdSensorReg16_16 function is used to read a single sensor’s internal register value over I2C interface and sensor’s register is accessed with 16bit address and 16bit data.

21. void OV2640_set_JPEG_size(uint8_t size)


Param1: resolution code

OV2640_set_JPEG_size function is used to set the desired resolution with JPEG format for OV2640. Current support resolution is shown as follows:

Sensor_Res No. Resolution
#define OV2640_160x120 0 //160x120
#define OV2640_176x144 1 //176x144
#define OV2640_320x240 2 //320x240
#define OV2640_352x288 3 //352x288
#define OV2640_640x480 4 //640x480
#define OV2640_800x600 5 //800x600
#define OV2640_1024x768 6 //1024x768
#define OV2640_1280x1024 7 //1280x1024
#define OV2640_1600×1200 8 //1600×1200

22. void OV5642_set_JPEG_size(uint8_t size)


Param1: resolution code

OV5642_set_JPEG_size function is used to set the desired resolution with JPEG format for OV5642. Current support resolution is shown as follows:

Sensor_Res No. Resolution
#define OV5642_320x240 0 //320×240
#define OV5642_640×480 1 //640×480
#define OV5642_1024x768 2 //1024x768
#define OV5642_1280x960 3 //1280x960
#define OV5642_1600x1200 4 //1600x1200
#define OV5642_2048x1536 5 //2048x1536
#define OV5642_2592x1944 6 //2592x1944

23. void OV5640_set_JPEG_size(uint8_t size)


Param1: resolution code

OV5640_set_JPEG_size function is used to set the desired resolution with JPEG format for OV564. Current support resolution is shown as follows:

Sensor_Res No. Resolution
#define OV5640_320x240 0 //320×240
#define OV5640_352x288 1 //352×288
#define OV5640_640x480 2 //640×480
#define OV5640_800x480 3 //800×480
#define OV5640_1024x768 4 //1024×768
#define OV5640_1280x960 5 //1280×960
#define OV5640_1600x1200 6 //1600×1200
#define OV5640_2048x1536 7 //2048×1536
#define OV5640_2592x1944 8 //2592×1944

24. void set_format(byte fmt)


set_format function is used to set the sensor between RGB mode and JPEG mode. The InitCAM function should be called after set_format function.