Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Devices/m5stack-cores3/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ display.shape=rectangle
display.dpi=200

lvgl.colorDepth=16

sdkconfig.CONFIG_ESP_VIDEO_ENABLE_DVP_VIDEO_DEVICE=y
sdkconfig.CONFIG_CAMERA_GC0308=y
sdkconfig.CONFIG_CAMERA_GC0308_DVP_RGB565_BE_320X240_20FPS=y
sdkconfig.CONFIG_CAMERA_GC0308_DVP_RGB565_BE_640X480_16FPS=n
sdkconfig.CONFIG_CAMERA_GC0308_DVP_YUV422_YUYV_640X480_16FPS=n
sdkconfig.CONFIG_CAMERA_GC0308_DVP_DEFAULT_FMT_RGB565_BE_320X240_20FPS=y
21 changes: 21 additions & 0 deletions Devices/m5stack-cores3/m5stack,cores3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <bindings/es7210.h>
#include <bindings/ft5x06.h>
#include <bindings/ili9341.h>
#include <bindings/gc0308.h>

// SD card is not supported because of a hardware problem:
// The display uses pin 35 as input (MISO), but the SPI bus (and SD card) uses the same pin as DC (output).
Expand Down Expand Up @@ -64,6 +65,7 @@
bmi270 {
compatible = "bosch,bmi270";
reg = <0x69>;
invert-x;
};

bm8563 {
Expand Down Expand Up @@ -151,6 +153,25 @@
// capsules on their own.
input-gain-percent = <400>;
};

gc0308 {
compatible = "galaxycore,gc0308";
reg = <0x21>;
rotation-offset = <0>;
xclk-frequency-hz = <20000000>;
pin-d0 = <&gpio0 39 GPIO_FLAG_NONE>;
pin-d1 = <&gpio0 40 GPIO_FLAG_NONE>;
pin-d2 = <&gpio0 41 GPIO_FLAG_NONE>;
pin-d3 = <&gpio0 42 GPIO_FLAG_NONE>;
pin-d4 = <&gpio0 15 GPIO_FLAG_NONE>;
pin-d5 = <&gpio0 16 GPIO_FLAG_NONE>;
pin-d6 = <&gpio0 48 GPIO_FLAG_NONE>;
pin-d7 = <&gpio0 47 GPIO_FLAG_NONE>;
pin-vsync = <&gpio0 46 GPIO_FLAG_NONE>;
pin-de = <&gpio0 38 GPIO_FLAG_NONE>;
pin-pclk = <&gpio0 45 GPIO_FLAG_NONE>;
pin-reset = <&aw9523b 8 GPIO_FLAG_ACTIVE_LOW>;
};
};

port_a: grove0 {
Expand Down
1 change: 1 addition & 0 deletions Devices/m5stack-cores3/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- Drivers/aw9523b-module
- Drivers/axp2101-module
- Drivers/bm8563-module
- Drivers/gc0308-module
- Drivers/bmi270-module
- Drivers/es7210-module
- Drivers/ft5x06-module
Expand Down
7 changes: 7 additions & 0 deletions Devices/m5stack-stackchan/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ display.shape=rectangle
display.dpi=200

lvgl.colorDepth=16

sdkconfig.CONFIG_ESP_VIDEO_ENABLE_DVP_VIDEO_DEVICE=y
sdkconfig.CONFIG_CAMERA_GC0308=y
sdkconfig.CONFIG_CAMERA_GC0308_DVP_RGB565_BE_320X240_20FPS=y
sdkconfig.CONFIG_CAMERA_GC0308_DVP_RGB565_BE_640X480_16FPS=n
sdkconfig.CONFIG_CAMERA_GC0308_DVP_YUV422_YUYV_640X480_16FPS=n
sdkconfig.CONFIG_CAMERA_GC0308_DVP_DEFAULT_FMT_RGB565_BE_320X240_20FPS=y
30 changes: 25 additions & 5 deletions Devices/m5stack-stackchan/m5stack,stackchan.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
#include <bindings/bm8563.h>
#include <bindings/bmi270.h>
#include <bindings/es7210.h>
#include <bindings/ft6x36.h>
#include <bindings/ft5x06.h>
#include <bindings/ili9341.h>
#include <bindings/ina226.h>
#include <bindings/py32ioexpander.h>
#include <bindings/gc0308.h>

// Reference: https://docs.m5stack.com/en/StackChan
/ {
Expand Down Expand Up @@ -69,6 +70,7 @@
bmi270 {
compatible = "bosch,bmi270";
reg = <0x69>;
invert-x;
};

bm8563 {
Expand Down Expand Up @@ -143,10 +145,10 @@
};

touch {
compatible = "focaltech,ft6x36";
compatible = "focaltech,ft5x06";
reg = <0x38>;
x-max = <319>;
y-max = <239>;
x-max = <320>;
y-max = <240>;
pin-reset = <&aw9523b 0 GPIO_FLAG_NONE>;
};

Expand All @@ -165,8 +167,26 @@
input-gain-percent = <400>;
};

gc0308 {
compatible = "galaxycore,gc0308";
reg = <0x21>;
rotation-offset = <0>;
xclk-frequency-hz = <20000000>;
pin-d0 = <&gpio0 39 GPIO_FLAG_NONE>;
pin-d1 = <&gpio0 40 GPIO_FLAG_NONE>;
pin-d2 = <&gpio0 41 GPIO_FLAG_NONE>;
pin-d3 = <&gpio0 42 GPIO_FLAG_NONE>;
pin-d4 = <&gpio0 15 GPIO_FLAG_NONE>;
pin-d5 = <&gpio0 16 GPIO_FLAG_NONE>;
pin-d6 = <&gpio0 48 GPIO_FLAG_NONE>;
pin-d7 = <&gpio0 47 GPIO_FLAG_NONE>;
pin-vsync = <&gpio0 46 GPIO_FLAG_NONE>;
pin-de = <&gpio0 38 GPIO_FLAG_NONE>;
pin-pclk = <&gpio0 45 GPIO_FLAG_NONE>;
pin-reset = <&aw9523b 8 GPIO_FLAG_ACTIVE_LOW>;
};

// TODO: Si12T 3-zone head touch @ 0x68 — INT active-low, 10kΩ pull-up to 3.3V; driver not yet implemented
// TODO: GC0308 camera @ 0x21 — requires i2c_master driver, not yet available
// TODO: LTR-553ALS-WA proximity/light @ 0x23 — no driver yet
// TODO: BMM150 magnetometer @ 0x10 — accessible only via BMI270 aux I2C
};
Expand Down
3 changes: 2 additions & 1 deletion Devices/m5stack-stackchan/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ dependencies:
- Drivers/aw9523b-module
- Drivers/axp2101-module
- Drivers/bm8563-module
- Drivers/gc0308-module
- Drivers/bmi270-module
- Drivers/es7210-module
- Drivers/ft6x36-module
- Drivers/ft5x06-module
- Drivers/ili9341-module
- Drivers/ina226-module
- Drivers/py32ioexpander-module
Expand Down
6 changes: 5 additions & 1 deletion Devices/m5stack-tab5/Source/devices/display_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ bool pulse_display_reset_pins(Device* io_expander0) {
gpio_descriptor_set_level(lcd_reset_pin, true);
gpio_descriptor_set_level(touch_reset_pin, true);
vTaskDelay(pdMS_TO_TICKS(10));
gpio_descriptor_set_level(lcd_reset_pin, false);
if (gpio_descriptor_set_flags(lcd_reset_pin, GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP) != ERROR_NONE) {
gpio_descriptor_release(lcd_reset_pin);
gpio_descriptor_release(touch_reset_pin);
return false;
}
gpio_descriptor_set_level(touch_reset_pin, false);

gpio_descriptor_release(lcd_reset_pin);
Expand Down
1 change: 1 addition & 0 deletions Devices/m5stack-tab5/m5stack,tab5.dts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@

sc2356 {
compatible = "smartsens,sc2356";
rotation-offset = <270>;
reg = <0x36>;
// Pulsed by the sc2356 driver itself in start_device, not a gpio-hog: the driver's
// I2C probe otherwise races a bare hog's pin release with no settle delay (the hog
Expand Down
28 changes: 27 additions & 1 deletion Drivers/bmi270-module/bindings/bosch,bmi270.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
description: Bosch BMI270 6-axis IMU

include: ["i2c-device.yaml"]
include: [ "i2c-device.yaml" ]

compatible: "bosch,bmi270"

properties:
swap-xy:
type: boolean
default: false
description: Swap the X and Y axes
swap-xz:
type: boolean
default: false
description: Swap the X and Z axes
swap-yz:
type: boolean
default: false
description: Swap the Y and Z axes
invert-x:
type: boolean
default: false
description: Invert the X axis
invert-y:
type: boolean
default: false
description: Invert the Y axis
invert-z:
type: boolean
default: false
description: Invert the Z axis
6 changes: 6 additions & 0 deletions Drivers/bmi270-module/include/drivers/bmi270.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ extern "C" {
struct Bmi270Config {
/** Address on bus */
uint8_t address;
bool swap_xy;
bool swap_xz;
bool swap_yz;
bool invert_x;
bool invert_y;
bool invert_z;
};

/**
Expand Down
20 changes: 17 additions & 3 deletions Drivers/bmi270-module/source/bmi270.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <tactility/drivers/i2c_controller.h>
#include <tactility/log.h>

#include <algorithm>

#define TAG "BMI270"

static constexpr uint8_t REG_CHIP_ID = 0x00; // read: expect 0x24
Expand Down Expand Up @@ -165,9 +167,21 @@ error_t bmi270_read_accel(Device* device, ImuAccelData* data) {
return static_cast<int16_t>(static_cast<uint16_t>(hi) << 8 | lo);
};

data->ax = toI16(buffer[0], buffer[1]) * ACCEL_SCALE;
data->ay = toI16(buffer[2], buffer[3]) * ACCEL_SCALE;
data->az = toI16(buffer[4], buffer[5]) * ACCEL_SCALE;
float axes[3] = {
toI16(buffer[0], buffer[1]) * ACCEL_SCALE,
toI16(buffer[2], buffer[3]) * ACCEL_SCALE,
toI16(buffer[4], buffer[5]) * ACCEL_SCALE,
};
const auto& config = *GET_CONFIG(device);
if (config.swap_xy) std::swap(axes[0], axes[1]);
if (config.swap_xz) std::swap(axes[0], axes[2]);
if (config.swap_yz) std::swap(axes[1], axes[2]);
if (config.invert_x) axes[0] = -axes[0];
if (config.invert_y) axes[1] = -axes[1];
if (config.invert_z) axes[2] = -axes[2];
data->ax = axes[0];
data->ay = axes[1];
data->az = axes[2];

return ERROR_NONE;
}
Expand Down
11 changes: 11 additions & 0 deletions Drivers/gc0308-module/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.20)

include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/module.cmake")

file(GLOB_RECURSE SOURCE_FILES "source/*.c*")

tactility_add_module(gc0308-module
SRCS ${SOURCE_FILES}
INCLUDE_DIRS include/
REQUIRES TactilityKernel platform-esp32 esp_video esp_cam_sensor driver esp_new_jpeg
)
Loading
Loading