Skip to content

Commit 5a85b8a

Browse files
committed
improve docstrings based on my best sleuthing
1 parent ec839d6 commit 5a85b8a

File tree

1 file changed

+37
-25
lines changed
  • ports/espressif/bindings/esp32_camera

1 file changed

+37
-25
lines changed

ports/espressif/bindings/esp32_camera/Camera.c

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@
6565
//|
6666
//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``/.env`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError, this probably indicates the setting is too small and should be increased.
6767
//|
68+
//|
69+
//| .. IMPORTANT:
70+
//| Not all supported sensors have all
71+
//| of the properties listed below. For instance, the
72+
//| OV5640 supports `denoise`, but the
73+
//| OV2640 does not. The underlying esp32-camera
74+
//| library does not provide a reliable API to check
75+
//| which settings are supported. CircuitPython makes
76+
//| a best effort to determine when an unsupported
77+
//| property is set and will raise an exception in
78+
//| that case.
79+
//|
6880
//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first
6981
//| :param pixel_clock: The pixel clock output from the camera module
7082
//| :param vsync: The vertical sync pulse output from the camera module
@@ -230,7 +242,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera_take_obj, 1, 2, e
230242
//| grab_mode: Optional[GrabMode] = None,
231243
//| framebuffer_count: Optional[int] = None,
232244
//| ) -> None:
233-
//| """Set the frame size and pixel format
245+
//| """Change multiple related camera settings simultaneously
234246
//|
235247
//| Because these settings interact in complex ways, and take longer than
236248
//| the other properties to set, they are set together in a single function call.
@@ -304,7 +316,7 @@ MP_PROPERTY_GETTER(esp32_camera_camera_frame_size_obj,
304316
(mp_obj_t)&esp32_camera_camera_get_frame_size_obj);
305317

306318
//| contrast: int
307-
//| """Access the contrast property of the camera sensor"""
319+
//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive."""
308320
//|
309321

310322
STATIC mp_obj_t esp32_camera_camera_get_contrast(const mp_obj_t self_in) {
@@ -326,7 +338,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_contrast_obj,
326338
(mp_obj_t)&esp32_camera_camera_set_contrast_obj);
327339

328340
//| brightness: int
329-
//| """Access the brightness property of the camera sensor"""
341+
//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive."""
330342
//|
331343

332344
STATIC mp_obj_t esp32_camera_camera_get_brightness(const mp_obj_t self_in) {
@@ -348,7 +360,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_brightness_obj,
348360
(mp_obj_t)&esp32_camera_camera_set_brightness_obj);
349361

350362
//| saturation: int
351-
//| """Access the saturation property of the camera sensor"""
363+
//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive."""
352364
//|
353365

354366
STATIC mp_obj_t esp32_camera_camera_get_saturation(const mp_obj_t self_in) {
@@ -370,7 +382,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_saturation_obj,
370382
(mp_obj_t)&esp32_camera_camera_set_saturation_obj);
371383

372384
//| sharpness: int
373-
//| """Access the sharpness property of the camera sensor"""
385+
//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive."""
374386
//|
375387

376388
STATIC mp_obj_t esp32_camera_camera_get_sharpness(const mp_obj_t self_in) {
@@ -392,7 +404,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_sharpness_obj,
392404
(mp_obj_t)&esp32_camera_camera_set_sharpness_obj);
393405

394406
//| denoise: int
395-
//| """Access the denoise property of the camera sensor"""
407+
//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10."""
396408
//|
397409

398410
STATIC mp_obj_t esp32_camera_camera_get_denoise(const mp_obj_t self_in) {
@@ -414,7 +426,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_denoise_obj,
414426
(mp_obj_t)&esp32_camera_camera_set_denoise_obj);
415427

416428
//| gain_ceiling: GainCeiling
417-
//| """Access the gain ceiling property of the camera sensor"""
429+
//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible."""
418430
//|
419431

420432
STATIC mp_obj_t esp32_camera_camera_get_gain_ceiling(const mp_obj_t self_in) {
@@ -436,7 +448,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_gain_ceiling_obj,
436448
(mp_obj_t)&esp32_camera_camera_set_gain_ceiling_obj);
437449

438450
//| quality: int
439-
//| """Access the quality property of the camera sensor"""
451+
//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail."""
440452
//|
441453

442454
STATIC mp_obj_t esp32_camera_camera_get_quality(const mp_obj_t self_in) {
@@ -458,7 +470,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_quality_obj,
458470
(mp_obj_t)&esp32_camera_camera_set_quality_obj);
459471

460472
//| colorbar: bool
461-
//| """Access the colorbar property of the camera sensor"""
473+
//| """When `True`, a test pattern image is captured and the real sensor data is not used."""
462474
//|
463475

464476
STATIC mp_obj_t esp32_camera_camera_get_colorbar(const mp_obj_t self_in) {
@@ -480,7 +492,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_colorbar_obj,
480492
(mp_obj_t)&esp32_camera_camera_set_colorbar_obj);
481493

482494
//| whitebal: bool
483-
//| """Access the whitebal property of the camera sensor"""
495+
//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead."""
484496
//|
485497

486498
STATIC mp_obj_t esp32_camera_camera_get_whitebal(const mp_obj_t self_in) {
@@ -502,7 +514,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_whitebal_obj,
502514
(mp_obj_t)&esp32_camera_camera_set_whitebal_obj);
503515

504516
//| gain_ctrl: bool
505-
//| """Access the gain_ctrl property of the camera sensor"""
517+
//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead."""
506518
//|
507519

508520
STATIC mp_obj_t esp32_camera_camera_get_gain_ctrl(const mp_obj_t self_in) {
@@ -524,7 +536,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_gain_ctrl_obj,
524536
(mp_obj_t)&esp32_camera_camera_set_gain_ctrl_obj);
525537

526538
//| exposure_ctrl: bool
527-
//| """Access the exposure_ctrl property of the camera sensor"""
539+
//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead."""
528540
//|
529541

530542
STATIC mp_obj_t esp32_camera_camera_get_exposure_ctrl(const mp_obj_t self_in) {
@@ -546,7 +558,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_exposure_ctrl_obj,
546558
(mp_obj_t)&esp32_camera_camera_set_exposure_ctrl_obj);
547559

548560
//| hmirror: bool
549-
//| """Access the hmirror property of the camera sensor"""
561+
//| """When `true` the camera image is mirrored left-to-right"""
550562
//|
551563

552564
STATIC mp_obj_t esp32_camera_camera_get_hmirror(const mp_obj_t self_in) {
@@ -568,7 +580,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_hmirror_obj,
568580
(mp_obj_t)&esp32_camera_camera_set_hmirror_obj);
569581

570582
//| vflip: bool
571-
//| """Access the vflip property of the camera sensor"""
583+
//| """When `True` the camera image is flipped top-to-bottom"""
572584
//|
573585

574586
STATIC mp_obj_t esp32_camera_camera_get_vflip(const mp_obj_t self_in) {
@@ -590,7 +602,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_vflip_obj,
590602
(mp_obj_t)&esp32_camera_camera_set_vflip_obj);
591603

592604
//| aec2: bool
593-
//| """Access the aec2 property of the camera sensor"""
605+
//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control."""
594606
//|
595607

596608
STATIC mp_obj_t esp32_camera_camera_get_aec2(const mp_obj_t self_in) {
@@ -634,7 +646,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_awb_gain_obj,
634646
(mp_obj_t)&esp32_camera_camera_set_awb_gain_obj);
635647

636648
//| agc_gain: int
637-
//| """Access the agc_gain property of the camera sensor"""
649+
//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """
638650
//|
639651

640652
STATIC mp_obj_t esp32_camera_camera_get_agc_gain(const mp_obj_t self_in) {
@@ -656,7 +668,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_agc_gain_obj,
656668
(mp_obj_t)&esp32_camera_camera_set_agc_gain_obj);
657669

658670
//| aec_value: int
659-
//| """Access the aec_value property of the camera sensor"""
671+
//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200."""
660672
//|
661673

662674
STATIC mp_obj_t esp32_camera_camera_get_aec_value(const mp_obj_t self_in) {
@@ -678,7 +690,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_aec_value_obj,
678690
(mp_obj_t)&esp32_camera_camera_set_aec_value_obj);
679691

680692
//| special_effect: int
681-
//| """Access the special_effect property of the camera sensor"""
693+
//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes."""
682694
//|
683695

684696
STATIC mp_obj_t esp32_camera_camera_get_special_effect(const mp_obj_t self_in) {
@@ -700,7 +712,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_special_effect_obj,
700712
(mp_obj_t)&esp32_camera_camera_set_special_effect_obj);
701713

702714
//| wb_mode: int
703-
//| """Access the wb_mode property of the camera sensor"""
715+
//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive."""
704716
//|
705717

706718
STATIC mp_obj_t esp32_camera_camera_get_wb_mode(const mp_obj_t self_in) {
@@ -722,7 +734,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_wb_mode_obj,
722734
(mp_obj_t)&esp32_camera_camera_set_wb_mode_obj);
723735

724736
//| ae_level: int
725-
//| """Access the ae_level property of the camera sensor"""
737+
//| """The exposure offset for automatic exposure. Typical values range from -2 to +2."""
726738
//|
727739

728740
STATIC mp_obj_t esp32_camera_camera_get_ae_level(const mp_obj_t self_in) {
@@ -744,7 +756,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_ae_level_obj,
744756
(mp_obj_t)&esp32_camera_camera_set_ae_level_obj);
745757

746758
//| dcw: bool
747-
//| """Access the dcw property of the camera sensor"""
759+
//| """When `True` an advanced white balance mode is selected."""
748760
//|
749761

750762
STATIC mp_obj_t esp32_camera_camera_get_dcw(const mp_obj_t self_in) {
@@ -766,7 +778,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_dcw_obj,
766778
(mp_obj_t)&esp32_camera_camera_set_dcw_obj);
767779

768780
//| bpc: bool
769-
//| """Access the bpc property of the camera sensor"""
781+
//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker."""
770782
//|
771783

772784
STATIC mp_obj_t esp32_camera_camera_get_bpc(const mp_obj_t self_in) {
@@ -788,7 +800,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_bpc_obj,
788800
(mp_obj_t)&esp32_camera_camera_set_bpc_obj);
789801

790802
//| wpc: bool
791-
//| """Access the wpc property of the camera sensor"""
803+
//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter."""
792804
//|
793805

794806
STATIC mp_obj_t esp32_camera_camera_get_wpc(const mp_obj_t self_in) {
@@ -810,7 +822,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_wpc_obj,
810822
(mp_obj_t)&esp32_camera_camera_set_wpc_obj);
811823

812824
//| raw_gma: bool
813-
//| """Access the raw_gma property of the camera sensor"""
825+
//| """When `True`, raw gamma mode is enabled."""
814826
//|
815827

816828
STATIC mp_obj_t esp32_camera_camera_get_raw_gma(const mp_obj_t self_in) {
@@ -832,7 +844,7 @@ MP_PROPERTY_GETSET(esp32_camera_camera_raw_gma_obj,
832844
(mp_obj_t)&esp32_camera_camera_set_raw_gma_obj);
833845

834846
//| lenc: bool
835-
//| """Access the lenc property of the camera sensor"""
847+
//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area."""
836848
//|
837849

838850
STATIC mp_obj_t esp32_camera_camera_get_lenc(const mp_obj_t self_in) {

0 commit comments

Comments
 (0)