Skip to content

Commit

Permalink
Should solve #1
Browse files Browse the repository at this point in the history
  • Loading branch information
cnadler86 committed Oct 6, 2024
1 parent 3650ff8 commit e0c2401
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
32 changes: 16 additions & 16 deletions src/modcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,46 @@
#include "sensor.h"

#ifndef MICROPY_CAMERA_PIN_PWDN
#define MICROPY_CAMERA_PIN_PWDN 32
#define MICROPY_CAMERA_PIN_PWDN -1
#endif

#ifndef MICROPY_CAMERA_PIN_RESET
#define MICROPY_CAMERA_PIN_RESET -1
#endif

#ifndef MICROPY_CAMERA_PIN_SIOD
#define MICROPY_CAMERA_PIN_SIOD 26
#define MICROPY_CAMERA_PIN_SIOD -1
#endif

#ifndef MICROPY_CAMERA_PIN_SIOC
#define MICROPY_CAMERA_PIN_SIOC 27
#define MICROPY_CAMERA_PIN_SIOC -1
#endif

#ifndef MICROPY_CAMERA_PIN_D0
#define MICROPY_CAMERA_PIN_D0 5
#define MICROPY_CAMERA_PIN_D1 18
#define MICROPY_CAMERA_PIN_D2 19
#define MICROPY_CAMERA_PIN_D3 21
#define MICROPY_CAMERA_PIN_D4 36
#define MICROPY_CAMERA_PIN_D5 39
#define MICROPY_CAMERA_PIN_D6 34
#define MICROPY_CAMERA_PIN_D7 35
#ifndef MICROPY_CAMERA_PIN_D0 -1
#define MICROPY_CAMERA_PIN_D0 -1
#define MICROPY_CAMERA_PIN_D1 -1
#define MICROPY_CAMERA_PIN_D2 -1
#define MICROPY_CAMERA_PIN_D3 -1
#define MICROPY_CAMERA_PIN_D4 -1
#define MICROPY_CAMERA_PIN_D5 -1
#define MICROPY_CAMERA_PIN_D6 -1
#define MICROPY_CAMERA_PIN_D7 -1
#endif

#ifndef MICROPY_CAMERA_PIN_VSYNC
#define MICROPY_CAMERA_PIN_VSYNC 25
#define MICROPY_CAMERA_PIN_VSYNC -1
#endif

#ifndef MICROPY_CAMERA_PIN_HREF
#define MICROPY_CAMERA_PIN_HREF 23
#define MICROPY_CAMERA_PIN_HREF -1
#endif

#ifndef MICROPY_CAMERA_PIN_PCLK
#define MICROPY_CAMERA_PIN_PCLK 22
#define MICROPY_CAMERA_PIN_PCLK -1
#endif

#ifndef MICROPY_CAMERA_PIN_XCLK
#define MICROPY_CAMERA_PIN_XCLK 0
#define MICROPY_CAMERA_PIN_XCLK -1
#endif

#ifndef MICROPY_CAMERA_XCLK_FREQ
Expand Down
20 changes: 12 additions & 8 deletions src/modcamera_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ static mp_obj_t mp_camera_make_new(const mp_obj_type_t *type, size_t n_args, siz
int8_t data_pins[8];
mp_obj_t data_pins_obj = args[ARG_data_pins].u_obj;
if (data_pins_obj == MP_ROM_NONE) {
data_pins[0] = MICROPY_CAMERA_PIN_D0;
data_pins[1] = MICROPY_CAMERA_PIN_D1;
data_pins[2] = MICROPY_CAMERA_PIN_D2;
data_pins[3] = MICROPY_CAMERA_PIN_D3;
data_pins[4] = MICROPY_CAMERA_PIN_D4;
data_pins[5] = MICROPY_CAMERA_PIN_D5;
data_pins[6] = MICROPY_CAMERA_PIN_D6;
data_pins[7] = MICROPY_CAMERA_PIN_D7;
if (MICROPY_CAMERA_PIN_D0 != -1) {
data_pins[0] = MICROPY_CAMERA_PIN_D0;
data_pins[1] = MICROPY_CAMERA_PIN_D1;
data_pins[2] = MICROPY_CAMERA_PIN_D2;
data_pins[3] = MICROPY_CAMERA_PIN_D3;
data_pins[4] = MICROPY_CAMERA_PIN_D4;
data_pins[5] = MICROPY_CAMERA_PIN_D5;
data_pins[6] = MICROPY_CAMERA_PIN_D6;
data_pins[7] = MICROPY_CAMERA_PIN_D7;
} else {
mp_raise_OSError(MP_ERROR_TEXT("Specify a valid camera configuration"))
}
} else {
if (!mp_obj_is_type(data_pins_obj, &mp_type_list) && !mp_obj_is_type(data_pins_obj, &mp_type_bytearray)) {
mp_raise_TypeError(MP_ERROR_TEXT("data_pins must be a list or bytearray"));
Expand Down

0 comments on commit e0c2401

Please sign in to comment.