Skip to content

Commit df7d500

Browse files
committed
style: run clang-format across source tree
Apply clang-format across C/C++ headers and sources in the repository to satisfy CI. Signed-off-by: Ozan Durgut <ozandurgut.2001@hotmail.com>
1 parent 4922fd2 commit df7d500

8 files changed

Lines changed: 88 additions & 63 deletions

File tree

‎device/camera/camera.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define CAMERA_H
66

77
#include "core/image.h"
8+
89
#include <stddef.h>
910
#include <stdint.h>
1011

‎device/camera/ov5640/stm32_ov5640.c‎

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@
1111

1212
#ifdef DEVICE_OV5640
1313

14-
#include "stm32_ov5640.h"
15-
#include "board/stm32f7/configs.h"
16-
#include "device/camera/camera.h"
17-
#include "device/serial/serial.h"
18-
#include "stm32f7xx_hal.h"
14+
#include "board/stm32f7/configs.h"
15+
#include "device/camera/camera.h"
16+
#include "device/serial/serial.h"
1917

20-
#include <stdarg.h>
21-
#include <stdint.h>
22-
#include <stdio.h>
18+
#include <stdarg.h>
19+
#include <stdint.h>
20+
#include <stdio.h>
2321

24-
/* ============================================================================
25-
* I2C COMMUNICATION LAYER (Internal - Static Functions)
26-
* ============================================================================ */
22+
#include "stm32_ov5640.h"
23+
#include "stm32f7xx_hal.h"
2724

28-
/* Private defines */
29-
#define I2C1_TIMING ((uint32_t)0x40912732) /**< I2C timing for 100kHz at 216MHz */
25+
/* ============================================================================
26+
* I2C COMMUNICATION LAYER (Internal - Static Functions)
27+
* ============================================================================ */
28+
29+
/* Private defines */
30+
#define I2C1_TIMING ((uint32_t)0x40912732) /**< I2C timing for 100kHz at 216MHz */
3031

3132
/* Private variables */
3233
static I2C_HandleTypeDef hI2cCamera = {0};
@@ -68,8 +69,7 @@ static void CAMERA_IO_Write(uint16_t DeviceAddr, uint16_t Reg, uint8_t Value)
6869
{
6970
HAL_StatusTypeDef status;
7071

71-
status = HAL_I2C_Mem_Write(&hI2cCamera, DeviceAddr, Reg, I2C_MEMADD_SIZE_16BIT,
72-
&Value, 1, 100);
72+
status = HAL_I2C_Mem_Write(&hI2cCamera, DeviceAddr, Reg, I2C_MEMADD_SIZE_16BIT, &Value, 1, 100);
7373

7474
if (status != HAL_OK) {
7575
I2C_Error(DeviceAddr);
@@ -87,8 +87,7 @@ static uint8_t CAMERA_IO_Read(uint16_t DeviceAddr, uint16_t Reg)
8787
uint8_t value = 0;
8888
HAL_StatusTypeDef status;
8989

90-
status = HAL_I2C_Mem_Read(&hI2cCamera, DeviceAddr, Reg, I2C_MEMADD_SIZE_16BIT,
91-
&value, 1, 100);
90+
status = HAL_I2C_Mem_Read(&hI2cCamera, DeviceAddr, Reg, I2C_MEMADD_SIZE_16BIT, &value, 1, 100);
9291

9392
if (status != HAL_OK) {
9493
I2C_Error(DeviceAddr);
@@ -151,7 +150,7 @@ static void I2C_MspInit(void)
151150
*/
152151
static void I2C_Error(uint8_t Addr)
153152
{
154-
(void)Addr; /* Unused parameter */
153+
(void)Addr; /* Unused parameter */
155154

156155
/* De-initialize and re-initialize I2C to recover from error */
157156
HAL_I2C_DeInit(&hI2cCamera);
@@ -216,32 +215,52 @@ const uint16_t OV5640_Init[][2] = {
216215
* @brief Resolution configuration for 640x480 (VGA)
217216
*/
218217
const uint16_t OV5640_VGA[][2] = {
219-
{0x3808, 0x02}, {0x3809, 0x80}, {0x380a, 0x01}, {0x380b, 0xE0},
220-
{0x4300, 0x6F}, {0x4740, 0x22}, {0x501F, 0x01},
218+
{0x3808, 0x02},
219+
{0x3809, 0x80},
220+
{0x380a, 0x01},
221+
{0x380b, 0xE0},
222+
{0x4300, 0x6F},
223+
{0x4740, 0x22},
224+
{0x501F, 0x01},
221225
};
222226

223227
/**
224228
* @brief Resolution configuration for 480x272
225229
*/
226230
const uint16_t OV5640_480x272[][2] = {
227-
{0x3808, 0x01}, {0x3809, 0xE0}, {0x380a, 0x01}, {0x380b, 0x10},
228-
{0x4300, 0x6F}, {0x4740, 0x22}, {0x501f, 0x01},
231+
{0x3808, 0x01},
232+
{0x3809, 0xE0},
233+
{0x380a, 0x01},
234+
{0x380b, 0x10},
235+
{0x4300, 0x6F},
236+
{0x4740, 0x22},
237+
{0x501f, 0x01},
229238
};
230239

231240
/**
232241
* @brief Resolution configuration for 320x240 (QVGA)
233242
*/
234243
const uint16_t OV5640_QVGA[][2] = {
235-
{0x3808, 0x01}, {0x3809, 0x40}, {0x380a, 0x00}, {0x380b, 0xF0},
236-
{0x4300, 0x6F}, {0x4740, 0x22}, {0x501f, 0x01},
244+
{0x3808, 0x01},
245+
{0x3809, 0x40},
246+
{0x380a, 0x00},
247+
{0x380b, 0xF0},
248+
{0x4300, 0x6F},
249+
{0x4740, 0x22},
250+
{0x501f, 0x01},
237251
};
238252

239253
/**
240254
* @brief Resolution configuration for 160x120 (QQVGA)
241255
*/
242256
const uint16_t OV5640_QQVGA[][2] = {
243-
{0x3808, 0x00}, {0x3809, 0xA0}, {0x380a, 0x00}, {0x380b, 0x78},
244-
{0x4300, 0x6F}, {0x4740, 0x22}, {0x501f, 0x01},
257+
{0x3808, 0x00},
258+
{0x3809, 0xA0},
259+
{0x380a, 0x00},
260+
{0x380b, 0x78},
261+
{0x4300, 0x6F},
262+
{0x4740, 0x22},
263+
{0x501f, 0x01},
245264
};
246265

247266
/**
@@ -250,7 +269,7 @@ const uint16_t OV5640_QQVGA[][2] = {
250269
CAMERA_DrvTypeDef ov5640_drv = {
251270
ov5640_Init,
252271
ov5640_ReadID,
253-
NULL, /* Config function removed */
272+
NULL, /* Config function removed */
254273
};
255274

256275
/**
@@ -332,7 +351,7 @@ int OV5640_SetPixelFormat(uint16_t DeviceAddr, uint32_t format)
332351
{
333352
/* Validate format */
334353
if (format != 0x10 && format != 0x6F && format != 0x23 && format != 0x30) {
335-
return -1; /* Invalid format */
354+
return -1; /* Invalid format */
336355
}
337356

338357
/* Write format to register 0x4300 (format control) */
@@ -610,12 +629,10 @@ static int camera_setRes(ImageResolution resolution)
610629
/**
611630
* @brief STM32 OV5640 camera interface structure
612631
*/
613-
camera_t stm32_ov5640 = {
614-
.init = camera_init,
615-
.capture = camera_capture,
616-
.stop = camera_stop,
617-
.setRes = camera_setRes
618-
};
632+
camera_t stm32_ov5640 = {.init = camera_init,
633+
.capture = camera_capture,
634+
.stop = camera_stop,
635+
.setRes = camera_setRes};
619636

620637
/**
621638
* @brief DCMI frame event callback - called when a complete frame is captured

‎device/camera/ov5640/stm32_ov5640.h‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,38 @@
1313

1414
#ifdef DEVICE_OV5640
1515

16-
#ifndef __OV5640_H
17-
#define __OV5640_H
16+
#ifndef __OV5640_H
17+
#define __OV5640_H
1818

19-
#ifdef __cplusplus
19+
#ifdef __cplusplus
2020
extern "C" {
21-
#endif
21+
#endif
2222

23-
#include "device/camera/camera.h"
23+
#include "device/camera/camera.h"
2424

25-
/**
26-
* @brief OV5640 chip ID
27-
*/
28-
#define OV5640_ID 0x5640
25+
/**
26+
* @brief OV5640 chip ID
27+
*/
28+
#define OV5640_ID 0x5640
2929

30-
/**
31-
* @brief OV5640 I2C address (7-bit address shifted left by 1)
32-
*/
33-
#define CAMERA_I2C_ADDRESS 0x78
30+
/**
31+
* @brief OV5640 I2C address (7-bit address shifted left by 1)
32+
*/
33+
#define CAMERA_I2C_ADDRESS 0x78
3434

35-
/**
36-
* @brief OV5640 pixel format constants
37-
*/
38-
#define OV5640_PIXEL_FORMAT_Y8 0x10 /**< 8-bit grayscale */
39-
#define OV5640_PIXEL_FORMAT_RGB565 0x6F /**< RGB565 format */
40-
#define OV5640_PIXEL_FORMAT_RGB888 0x23 /**< RGB888 format */
41-
#define OV5640_PIXEL_FORMAT_YUV422 0x30 /**< YUV422 format */
35+
/**
36+
* @brief OV5640 pixel format constants
37+
*/
38+
#define OV5640_PIXEL_FORMAT_Y8 0x10 /**< 8-bit grayscale */
39+
#define OV5640_PIXEL_FORMAT_RGB565 0x6F /**< RGB565 format */
40+
#define OV5640_PIXEL_FORMAT_RGB888 0x23 /**< RGB888 format */
41+
#define OV5640_PIXEL_FORMAT_YUV422 0x30 /**< YUV422 format */
4242

4343
/**
4444
* @brief Initialize OV5640 camera
4545
* @param DeviceAddr: I2C device address (typically 0x78)
46-
* @param resolution: Camera resolution (CAMERA_R160x120, CAMERA_R320x240, CAMERA_R480x272, CAMERA_R640x480)
46+
* @param resolution: Camera resolution (CAMERA_R160x120, CAMERA_R320x240, CAMERA_R480x272,
47+
* CAMERA_R640x480)
4748
*/
4849
void ov5640_Init(uint16_t DeviceAddr, uint32_t resolution);
4950

@@ -77,10 +78,10 @@ extern camera_t stm32_ov5640;
7778
*/
7879
extern volatile uint8_t frame_capture_complete;
7980

80-
#ifdef __cplusplus
81+
#ifdef __cplusplus
8182
}
82-
#endif
83+
#endif
8384

84-
#endif /* __OV5640_H */
85+
#endif /* __OV5640_H */
8586

8687
#endif /* DEVICE_OV5640 */

‎device/display/display.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define DISPLAY_H
66

77
#include "core/image.h"
8+
89
#include <stddef.h>
910
#include <stdint.h>
1011

‎imgproc/connectedcomponents.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright (c) 2025 EmbedDIP
33

44
#include "connectedcomponents.h"
5+
56
#include <string.h> /* For memset */
67

78
embeddip_status_t connectedComponents(const Image *src, Image *dst, uint32_t *label_count)

‎imgproc/misc.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,15 @@ embeddip_status_t convertTo(Image *img)
324324
* image to a given reference color.
325325
*
326326
* @param[in] inImg Pointer to the input RGB image (3 channels, interleaved as RGBRGB...).
327-
* @param[out] outImg Pointer to the output grayscale image (1 channel, same width and height as input).
327+
* @param[out] outImg Pointer to the output grayscale image (1 channel, same width and height as
328+
* input).
328329
* @param[in] R_ref Reference Red channel value (0–255).
329330
* @param[in] G_ref Reference Green channel value (0–255).
330331
* @param[in] B_ref Reference Blue channel value (0–255).
331332
* @return EMBEDDIP_OK on success, error code on failure
332333
*/
333-
embeddip_status_t dist(const Image *inImg, Image *outImg, uint8_t R_ref, uint8_t G_ref, uint8_t B_ref)
334+
embeddip_status_t
335+
dist(const Image *inImg, Image *outImg, uint8_t R_ref, uint8_t G_ref, uint8_t B_ref)
334336
{
335337
int totalPixels = inImg->width * inImg->height;
336338

‎imgproc/misc.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ embeddip_status_t convertTo(Image *img);
4747
* @param B_ref Reference Blue channel value (0–255)
4848
* @return EMBEDDIP_OK on success, error code on failure
4949
*/
50-
embeddip_status_t dist(const Image *inImg, Image *outImg, uint8_t R_ref, uint8_t G_ref, uint8_t B_ref);
50+
embeddip_status_t
51+
dist(const Image *inImg, Image *outImg, uint8_t R_ref, uint8_t G_ref, uint8_t B_ref);
5152

5253
/**
5354
* @brief Bitwise AND operation on binary masks

‎wrapper/ImageWrapper.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,9 @@ void Image::add(const Image &other, Image &out) const
571571
/**
572572
* @brief Computes color distance from this RGB image to a reference color.
573573
*/
574-
void Image::dist(Image &out, uint8_t r, uint8_t g, uint8_t b) const {
575-
::dist(raw(), out.raw(), r, g, b);
574+
void Image::dist(Image &out, uint8_t r, uint8_t g, uint8_t b) const
575+
{
576+
::dist(raw(), out.raw(), r, g, b);
576577
}
577578

578579
/**

0 commit comments

Comments
 (0)