|
5 | 5 |
|
6 | 6 |
|
7 | 7 |
|
8 | | -| :1234: [CAPABILITIES](#1234-capabilities) | :floppy_disk: [SD CARD AND SPIFFS](#floppy_disk-sd-card-and-spiffs) | :musical_note: [AUDIO](#musical_note-audio) | :pager: [DISPLAY AND TOUCH](#pager-display-and-touch) | :electric_plug: [USB](#electric_plug-usb) | |
9 | | -| :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | |
| 8 | +| :1234: [CAPABILITIES](#1234-capabilities) | :floppy_disk: [SD CARD AND SPIFFS](#floppy_disk-sd-card-and-spiffs) | :musical_note: [AUDIO](#musical_note-audio) | :pager: [DISPLAY AND TOUCH](#pager-display-and-touch) | :electric_plug: [USB](#electric_plug-usb) | :camera: [CAMERA](#camera-camera) | |
| 9 | +| :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | :-------------------------: | |
10 | 10 |
|
11 | 11 | </div> |
12 | 12 |
|
@@ -148,6 +148,7 @@ You can use these macros to conditionally compile code depending on feature avai |
148 | 148 | | define | [**BSP\_CAPS\_AUDIO\_MIC**](#define-bsp_caps_audio_mic) 1<br> | |
149 | 149 | | define | [**BSP\_CAPS\_AUDIO\_SPEAKER**](#define-bsp_caps_audio_speaker) 1<br> | |
150 | 150 | | define | [**BSP\_CAPS\_BUTTONS**](#define-bsp_caps_buttons) 0<br> | |
| 151 | +| define | [**BSP\_CAPS\_CAMERA**](#define-bsp_caps_camera) 1<br> | |
151 | 152 | | define | [**BSP\_CAPS\_DISPLAY**](#define-bsp_caps_display) 1<br> | |
152 | 153 | | define | [**BSP\_CAPS\_IMU**](#define-bsp_caps_imu) 0<br> | |
153 | 154 | | define | [**BSP\_CAPS\_SDCARD**](#define-bsp_caps_sdcard) 1<br> | |
@@ -1474,3 +1475,78 @@ USB Host lib will be uninstalled and power from connector removed. |
1474 | 1475 |
|
1475 | 1476 |
|
1476 | 1477 |
|
| 1478 | + |
| 1479 | + |
| 1480 | + |
| 1481 | +## :camera: Camera |
| 1482 | + |
| 1483 | +There is no dedicated BSP API for camera functionality. Instead, the BSP provides default configuration macros: |
| 1484 | +- `BSP_CAMERA_DEFAULT_CONFIG` |
| 1485 | +- `BSP_CAMERA_VFLIP` |
| 1486 | +- `BSP_CAMERA_HMIRROR` |
| 1487 | + |
| 1488 | +These macros are designed for use with the [esp32-camera](https://components.espressif.com/components/espressif/esp32-camera) component. |
| 1489 | + |
| 1490 | +> [!NOTE] |
| 1491 | +> Don't forget to initialize I2C (`bsp_i2c_init()`) before using the camera, as some camera modules require I2C for configuration. |
| 1492 | +
|
| 1493 | +### Example Usage |
| 1494 | +
|
| 1495 | +``` |
| 1496 | +/* Initialize I2C bus (required by camera module) */ |
| 1497 | +bsp_i2c_init(); |
| 1498 | +
|
| 1499 | +/* Initialize the camera using BSP default config */ |
| 1500 | +const camera_config_t camera_config = BSP_CAMERA_DEFAULT_CONFIG; |
| 1501 | +esp_camera_init(&camera_config); |
| 1502 | +
|
| 1503 | +/* Optional: Set camera orientation */ |
| 1504 | +sensor_t *s = esp_camera_sensor_get(); |
| 1505 | +s->set_vflip(s, BSP_CAMERA_VFLIP); // Vertical flip |
| 1506 | +s->set_hmirror(s, BSP_CAMERA_HMIRROR); // Horizontal mirror |
| 1507 | +
|
| 1508 | +... |
| 1509 | +
|
| 1510 | +/* Capture a frame */ |
| 1511 | +camera_fb_t * pic = esp_camera_fb_get(); |
| 1512 | +if (pic) { |
| 1513 | + /* Access raw image data in pic->buf with size pic->len */ |
| 1514 | + process_image(pic->buf, pic->len); // Replace with your function |
| 1515 | + esp_camera_fb_return(pic); |
| 1516 | +} |
| 1517 | +``` |
| 1518 | +
|
| 1519 | +### Camera API Reference |
| 1520 | +
|
| 1521 | +
|
| 1522 | +## Functions |
| 1523 | +
|
| 1524 | +| Type | Name | |
| 1525 | +| ---: | :--- | |
| 1526 | +| esp\_err\_t | [**bsp\_camera\_start**](#function-bsp_camera_start) (void) <br>_Initialize camera._ | |
| 1527 | +
|
| 1528 | +## Macros |
| 1529 | +
|
| 1530 | +| Type | Name | |
| 1531 | +| ---: | :--- | |
| 1532 | +| define | [**BSP\_CAMERA\_GPIO\_XCLK**](#define-bsp_camera_gpio_xclk) (GPIO\_NUM\_NC)<br> | |
| 1533 | +| define | [**BSP\_CAMERA\_RST**](#define-bsp_camera_rst) (GPIO\_NUM\_NC)<br> | |
| 1534 | +
|
| 1535 | +
|
| 1536 | +
|
| 1537 | +## Functions Documentation |
| 1538 | +
|
| 1539 | +### function `bsp_camera_start` |
| 1540 | +
|
| 1541 | +_Initialize camera._ |
| 1542 | +```c |
| 1543 | +esp_err_t bsp_camera_start ( |
| 1544 | + void |
| 1545 | +) |
| 1546 | +``` |
| 1547 | +
|
| 1548 | +
|
| 1549 | +Camera sensor initialization. |
| 1550 | +
|
| 1551 | +
|
| 1552 | +
|
0 commit comments