Implement a pile of getters & setters
This commit is contained in:
parent
69949ecb43
commit
258f72640a
@ -3236,6 +3236,10 @@ msgstr ""
|
||||
msgid "invalid micropython decorator"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/esp32_camera/Camera.c
|
||||
msgid "invalid setting"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/random/__init__.c
|
||||
msgid "invalid step"
|
||||
msgstr ""
|
||||
@ -3491,7 +3495,7 @@ msgstr ""
|
||||
msgid "no response from SD card"
|
||||
msgstr ""
|
||||
|
||||
#: py/objobject.c py/runtime.c
|
||||
#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
|
@ -205,21 +205,635 @@ STATIC mp_obj_t esp32_camera_camera_take(size_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera_take_obj, 1, 2, esp32_camera_camera_take);
|
||||
|
||||
//| pixel_format: PixelFormat
|
||||
//| """The pixel format of the camera"""
|
||||
//|
|
||||
//| frame_size: FrameSize
|
||||
//| """The size of the captured image"""
|
||||
//|
|
||||
|
||||
//| pixel_format: pixformat_t
|
||||
//| """The pixel format of captured frames"""
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_pixel_format(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return cp_enum_find(&esp32_camera_pixel_format_type, common_hal_esp32_camera_camera_get_pixel_format(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_pixel_format_obj, esp32_camera_camera_get_pixel_format);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_pixel_format(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_pixel_format(self, validate_pixel_format(arg, MP_QSTR_pixel_format));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_pixel_format_obj, esp32_camera_camera_set_pixel_format);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_pixel_format_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_pixel_format_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_pixel_format_obj);
|
||||
|
||||
|
||||
//| frame_size: framesize_t
|
||||
//| """The size of captured frames"""
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_frame_size(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_frame_size(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_frame_size_obj, esp32_camera_camera_get_frame_size);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_frame_size(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_frame_size(self, validate_frame_size(arg, MP_QSTR_frame_size));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_frame_size_obj, esp32_camera_camera_set_frame_size);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_frame_size_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_frame_size_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_frame_size_obj);
|
||||
|
||||
//| contrast: int
|
||||
//| """The contrast of the sensor"""
|
||||
//| """Access the contrast property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_contrast(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_contrast(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_contrast_obj, esp32_camera_camera_get_contrast);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_contrast(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_contrast_obj, esp32_camera_camera_set_contrast);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_contrast_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_contrast_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_contrast_obj);
|
||||
|
||||
//| brightness: int
|
||||
//| """Access the brightness property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_brightness(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_brightness(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_brightness_obj, esp32_camera_camera_get_brightness);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_brightness(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_brightness_obj, esp32_camera_camera_set_brightness);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_brightness_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_brightness_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_brightness_obj);
|
||||
|
||||
//| saturation: int
|
||||
//| """Access the saturation property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_saturation(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_saturation(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_saturation_obj, esp32_camera_camera_get_saturation);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_saturation(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_saturation_obj, esp32_camera_camera_set_saturation);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_saturation_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_saturation_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_saturation_obj);
|
||||
|
||||
//| sharpness: int
|
||||
//| """Access the sharpness property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_sharpness(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_sharpness(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sharpness_obj, esp32_camera_camera_get_sharpness);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_sharpness(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_sharpness_obj, esp32_camera_camera_set_sharpness);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_sharpness_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_sharpness_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_sharpness_obj);
|
||||
|
||||
//| denoise: int
|
||||
//| """Access the denoise property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_denoise(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_denoise(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_denoise_obj, esp32_camera_camera_get_denoise);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_denoise(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_denoise_obj, esp32_camera_camera_set_denoise);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_denoise_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_denoise_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_denoise_obj);
|
||||
|
||||
//| gain_ceiling: GainCeiling
|
||||
//| """Access the gain ceiling property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_gain_ceiling(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return cp_enum_find(&esp32_camera_gain_ceiling_type, common_hal_esp32_camera_camera_get_gainceiling(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ceiling_obj, esp32_camera_camera_get_gain_ceiling);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ceiling_obj, esp32_camera_camera_set_gain_ceiling);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_gain_ceiling_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_gain_ceiling_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_gain_ceiling_obj);
|
||||
|
||||
//| quality: int
|
||||
//| """Access the quality property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_quality(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_quality(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_quality_obj, esp32_camera_camera_get_quality);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_quality(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_quality_obj, esp32_camera_camera_set_quality);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_quality_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_quality_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_quality_obj);
|
||||
|
||||
//| colorbar: bool
|
||||
//| """Access the colorbar property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_colorbar(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_colorbar(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_colorbar_obj, esp32_camera_camera_get_colorbar);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_colorbar(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_colorbar_obj, esp32_camera_camera_set_colorbar);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_colorbar_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_colorbar_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_colorbar_obj);
|
||||
|
||||
//| whitebal: bool
|
||||
//| """Access the whitebal property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_whitebal(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_whitebal(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_whitebal_obj, esp32_camera_camera_get_whitebal);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_whitebal(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_whitebal_obj, esp32_camera_camera_set_whitebal);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_whitebal_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_whitebal_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_whitebal_obj);
|
||||
|
||||
//| gain_ctrl: bool
|
||||
//| """Access the gain_ctrl property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_gain_ctrl(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_gain_ctrl(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ctrl_obj, esp32_camera_camera_get_gain_ctrl);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_gain_ctrl(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ctrl_obj, esp32_camera_camera_set_gain_ctrl);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_gain_ctrl_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_gain_ctrl_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_gain_ctrl_obj);
|
||||
|
||||
//| exposure_ctrl: bool
|
||||
//| """Access the exposure_ctrl property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_exposure_ctrl(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_exposure_ctrl(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_exposure_ctrl_obj, esp32_camera_camera_get_exposure_ctrl);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_exposure_ctrl_obj, esp32_camera_camera_set_exposure_ctrl);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_exposure_ctrl_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_exposure_ctrl_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_exposure_ctrl_obj);
|
||||
|
||||
//| hmirror: bool
|
||||
//| """Access the hmirror property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_hmirror(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_hmirror(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_hmirror_obj, esp32_camera_camera_get_hmirror);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_hmirror(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_hmirror_obj, esp32_camera_camera_set_hmirror);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_hmirror_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_hmirror_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_hmirror_obj);
|
||||
|
||||
//| vflip: bool
|
||||
//| """Access the vflip property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_vflip(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_vflip(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_vflip_obj, esp32_camera_camera_get_vflip);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_vflip(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_vflip_obj, esp32_camera_camera_set_vflip);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_vflip_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_vflip_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_vflip_obj);
|
||||
|
||||
//| aec2: bool
|
||||
//| """Access the aec2 property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_aec2(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_aec2(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec2_obj, esp32_camera_camera_get_aec2);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_aec2(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec2_obj, esp32_camera_camera_set_aec2);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_aec2_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_aec2_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_aec2_obj);
|
||||
|
||||
//| awb_gain: bool
|
||||
//| """Access the awb_gain property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_awb_gain(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_awb_gain(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_awb_gain_obj, esp32_camera_camera_get_awb_gain);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_awb_gain(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_awb_gain_obj, esp32_camera_camera_set_awb_gain);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_awb_gain_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_awb_gain_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_awb_gain_obj);
|
||||
|
||||
//| agc_gain: int
|
||||
//| """Access the agc_gain property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_agc_gain(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_agc_gain(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_agc_gain_obj, esp32_camera_camera_get_agc_gain);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_agc_gain(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_agc_gain_obj, esp32_camera_camera_set_agc_gain);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_agc_gain_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_agc_gain_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_agc_gain_obj);
|
||||
|
||||
//| aec_value: int
|
||||
//| """Access the aec_value property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_aec_value(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_aec_value(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec_value_obj, esp32_camera_camera_get_aec_value);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_aec_value(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec_value_obj, esp32_camera_camera_set_aec_value);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_aec_value_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_aec_value_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_aec_value_obj);
|
||||
|
||||
//| special_effect: int
|
||||
//| """Access the special_effect property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_special_effect(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_special_effect(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_special_effect_obj, esp32_camera_camera_get_special_effect);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_special_effect(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_special_effect_obj, esp32_camera_camera_set_special_effect);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_special_effect_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_special_effect_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_special_effect_obj);
|
||||
|
||||
//| wb_mode: int
|
||||
//| """Access the wb_mode property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_wb_mode(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_wb_mode(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wb_mode_obj, esp32_camera_camera_get_wb_mode);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_wb_mode(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wb_mode_obj, esp32_camera_camera_set_wb_mode);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_wb_mode_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_wb_mode_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_wb_mode_obj);
|
||||
|
||||
//| ae_level: int
|
||||
//| """Access the ae_level property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_ae_level(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_ae_level(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_ae_level_obj, esp32_camera_camera_get_ae_level);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_ae_level(self, mp_obj_get_int(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_ae_level_obj, esp32_camera_camera_set_ae_level);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_ae_level_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_ae_level_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_ae_level_obj);
|
||||
|
||||
//| dcw: bool
|
||||
//| """Access the dcw property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_dcw(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_dcw(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_dcw_obj, esp32_camera_camera_get_dcw);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_dcw(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_dcw_obj, esp32_camera_camera_set_dcw);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_dcw_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_dcw_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_dcw_obj);
|
||||
|
||||
//| bpc: bool
|
||||
//| """Access the bpc property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_bpc(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_bpc(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_bpc_obj, esp32_camera_camera_get_bpc);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_bpc(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_bpc_obj, esp32_camera_camera_set_bpc);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_bpc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_bpc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_bpc_obj);
|
||||
|
||||
//| wpc: bool
|
||||
//| """Access the wpc property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_wpc(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_wpc(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wpc_obj, esp32_camera_camera_get_wpc);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_wpc(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wpc_obj, esp32_camera_camera_set_wpc);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_wpc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_wpc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_wpc_obj);
|
||||
|
||||
//| raw_gma: bool
|
||||
//| """Access the raw_gma property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_raw_gma(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_raw_gma(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_raw_gma_obj, esp32_camera_camera_get_raw_gma);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_raw_gma(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_raw_gma_obj, esp32_camera_camera_set_raw_gma);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_raw_gma_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_raw_gma_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_raw_gma_obj);
|
||||
|
||||
//| lenc: bool
|
||||
//| """Access the lenc property of the camera sensor"""
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_get_lenc(const mp_obj_t self_in) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
return mp_obj_new_bool(common_hal_esp32_camera_camera_get_lenc(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_lenc_obj, esp32_camera_camera_get_lenc);
|
||||
|
||||
STATIC mp_obj_t esp32_camera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) {
|
||||
esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
common_hal_esp32_camera_camera_set_lenc(self, mp_obj_is_true(arg));
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_lenc_obj, esp32_camera_camera_set_lenc);
|
||||
MP_PROPERTY_GETSET(esp32_camera_camera_lenc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_get_lenc_obj,
|
||||
(mp_obj_t)&esp32_camera_camera_set_lenc_obj);
|
||||
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t esp32_camera_camera_locals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&esp32_camera_camera_take_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&esp32_camera_camera_frame_available_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&esp32_camera_camera_aec2_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&esp32_camera_camera_aec_value_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&esp32_camera_camera_ae_level_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&esp32_camera_camera_agc_gain_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&esp32_camera_camera_awb_gain_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&esp32_camera_camera_bpc_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&esp32_camera_camera_brightness_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&esp32_camera_camera_colorbar_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&esp32_camera_camera_contrast_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&esp32_camera_camera_dcw_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp32_camera_camera_deinit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&esp32_camera_camera_denoise_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&esp32_camera_camera___exit___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&esp32_camera_camera_exposure_ctrl_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&esp32_camera_camera_frame_available_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&esp32_camera_camera_frame_size_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&esp32_camera_camera_gain_ceiling_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&esp32_camera_camera_gain_ctrl_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&esp32_camera_camera_hmirror_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&esp32_camera_camera_lenc_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&esp32_camera_camera_pixel_format_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&esp32_camera_camera_quality_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&esp32_camera_camera_raw_gma_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&esp32_camera_camera_saturation_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&esp32_camera_camera_sharpness_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&esp32_camera_camera_special_effect_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&esp32_camera_camera_take_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&esp32_camera_camera_vflip_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&esp32_camera_camera_wb_mode_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&esp32_camera_camera_whitebal_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&esp32_camera_camera_wpc_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(esp32_camera_camera_locals_dict, esp32_camera_camera_locals_table);
|
||||
|
@ -57,3 +57,44 @@ extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *sel
|
||||
extern bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self);
|
||||
extern bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self);
|
||||
extern camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms);
|
||||
|
||||
#define DECLARE_SENSOR_GETSET(type, name, field_name, setter_function_name) \
|
||||
DECLARE_SENSOR_GET(type, name, field_name, setter_function_name) \
|
||||
DECLARE_SENSOR_SET(type, name, setter_function_name)
|
||||
|
||||
#define DECLARE_SENSOR_STATUS_GETSET(type, name, status_field_name, setter_function_name) \
|
||||
DECLARE_SENSOR_GETSET(type, name, status.status_field_name, setter_function_name)
|
||||
|
||||
#define DECLARE_SENSOR_GET(type, name, status_field_name, setter_function_name) \
|
||||
extern type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self);
|
||||
|
||||
#define DECLARE_SENSOR_SET(type, name, setter_function_name) \
|
||||
extern void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value);
|
||||
|
||||
DECLARE_SENSOR_GETSET(pixformat_t, pixel_format, pixformat, set_pixformat)
|
||||
DECLARE_SENSOR_STATUS_GETSET(framesize_t, frame_size, framesize, set_framesize)
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, contrast, contrast, set_contrast);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, brightness, brightness, set_brightness);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, saturation, saturation, set_saturation);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, sharpness, sharpness, set_sharpness);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, denoise, denoise, set_denoise);
|
||||
DECLARE_SENSOR_STATUS_GETSET(gainceiling_t, gainceiling, gainceiling, set_gainceiling);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, quality, quality, set_quality);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, colorbar, colorbar, set_colorbar);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, whitebal, whitebal, set_whitebal);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, gain_ctrl, gain_ctrl, set_gain_ctrl);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, exposure_ctrl, exposure_ctrl, set_exposure_ctrl);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, hmirror, hmirror, set_hmirror);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, vflip, vflip, set_vflip);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, aec2, aec2, set_aec2);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, awb_gain, awb_gain, set_awb_gain);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, agc_gain, agc_gain, set_agc_gain);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, aec_value, aec_value, set_aec_value);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, special_effect, special_effect, set_special_effect);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, wb_mode, wb_mode, set_wb_mode);
|
||||
DECLARE_SENSOR_STATUS_GETSET(int, ae_level, ae_level, set_ae_level);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, dcw, dcw, set_dcw);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, bpc, bpc, set_bpc);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma);
|
||||
DECLARE_SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc);
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include "esp_camera.h"
|
||||
#include "sensor.h"
|
||||
|
||||
int oooo;
|
||||
|
||||
//| """Wrapper for the esp32_camera library
|
||||
//|
|
||||
//| This library enables access to any camera sensor supported by the library,
|
||||
@ -225,10 +223,51 @@ framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) {
|
||||
return cp_enum_value(&esp32_camera_frame_size_type, mp_arg_validate_type(obj, &esp32_camera_frame_size_type, arg_name));
|
||||
}
|
||||
|
||||
//| class GainCeiling:
|
||||
//| """The maximum amount of gain applied to raw sensor data.
|
||||
//|
|
||||
//| Higher values are useful in darker conditions, but increase image noise."""
|
||||
//|
|
||||
//| GAIN_2X: GainCeiling
|
||||
//| GAIN_4X: GainCeiling
|
||||
//| GAIN_8X: GainCeiling
|
||||
//| GAIN_16X: GainCeiling
|
||||
//| GAIN_32X: GainCeiling
|
||||
//| GAIN_64X: GainCeiling
|
||||
//| GAIN_128X: GainCeiling
|
||||
//|
|
||||
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X);
|
||||
MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X);
|
||||
|
||||
MAKE_ENUM_MAP(esp32_camera_gain_ceiling) {
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_2X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_4X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_8X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_16X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_32X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_64X),
|
||||
MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_128X)
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(esp32_camera_gain_ceiling_locals_dict, esp32_camera_gain_ceiling_locals_table);
|
||||
MAKE_PRINTER(esp32_camera, esp32_camera_gain_ceiling);
|
||||
MAKE_ENUM_TYPE(esp32_camera, GainCeiling, esp32_camera_gain_ceiling);
|
||||
|
||||
gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name) {
|
||||
return cp_enum_value(&esp32_camera_gain_ceiling_type, mp_arg_validate_type(obj, &esp32_camera_gain_ceiling_type, arg_name));
|
||||
}
|
||||
|
||||
STATIC const mp_rom_map_elem_t esp32_camera_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32_camera) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&esp32_camera_camera_type), },
|
||||
{ MP_ROM_QSTR(MP_QSTR_FrameSize), &esp32_camera_frame_size_type },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GainCeiling), &esp32_camera_gain_ceiling_type },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GrabMode), &esp32_camera_grab_mode_type },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PixelFormat), &esp32_camera_pixel_format_type },
|
||||
};
|
||||
|
@ -37,7 +37,9 @@ extern const mp_obj_type_t esp32_camera_pixel_format_type;
|
||||
extern const cp_enum_obj_t pixel_format_RGB565_obj;
|
||||
extern const mp_obj_type_t esp32_camera_frame_size_type;
|
||||
extern const cp_enum_obj_t frame_size_QQVGA_obj;
|
||||
extern const mp_obj_type_t esp32_camera_gain_ceiling_type;
|
||||
|
||||
extern camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name);
|
||||
extern pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name);
|
||||
extern framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name);
|
||||
extern gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name);
|
||||
|
@ -24,6 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "bindings/esp32_camera/Camera.h"
|
||||
#include "bindings/espidf/__init__.h"
|
||||
#include "common-hal/esp32_camera/Camera.h"
|
||||
@ -142,3 +144,58 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self
|
||||
}
|
||||
return self->buffer_to_return = esp_camera_fb_get_timeout(timeout_ms);
|
||||
}
|
||||
|
||||
#define SENSOR_GETSET(type, name, field_name, setter_function_name) \
|
||||
SENSOR_GET(type, name, field_name, setter_function_name) \
|
||||
SENSOR_SET(type, name, setter_function_name)
|
||||
|
||||
#define SENSOR_STATUS_GETSET(type, name, status_field_name, setter_function_name) \
|
||||
SENSOR_GETSET(type, name, status.status_field_name, setter_function_name)
|
||||
|
||||
#define SENSOR_GET(type, name, status_field_name, setter_function_name) \
|
||||
type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self) { \
|
||||
sensor_t *sensor = esp_camera_sensor_get(); \
|
||||
if (!sensor->setter_function_name) { \
|
||||
mp_raise_AttributeError(translate("no such attribute")); \
|
||||
} \
|
||||
return sensor->status_field_name; \
|
||||
}
|
||||
|
||||
#define SENSOR_SET(type, name, setter_function_name) \
|
||||
void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value) { \
|
||||
sensor_t *sensor = esp_camera_sensor_get(); \
|
||||
if (!sensor->setter_function_name) { \
|
||||
mp_raise_AttributeError(translate("no such attribute")); \
|
||||
} \
|
||||
if (sensor->setter_function_name(sensor, value) < 0) { \
|
||||
mp_raise_ValueError(translate("invalid setting")); \
|
||||
} \
|
||||
}
|
||||
|
||||
SENSOR_GETSET(pixformat_t, pixel_format, pixformat, set_pixformat);
|
||||
SENSOR_STATUS_GETSET(framesize_t, frame_size, framesize, set_framesize);
|
||||
SENSOR_STATUS_GETSET(int, contrast, contrast, set_contrast);
|
||||
SENSOR_STATUS_GETSET(int, brightness, brightness, set_brightness);
|
||||
SENSOR_STATUS_GETSET(int, saturation, saturation, set_saturation);
|
||||
SENSOR_STATUS_GETSET(int, sharpness, sharpness, set_sharpness);
|
||||
SENSOR_STATUS_GETSET(int, denoise, denoise, set_denoise);
|
||||
SENSOR_STATUS_GETSET(gainceiling_t, gainceiling, gainceiling, set_gainceiling);
|
||||
SENSOR_STATUS_GETSET(int, quality, quality, set_quality);
|
||||
SENSOR_STATUS_GETSET(bool, colorbar, colorbar, set_colorbar);
|
||||
SENSOR_STATUS_GETSET(bool, whitebal, awb, set_whitebal);
|
||||
SENSOR_STATUS_GETSET(bool, gain_ctrl, agc, set_gain_ctrl);
|
||||
SENSOR_STATUS_GETSET(bool, exposure_ctrl, aec, set_exposure_ctrl);
|
||||
SENSOR_STATUS_GETSET(bool, hmirror, hmirror, set_hmirror);
|
||||
SENSOR_STATUS_GETSET(bool, vflip, vflip, set_vflip);
|
||||
SENSOR_STATUS_GETSET(bool, aec2, aec2, set_aec2);
|
||||
SENSOR_STATUS_GETSET(bool, awb_gain, awb_gain, set_awb_gain);
|
||||
SENSOR_STATUS_GETSET(int, agc_gain, agc_gain, set_agc_gain);
|
||||
SENSOR_STATUS_GETSET(int, aec_value, aec_value, set_aec_value);
|
||||
SENSOR_STATUS_GETSET(int, special_effect, special_effect, set_special_effect);
|
||||
SENSOR_STATUS_GETSET(int, wb_mode, wb_mode, set_wb_mode);
|
||||
SENSOR_STATUS_GETSET(int, ae_level, ae_level, set_ae_level);
|
||||
SENSOR_STATUS_GETSET(bool, dcw, dcw, set_dcw);
|
||||
SENSOR_STATUS_GETSET(bool, bpc, bpc, set_bpc);
|
||||
SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc);
|
||||
SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma);
|
||||
SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user