Skip to content

Commit 120ee2d

Browse files
committed
v1.4.3
1 parent 6eca08e commit 120ee2d

File tree

11 files changed

+260
-45
lines changed

11 files changed

+260
-45
lines changed

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,47 @@ Sensor drivers facilitate communication between the Camera Middleware and the ph
5151
### Initialization
5252

5353
```C
54+
typedef enum {
55+
CMW_NOTKNOWN_Sensor = 0x0,
56+
CMW_VD66GY_Sensor,
57+
CMW_IMX335_Sensor,
58+
CMW_OV5640_Sensor,
59+
CMW_VD55G1_Sensor,
60+
CMW_VD1941_Sensor,
61+
CMW_VD5941_Sensor
62+
} CMW_Sensor_Name_t;
63+
64+
typedef struct
65+
{
66+
int ext_clock_freq_in_hz;
67+
int line_len;
68+
struct {
69+
int datalane_nb;
70+
int clock_lane_swap_enable;
71+
int data_lane0_swap_enable;
72+
int data_lane1_swap_enable;
73+
int data_lanes_mapping_swap_enable;
74+
} csiconfig;
75+
} CMW_VD66GY_config_t;
76+
77+
typedef struct
78+
{
79+
int ext_clock_freq_in_hz;
80+
struct {
81+
int data_rate_in_mps;
82+
int clock_lane_swap_enable;
83+
int data_lane_swap_enable;
84+
} csiconfig;
85+
} CMW_VD55G1_config_t;
86+
87+
typedef struct {
88+
CMW_Sensor_Name_t selected_sensor;
89+
union {
90+
CMW_VD66GY_config_t vd66gy_config;
91+
CMW_VD55G1_config_t vd55g1_config;
92+
} config;
93+
} CMW_Sensor_Config_t;
94+
5495
typedef struct {
5596
/* Camera settings */
5697
uint32_t width;
@@ -60,10 +101,26 @@ typedef struct {
60101
int anti_flicker;
61102
int mirror_flip;
62103
} CMW_CameraInit_t;
104+
105+
```
106+
107+
```C
108+
/**
109+
* @brief Fill the sensor configuration structure with default values.
110+
* @param sensor_config Pointer to the sensor configuration structure
111+
* @retval CMW status
112+
*/
113+
int32_t CMW_CAMERA_SetDefaultSensorValues(CMW_Sensor_Config_t *sensor_config);
63114
```
64115
65116
```C
66-
int32_t CMW_CAMERA_Init( CMW_InitConf_t init_conf );
117+
/**
118+
* @brief Initializes the camera.
119+
* @param initConf Mandatory: General camera config
120+
* @param sensor_config Optional: Sensor specific configuration; NULL if you want to let CMW configure for you
121+
* @retval CMW status
122+
*/
123+
int32_t CMW_CAMERA_Init(CMW_CameraInit_t *init_conf, CMW_Sensor_Config_t *sensor_config);
67124
int32_t CMW_CAMERA_DeInit();
68125
```
69126

Release_Notes.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
<meta charset="utf-8" />
55
<meta name="generator" content="pandoc" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
7-
<title>Release Notes for STM32 Camera Middleware</title>
7+
<title>Release_Notes</title>
88
<style>
99
code{white-space: pre-wrap;}
1010
span.smallcaps{font-variant: small-caps;}
1111
div.columns{display: flex; gap: min(4vw, 1.5em);}
1212
div.column{flex: auto; overflow-x: auto;}
1313
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
14-
ul.task-list{list-style: none;}
14+
15+
ul.task-list[class]{list-style: none;}
1516
ul.task-list li input[type="checkbox"] {
17+
font-size: inherit;
1618
width: 0.8em;
1719
margin: 0 0.8em 0.2em -1.6em;
1820
vertical-align: middle;
@@ -1481,9 +1483,6 @@
14811483
margin-right: auto;
14821484
text-align: center;
14831485
}</style>
1484-
<!--[if lt IE 9]>
1485-
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
1486-
<![endif]-->
14871486
</head>
14881487
<body>
14891488
<h1 id="release-notes-for-stm32-camera-middleware">Release Notes for
@@ -1525,12 +1524,12 @@ <h2 id="software-components">Software components</h2>
15251524
<tbody>
15261525
<tr class="odd">
15271526
<td>Isp Library</td>
1528-
<td>v1.1.0</td>
1527+
<td>v1.2.0</td>
15291528
<td><a href="ISP_Library/README.md">release notes</a></td>
15301529
</tr>
15311530
<tr class="even">
15321531
<td>imx335 driver</td>
1533-
<td>v1.3.1-cmw-custom</td>
1532+
<td>v1.3.1-cmw-patch-2</td>
15341533
<td><a href="sensors/imx335/Release_Notes.html">release notes</a></td>
15351534
</tr>
15361535
<tr class="odd">
@@ -1551,6 +1550,12 @@ <h2 id="supported-devices-and-boards">Supported Devices and Boards</h2>
15511550
<li>MB1939 STM32N6570-DK revC</li>
15521551
</ul>
15531552
<h2 id="update-history">Update history</h2>
1553+
<h3 id="v1.4.3-july-2025">V1.4.3 / July 2025</h3>
1554+
<ul>
1555+
<li>Add support of custom configuration of sensors</li>
1556+
<li>Modify Init API accordingly</li>
1557+
<li>Update Isp library to v1.2.0</li>
1558+
</ul>
15541559
<h3 id="v1.4.2-april-2025">V1.4.2 / April 2025</h3>
15551560
<ul>
15561561
<li>Update Isp library to v1.1.0</li>

Release_Notes.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ This middleware simplifies the development process for applications that require
2121

2222
| Name | Version | Release notes
2323
|----- | ------- | -------------
24-
| Isp Library | v1.1.0 | [release notes](ISP_Library/README.md)
25-
| imx335 driver | v1.3.1-cmw-custom | [release notes](sensors/imx335/Release_Notes.html)
24+
| Isp Library | v1.2.0 | [release notes](ISP_Library/README.md)
25+
| imx335 driver | v1.3.1-cmw-patch-2 | [release notes](sensors/imx335/Release_Notes.html)
2626
| vd6g driver | v1.0.0 |
2727
| vd55g1 driver | v1.0.0 |
2828

@@ -33,6 +33,13 @@ This middleware simplifies the development process for applications that require
3333

3434
## Update history
3535

36+
### V1.4.3 / July 2025
37+
38+
- Add support of custom configuration of sensors
39+
- Modify Init API accordingly
40+
- Update Isp library to v1.2.0
41+
42+
3643
### V1.4.2 / April 2025
3744

3845
- Update Isp library to v1.1.0

cmw_camera.c

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ typedef struct
5555
} CAMERA_Ctx_t;
5656

5757
CMW_CameraInit_t camera_conf;
58-
CMW_Sensor_Name_t detected_sensor;
58+
CMW_Sensor_Name_t connected_sensor;
5959
CAMERA_Ctx_t Camera_Ctx;
6060

6161
DCMIPP_HandleTypeDef hcamera_dcmipp;
@@ -111,11 +111,11 @@ int32_t CMW_CAMERA_SetPipeConfig(uint32_t pipe, CMW_DCMIPP_Conf_t *p_conf, uint3
111111
int32_t CMW_CAMERA_GetSensorName(CMW_Sensor_Name_t *sensorName)
112112
{
113113
int32_t ret = CMW_ERROR_NONE;
114-
CMW_Sensor_Init_t initValues;
114+
CMW_Sensor_Init_t initValues = {0};
115115

116116
if (is_camera_init != 0)
117117
{
118-
*sensorName = detected_sensor;
118+
*sensorName = connected_sensor;
119119
return CMW_ERROR_NONE;
120120
}
121121

@@ -124,6 +124,7 @@ int32_t CMW_CAMERA_GetSensorName(CMW_Sensor_Name_t *sensorName)
124124
initValues.fps = 30;
125125
initValues.pixel_format = DCMIPP_PIXEL_PACKER_FORMAT_RGB565_1;
126126
initValues.mirrorFlip = CMW_MIRRORFLIP_NONE;
127+
initValues.sensor_config = NULL;
127128

128129
/* Set DCMIPP instance */
129130
hcamera_dcmipp.Instance = DCMIPP;
@@ -143,12 +144,12 @@ int32_t CMW_CAMERA_GetSensorName(CMW_Sensor_Name_t *sensorName)
143144

144145
CMW_CAMERA_EnableGPIOs();
145146

146-
ret = CMW_CAMERA_Probe_Sensor(&initValues, &detected_sensor);
147+
ret = CMW_CAMERA_Probe_Sensor(&initValues, &connected_sensor);
147148
if (ret != CMW_ERROR_NONE)
148149
{
149150
return CMW_ERROR_UNKNOWN_COMPONENT;
150151
}
151-
*sensorName = detected_sensor;
152+
*sensorName = connected_sensor;
152153
return CMW_ERROR_NONE;
153154
}
154155

@@ -210,7 +211,6 @@ static int CMW_CAMERA_Probe_Sensor(CMW_Sensor_Init_t *initValues, CMW_Sensor_Nam
210211
return ret;
211212
}
212213
#endif
213-
214214
#if defined(USE_VD66GY_SENSOR)
215215
ret = CMW_CAMERA_VD66GY_Init(initValues);
216216
if (ret == CMW_ERROR_NONE)
@@ -237,13 +237,14 @@ static int CMW_CAMERA_Probe_Sensor(CMW_Sensor_Init_t *initValues, CMW_Sensor_Nam
237237

238238
/**
239239
* @brief Initializes the camera.
240-
* @param initConf Camera sensor requested config
240+
* @param initConf Mandatory: General camera config
241+
* @param sensor_config Optional: Sensor specific configuration
241242
* @retval CMW status
242243
*/
243-
int32_t CMW_CAMERA_Init(CMW_CameraInit_t *initConf)
244+
int32_t CMW_CAMERA_Init(CMW_CameraInit_t *initConf, CMW_Sensor_Config_t *sensor_config)
244245
{
245246
int32_t ret = CMW_ERROR_NONE;
246-
CMW_Sensor_Init_t initValues;
247+
CMW_Sensor_Init_t initValues = {0};
247248
ISP_SensorInfoTypeDef info = {0};
248249

249250
initValues.width = initConf->width;
@@ -252,9 +253,15 @@ int32_t CMW_CAMERA_Init(CMW_CameraInit_t *initConf)
252253
initValues.pixel_format = initConf->pixel_format;
253254
initValues.mirrorFlip = initConf->mirror_flip;
254255

255-
if (is_camera_init != 0)
256+
if ((sensor_config != NULL) && (sensor_config->selected_sensor != CMW_NOTKNOWN_Sensor))
256257
{
257-
return CMW_ERROR_NONE;
258+
connected_sensor = sensor_config->selected_sensor; // Assume The sensor is the one selected by the application. Check during probe
259+
initValues.sensor_config = (void *) &sensor_config->config;
260+
}
261+
else
262+
{
263+
connected_sensor = CMW_NOTKNOWN_Sensor;
264+
initValues.sensor_config = NULL;
258265
}
259266

260267
/* Set DCMIPP instance */
@@ -275,7 +282,7 @@ int32_t CMW_CAMERA_Init(CMW_CameraInit_t *initConf)
275282

276283
CMW_CAMERA_EnableGPIOs();
277284

278-
ret = CMW_CAMERA_Probe_Sensor(&initValues, &detected_sensor);
285+
ret = CMW_CAMERA_Probe_Sensor(&initValues, &connected_sensor);
279286
if (ret != CMW_ERROR_NONE)
280287
{
281288
return CMW_ERROR_UNKNOWN_COMPONENT;
@@ -943,7 +950,6 @@ static int32_t CMW_CAMERA_VD55G1_Init( CMW_Sensor_Init_t *initSensors_params)
943950

944951
memset(&camera_bsp, 0, sizeof(camera_bsp));
945952
camera_bsp.vd55g1_bsp.Address = CAMERA_VD55G1_ADDRESS;
946-
camera_bsp.vd55g1_bsp.ClockInHz = CAMERA_VD55G1_FREQ_IN_HZ;
947953
camera_bsp.vd55g1_bsp.Init = CMW_I2C_INIT;
948954
camera_bsp.vd55g1_bsp.DeInit = CMW_I2C_DEINIT;
949955
camera_bsp.vd55g1_bsp.WriteReg = CMW_I2C_WRITEREG16;
@@ -958,6 +964,12 @@ static int32_t CMW_CAMERA_VD55G1_Init( CMW_Sensor_Init_t *initSensors_params)
958964
return CMW_ERROR_COMPONENT_FAILURE;
959965
}
960966

967+
if ((connected_sensor != CMW_VD55G1_Sensor) && (connected_sensor != CMW_NOTKNOWN_Sensor))
968+
{
969+
/* If the selected sensor in the application side has selected a different sensors than VD55G1 */
970+
return CMW_ERROR_COMPONENT_FAILURE;
971+
}
972+
961973
/* Special case: when resolution is not specified take the full sensor resolution */
962974
if ((initSensors_params->width == 0) || (initSensors_params->height == 0))
963975
{
@@ -1014,7 +1026,6 @@ static int32_t CMW_CAMERA_VD66GY_Init( CMW_Sensor_Init_t *initSensors_params)
10141026

10151027
memset(&camera_bsp, 0, sizeof(camera_bsp));
10161028
camera_bsp.vd66gy_bsp.Address = CAMERA_VD66GY_ADDRESS;
1017-
camera_bsp.vd66gy_bsp.ClockInHz = CAMERA_VD66GY_FREQ_IN_HZ;
10181029
camera_bsp.vd66gy_bsp.Init = CMW_I2C_INIT;
10191030
camera_bsp.vd66gy_bsp.DeInit = CMW_I2C_DEINIT;
10201031
camera_bsp.vd66gy_bsp.ReadReg = CMW_I2C_READREG16;
@@ -1035,6 +1046,12 @@ static int32_t CMW_CAMERA_VD66GY_Init( CMW_Sensor_Init_t *initSensors_params)
10351046
return CMW_ERROR_COMPONENT_FAILURE;
10361047
}
10371048

1049+
if ((connected_sensor != CMW_VD66GY_Sensor) && (connected_sensor != CMW_NOTKNOWN_Sensor))
1050+
{
1051+
/* If the selected sensor in the application side has selected a different sensors than VD66GY */
1052+
return CMW_ERROR_COMPONENT_FAILURE;
1053+
}
1054+
10381055
/* Special case: when resolution is not specified take the full sensor resolution */
10391056
if ((initSensors_params->width == 0) || (initSensors_params->height == 0))
10401057
{
@@ -1112,6 +1129,12 @@ static int32_t CMW_CAMERA_IMX335_Init(CMW_Sensor_Init_t *initSensors_params)
11121129
return CMW_ERROR_COMPONENT_FAILURE;
11131130
}
11141131

1132+
if ((connected_sensor != CMW_IMX335_Sensor) && (connected_sensor != CMW_NOTKNOWN_Sensor))
1133+
{
1134+
/* If the selected sensor in the application side has selected a different sensors than IMX335 */
1135+
return CMW_ERROR_COMPONENT_FAILURE;
1136+
}
1137+
11151138
/* Special case: when resolution is not specified take the full sensor resolution */
11161139
if ((initSensors_params->width == 0) || (initSensors_params->height == 0))
11171140
{
@@ -1341,3 +1364,31 @@ static int32_t CMW_CAMERA_SetPipe(DCMIPP_HandleTypeDef *hdcmipp, uint32_t pipe,
13411364
return HAL_OK;
13421365
}
13431366

1367+
int32_t CMW_CAMERA_SetDefaultSensorValues( CMW_Sensor_Config_t *sensor_config )
1368+
{
1369+
if (sensor_config == NULL)
1370+
{
1371+
return CMW_ERROR_WRONG_PARAM;
1372+
}
1373+
switch (sensor_config->selected_sensor)
1374+
{
1375+
#if defined(USE_VD66GY_SENSOR)
1376+
case CMW_VD66GY_Sensor:
1377+
CMW_VD66GY_SetDefaultSensorValues(&sensor_config->config.vd66gy_config);
1378+
break;
1379+
#endif
1380+
#if defined(USE_VD55G1_SENSOR)
1381+
case CMW_VD55G1_Sensor:
1382+
CMW_VD55G1_SetDefaultSensorValues(&sensor_config->config.vd55g1_config);
1383+
break;
1384+
#endif
1385+
#if defined(USE_IMX335_SENSOR)
1386+
case CMW_IMX335_Sensor:
1387+
#endif
1388+
default:
1389+
return CMW_ERROR_WRONG_PARAM;
1390+
break;
1391+
}
1392+
1393+
return CMW_ERROR_NONE;
1394+
}

0 commit comments

Comments
 (0)