8000 Merge pull request #7941 from bill88t/m5timer · rbrian/circuitpython@02cb13e · GitHub
[go: up one dir, main page]

Skip to content

Commit 02cb13e

Browse files
authored
Merge pull request adafruit#7941 from bill88t/m5timer
M5 Timer Camera X
2 parents 802628c + a731c26 commit 02cb13e

File tree

5 files changed

+219
-0
lines changed

5 files changed

+219
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2023 Bill Sideris, independently providing these changes.
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "supervisor/board.h"
28+
#include "mpconfigboard.h"
29+
#include "shared-bindings/microcontroller/Pin.h"
30+
#include "components/driver/include/driver/gpio.h"
31+
#include "components/hal/include/hal/gpio_hal.h"
32+
#include "common-hal/microcontroller/Pin.h"
33+
34+
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
35+
if (pin_number == 33) {
36+
/*
37+
* Turn on BAT_HOLD by default,
38+
* so that the board does not power off
39+
* when usb is disconnected or
40+
* the power button is released.
41+
*/
42+
gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT);
43+
gpio_set_level(pin_number, true);
44+
return true;
45+
}
46+
return false;
47+
}
48+
49+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2023 Bill Sideris, independently providing these changes.
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17< E864 /code>+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#define MICROPY_HW_BOARD_NAME "M5Stack Timer Camera X"
28+
#define MICROPY_HW_MCU_NAME "ESP32"
29+
30+
#define MICROPY_HW_LED_STATUS (&pin_GPIO2)
31+
32+
#define CIRCUITPY_BOARD_I2C (3)
33+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO13, .sda = &pin_GPIO4}, \
34+
{.scl = &pin_GPIO14, .sda = &pin_GPIO12}, \
35+
{.scl = &pin_GPIO23, .sda = &pin_GPIO25}}
36+
37+
// Ext. Port
38+
// BM8563
39+
// Camera sensor
40+
41+
// UART pins attached to the USB-serial converter chip
42+
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1)
43+
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3)
44+
45+
#define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (1)
46+
47+
// espcamera.FrameSize.QXGA, half a megabyte result image.jpeg
48+
#define DEFAULT_RESERVED_PSRAM (1572864)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CIRCUITPY_CREATOR_ID = 0x10151015
2+
CIRCUITPY_CREATION_ID = 0x00320009
3+
4+
IDF_TARGET = esp32
5+
6+
CIRCUITPY_ESP_FLASH_MODE = qio
7+
CIRCUITPY_ESP_FLASH_FREQ = 80m
8+
CIRCUITPY_ESP_FLASH_SIZE = 4MB
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#include "py/objtuple.h"
2+
#include "shared-bindings/board/__init__.h"
3+
#include "shared-module/displayio/__init__.h"
4+
5+
CIRCUITPY_BOARD_BUS_SINGLETON(bm8563_i2c, i2c, 1) // RTC
6+
CIRCUITPY_BOARD_BUS_SINGLETON(sscb_i2c, i2c, 2) // Camera sensor
7+
8+
STATIC const mp_rom_obj_tuple_t camera_data_tuple = {
9+
// The order matters.
10+
// They must be ordered from low to high (Y2, Y3 .. Y9).
11+
12+
// Do not include any of the control pins in here.
13+
{&mp_type_tuple},
14+
8,
15+
{
16+
MP_ROM_PTR(&pin_GPIO32), // Y2
17+
MP_ROM_PTR(&pin_GPIO35), // Y3
18+
MP_ROM_PTR(&pin_GPIO34), // Y4
19+
MP_ROM_PTR(&pin_GPIO5), // Y5
20+
MP_ROM_PTR(&pin_GPIO39), // Y6
21+
MP_ROM_PTR(&pin_GPIO18), // Y7
22+
MP_ROM_PTR(&pin_GPIO36), // Y8
23+
MP_ROM_PTR(&pin_GPIO19) // Y9
24+
}
25+
};
26+
27+
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
28+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
29+
30+
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) },
31+
32+
// "Ext. Port", the label says [G, V, SDA/G4, SCL/G13]
33+
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO4) },
34+
{ MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) },
35+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) },
36+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) },
37+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
38+
39+
/* Battery
40+
*
41+
* No alternative names as they are not broken out
42+
* and cannot be used for anything else.
43+
*/
44+
{ MP_ROM_QSTR(MP_QSTR_BAT_HOLD), MP_ROM_PTR(&pin_GPIO33) },
45+
{ MP_ROM_QSTR(MP_QSTR_BAT_ADC), MP_ROM_PTR(&pin_GPIO38) },
46+
47+
/* BM8563 I2C bus
48+
*
49+
* No alternative names as they are not broken out
50+
* and cannot be used for anything else.
51+
*/
52+
{ MP_ROM_QSTR(MP_QSTR_BM8563_SCL), MP_ROM_PTR(&pin_GPIO14) },
53+
{ MP_ROM_QSTR(MP_QSTR_BM8563_SDA), MP_ROM_PTR(&pin_GPIO12) },
54+
{ MP_ROM_QSTR(MP_QSTR_BM8563_I2C), MP_ROM_PTR(&board_bm8563_i2c_obj) },
55+
56+
// Camera control
57+
{ MP_ROM_QSTR(MP_QSTR_VSYNC), MP_ROM_PTR(&pin_GPIO22) },
58+
{ MP_ROM_QSTR(MP_QSTR_HREF), MP_ROM_PTR(&pin_GPIO26) },
59+
{ MP_ROM_QSTR(MP_QSTR_PCLK), MP_ROM_PTR(&pin_GPIO21) },
60+
{ MP_ROM_QSTR(MP_QSTR_XCLK), MP_ROM_PTR(&pin_GPIO27) }, // xclk_freq_hz = 20000000
61+
{ MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_GPIO15) },
62+
63+
// Camera sensor I2C bus
64+
{ MP_ROM_QSTR(MP_QSTR_SSCB_SDA), MP_ROM_PTR(&pin_GPIO25) },
65+
{ MP_ROM_QSTR(MP_QSTR_SSCB_SCL), MP_ROM_PTR(&pin_GPIO23) },
66+
{ MP_ROM_QSTR(MP_QSTR_SSCB_I2C), MP_ROM_PTR(&board_sscb_i2c_obj) },
67+
68+
/*
69+
* Camera data
70+
*
71+
* We don't really need to individually name each one,
72+
* but they look cool in the tuple listing if we do.
73+
*
74+
* These are also not broken out.
75+
*/
76+
{ MP_ROM_QSTR(MP_QSTR_D), MP_ROM_PTR(&camera_data_tuple) },
77+
78+
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO19) },
79+
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO36) },
80+
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO18) },
81+
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO39) },
82+
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
83+
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO34) },
84+
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO35) },
85+
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO32) }
86+
};
87+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ESP32-D0WDQ6-V3 (revision 3)
2+
CONFIG_ESP32_SPIRAM_SUPPORT=y
3+
CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y
4+
CONFIG_ESP32_REV_MIN_3=y
5+
6+
# PSRAM
7+
CONFIG_D0WD_PSRAM_CLK_IO=17
8+
CONFIG_D0WD_PSRAM_CS_IO=16
9+
10+
CONFIG_SPIRAM_MODE_OCT=y
11+
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
12+
CONFIG_SPIRAM_SIZE=8388608
13+
CONFIG_SPIRAM_SPEED_80M=y
14+
15+
CONFIG_SPIRAM=y
16+
CONFIG_SPIRAM_BOOT_INIT=y
17+
CONFIG_SPIRAM_USE_MEMMAP=y
18+
CONFIG_SPIRAM_MEMTEST=y
19+
20+
# Hostname
21+
CONFIG_LWIP_LOCAL_HOSTNAME="M5StackTimerX"
22+
23+
# Camera
24+
CONFIG_OV3660_SUPPORT=y
25+
CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y
26+
CONFIG_CAMERA_CORE0=y
27+
CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768

0 commit comments

Comments
 (0)
0