mirror of
https://github.com/aprochazka/ProfilometerProbe.git
synced 2025-06-30 17:47:20 +02:00
720p resolution
This commit is contained in:
@ -120,75 +120,43 @@ void Cam_I2C_write_bulk(I2C_HandleTypeDef *hi2c, const struct sensor_reg regList
|
||||
|
||||
void Cam_Init(I2C_HandleTypeDef *hi2c, SPI_HandleTypeDef *hspi)
|
||||
{
|
||||
Cam_SPI_write(hspi, 0x07, 0x80);
|
||||
Cam_SPI_write(hspi, 0x07, 0x80);
|
||||
HAL_Delay(100);
|
||||
Cam_SPI_write(hspi, 0x07, 0x00);
|
||||
Cam_SPI_write(hspi, 0x07, 0x00);
|
||||
HAL_Delay(100);
|
||||
|
||||
//Cam_SPI_write(hspi, 0x00, 0x55);
|
||||
HAL_Delay(5);
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3008, 0x80);
|
||||
HAL_Delay(5);
|
||||
Cam_I2C_write_bulk(hi2c, OV5642_QVGA_Preview);
|
||||
HAL_Delay(200);
|
||||
Cam_I2C_write_bulk(hi2c, OV5642_JPEG_Capture_QSXGA);
|
||||
Cam_I2C_write_bulk(hi2c, ov5642_320x240);
|
||||
HAL_Delay(100);
|
||||
//Cam_I2C_write_bulk(hi2c, OV5642_720P_Video_setting);
|
||||
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3818, 0xa8); // TIMING CONTROL - ENABLE COMPRESSION, THUMBNAIL MODE DISABLE, VERTICAL FLIP, MIRROR
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3621, 0x10); // REGISTER FOR CORRECT MIRROR FUNCTION
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3801, 0xb0); // TIMING HORIZONTAL START - ALSO FOR MIRROR
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x4407, 0x04); // COMPRESSION CONTROL
|
||||
//Cam_I2C_write(hi2c, (uint16_t)0x5000, 0xFF);
|
||||
HAL_Delay(5);
|
||||
// Setup camera, H-sync: High, V-sync:high, Sensor_delay: no Delay, FIFO_mode:FIFO enabled, power_mode:Low_power
|
||||
Cam_SPI_write(hspi, 0x03, 0x02);
|
||||
HAL_Delay(5);
|
||||
//Cam_I2C_write_bulk(hi2c, ov5642_1024x768);
|
||||
Cam_I2C_write_bulk(hi2c, ov5642_320x240);
|
||||
HAL_Delay(1000);
|
||||
Cam_SPI_write(hspi, 0x04, 0x01);
|
||||
HAL_Delay(5);
|
||||
Cam_SPI_write(hspi, 0x01, 0x00); // Capture Control Register - Set to capture n+1 frames
|
||||
HAL_Delay(5);
|
||||
/*
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3008, 0x80);
|
||||
|
||||
Cam_I2C_write_bulk(hi2c, OV5642_QVGA_Preview);
|
||||
|
||||
HAL_Delay(100);
|
||||
|
||||
HAL_Delay(200);
|
||||
Cam_I2C_write_bulk(hi2c, OV5642_JPEG_Capture_QSXGA);
|
||||
Cam_I2C_write_bulk(hi2c, ov5642_1024x768);
|
||||
|
||||
//Cam_I2C_write_bulk(hi2c, ov5642_320x240);
|
||||
|
||||
HAL_Delay(100);
|
||||
|
||||
//Cam_I2C_write_bulk(hi2c, OV5642_720P_Video_setting);
|
||||
|
||||
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3818, 0xa8); // TIMING CONTROL - ENABLE COMPRESSION, THUMBNAIL MODE DISABLE, VERTICAL FLIP, MIRROR
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3621, 0x10); // REGISTER FOR CORRECT MIRROR FUNCTION
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x3801, 0xb0); // TIMING HORIZONTAL START - ALSO FOR MIRROR
|
||||
//Cam_I2C_write(hi2c, (uint16_t)0x4407, 0x04); // COMPRESSION CONTROL
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x4407, 0x04); // COMPRESSION CONTROL
|
||||
//Cam_I2C_write(hi2c, (uint16_t)0x5888, 0x01);
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x5000, 0xFF);
|
||||
|
||||
Cam_I2C_write(hi2c, (uint16_t)0x4407, 0x09); // COMPRESSION CONTROL
|
||||
|
||||
HAL_Delay(5);
|
||||
// Setup camera, H-sync: High, V-sync:high, Sensor_delay: no Delay, FIFO_mode:FIFO enabled, power_mode:Low_power
|
||||
Cam_SPI_write(hspi, 0x03, 0x02);
|
||||
|
||||
Cam_I2C_write_bulk(hi2c, ov5642_320x240);
|
||||
//Cam_I2C_write_bulk(hi2c, ov5642_1024x768);
|
||||
|
||||
|
||||
Cam_SPI_write(hspi, 0x04, 0x01);
|
||||
|
||||
Cam_SPI_write(hspi, 0x01, 0x00); // Capture Control Register - Set to capture n+1 frames
|
||||
|
||||
HAL_Delay(5);
|
||||
*/
|
||||
Cam_I2C_write_bulk(hi2c, ov5642_1024x768);
|
||||
//Cam_I2C_write_bulk(hi2c, ov5642_320x240);
|
||||
|
||||
HAL_Delay(1000);
|
||||
|
||||
Cam_SPI_write(hspi, 0x04, 0x01);
|
||||
|
||||
HAL_Delay(5);
|
||||
|
||||
Cam_SPI_write(hspi, 0x01, 0x00); // Capture Control Register - Set to capture n+1 frames
|
||||
|
||||
HAL_Delay(5);
|
||||
}
|
||||
|
||||
void Cam_Refresh(I2C_HandleTypeDef *hi2c, SPI_HandleTypeDef *hspi){
|
||||
@ -294,7 +262,7 @@ int Cam_FIFO_length(SPI_HandleTypeDef *hspi)
|
||||
uint32_t len1, len2, len3, len = 0;
|
||||
len1 = Cam_SPI_read(hspi, 0x42);
|
||||
len2 = Cam_SPI_read(hspi, 0x43);
|
||||
len3 = Cam_SPI_read(hspi, 0x44) & 0x7f;
|
||||
len3 = Cam_SPI_read(hspi, 0x44)& 0x7f;
|
||||
len = ((len3 << 16) | (len2 << 8) | len1) & 0x07fffff;
|
||||
return len;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user