Skip to content

Commit

Permalink
Update libdeps
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 26, 2024
1 parent 7d2bb69 commit 44459cf
Show file tree
Hide file tree
Showing 50 changed files with 2,677 additions and 520 deletions.
2 changes: 1 addition & 1 deletion libdeps/SensorLib/.piopm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "library", "name": "SensorLib", "version": "0.1.4", "spec": {"owner": "lewisxhe", "id": 15035, "name": "SensorLib", "requirements": null, "uri": null}}
{"type": "library", "name": "SensorLib", "version": "0.1.6", "spec": {"owner": "lewisxhe", "id": 15035, "name": "SensorLib", "requirements": null, "uri": null}}
40 changes: 24 additions & 16 deletions libdeps/SensorLib/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
```
_____ _ _ _
/ ___| | | (_)| |
\ `--. ___ _ __ ___ ___ _ __ | | _ | |__
`--. \ / _ \| '_ \ / __| / _ \ | '__|| | | || '_ \
_____ _ _ _
/ ___| | | (_)| |
\ `--. ___ _ __ ___ ___ _ __ | | _ | |__
`--. \ / _ \| '_ \ / __| / _ \ | '__|| | | || '_ \
/\__/ /| __/| | | |\__ \| (_) || | | |____| || |_) |
\____/ \___||_| |_||___/ \___/ |_| \_____/|_||_.__/
··· ···
> Commonly used I2C , SPI device libraries
\____/ \___||_| |_||___/ \___/ |_| \_____/|_||_.__/
··· ···
> Commonly used I2C , SPI device multi-platform libraries
```

[![Build esp-idf](https://github.com/lewisxhe/SensorLib/actions/workflows/esp-idf.yml/badge.svg)](https://github.com/lewisxhe/SensorLib/actions/workflows/esp-idf.yml)
[![Arduino CI](https://github.com/lewisxhe/SensorLib/actions/workflows/arduino_ci.yml/badge.svg)](https://github.com/lewisxhe/SensorLib/actions/workflows/arduino_ci.yml)
[![PlatformIO CI](https://github.com/lewisxhe/SensorLib/actions/workflows/pio.yml/badge.svg)](https://github.com/lewisxhe/SensorLib/actions/workflows/pio.yml)
[![arduino-library-badge](https://www.ardu-badge.com/badge/Sensor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cgNzMuMTg2IDg1LjI2N1Y2OC44OTJzLTEyLjI1Mi0uMDYyLTI2LjcyOSAzLjgxN3ptMTAuMzk1IDkyLjA5Yy04LjEzOCAxMC4yLTUyLjczNS0yNS44OC00NS4xNTQtNTEuNjQ1IDMuMDAyLTEyLjE0NSAxMy4xOS0xNy42MTIgMjEuNTExLTE2LjI4IDMwLjM1IDYuMTc1IDM1LjI2IDQ5LjM2OSAyMy42NDMgNjcuOTI2em0tMTguODItMzkuNDZhOS4zOTkgOS4zOTkgMCAwIDAtOS4zOTkgOS4zOTggOS4zOTkgOS4zOTkgMCAwIDAgOS40IDkuNCA5LjM5OSA5LjM5OSAwIDAgMCA5LjM5OC05LjQgOS4zOTkgOS4zOTkgMCAwIDAtOS4zOTktOS4zOTl6bS0yLjgxIDguNjcxYTIuMzc0IDIuMzc0IDAgMSAxIDAtNC43NDggMi4zNzQgMi4zNzQgMCAwIDEgMCA0Ljc0OHoiIGZpbGw9IiNGRjdGMDAiLz48L3N2Zz4=)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/lewisxhe/library/SensorLib.svg)](https://registry.platformio.org/libraries/lewisxhe/SensorLib)


[![LICENSE](https://img.shields.io/github/license/lewisxhe/SensorLib)](https://github.com/lewisxhe/SensorLib/blob/master/LICENSE)
[![ISSUES](https://img.shields.io/github/issues/lewisxhe/SensorsLib)](https://github.com/lewisxhe/SensorsLib/issues)
Expand All @@ -33,14 +35,18 @@
![DRV2605](https://img.shields.io/badge/DRV2605-teal)
![CM32181](https://img.shields.io/badge/CM32181-brown)
![LTR553](https://img.shields.io/badge/LTR553-brown)
![FT6X36](https://img.shields.io/badge/FT6X36-red)
![FT5206](https://img.shields.io/badge/FT5206-red)
![FT6206](https://img.shields.io/badge/FT6206-red)
![FT6236](https://img.shields.io/badge/FT6236-red)
![FT3267](https://img.shields.io/badge/FT3267-red)
![CST816S](https://img.shields.io/badge/CST816S-red)
![CST816D](https://img.shields.io/badge/CST816D-red)
![CST816T](https://img.shields.io/badge/CST816T-red)
![CST820](https://img.shields.io/badge/CST820-red)
![CST226SE](https://img.shields.io/badge/CST226SE-red)
![CHSC5816](https://img.shields.io/badge/CHSC5816-red)
![GT911](https://img.shields.io/badge/GT911-red)



Support list:

| Sensor | Description | I2C | SPI |
Expand All @@ -56,10 +62,12 @@ Support list:
| DRV2605 | Haptic Driver | ✔️ ||
| CM32181 | Ambient Light Sensor | ✔️ ||
| LTR553 | Light & Proximity Sensor | ✔️ ||
| FT6X36 | Capacitive touch | ✔️ ||
| CST816T | Capacitive touch | ✔️ ||
| FT3267 | Capacitive touch | ✔️ ||
| FT5206 | Capacitive touch | ✔️ ||
| FT6206 | Capacitive touch | ✔️ ||
| FT6236 | Capacitive touch | ✔️ ||
| CST820 | Capacitive touch | ✔️ ||
| CST816S/T/D | Capacitive touch | ✔️ ||
| CST226SE | Capacitive touch | ✔️ ||
| CHSC5816 | Capacitive touch | ✔️ ||
| GT911 | Capacitive touch | ✔️ ||


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(EXTRA_COMPONENT_DIRS ../../../SensorLib)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ESP_IDF_TouchDrv_Example)
10 changes: 10 additions & 0 deletions libdeps/SensorLib/examples/ESP_IDF_TouchDrv_Example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#

PROJECT_NAME := ESP_IDF_TouchDrv_Example

EXTRA_COMPONENT_DIRS = ../../../SensorLib

include $(IDF_PATH)/make/project.mk
181 changes: 181 additions & 0 deletions libdeps/SensorLib/examples/ESP_IDF_TouchDrv_Example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# ESP_IDF_TouchDrv_Example

```
The current example only writes the CSTxxx series touch application.
The other sensors have not been added, but the methods are the same.
```


### Configure the Project

Open the project configuration menu (`idf.py menuconfig`).


In the `SensorLib Example Configuration` menu:

* Select the PMU Type in the `SensorLib read and write methods` option,Choose according to the situation
1. Implemented using built-in read and write methods (Read and write methods are provided internally by SensorLib, supporting high version esp-idf >= 5.0, and low version methods (< 5.0))
2. Implemented using read and write callback methods (Implemented using externally provided methods, suitable for multiple platforms)
* In `Sensor SCL GPIO Num` select the clock pin to connect to the PMU,the default is 17
* In `Sensor SDA GPIO Num` select the data pin connected to the PMU,the default is 18
* Select the interrupt pin connected to the PMU in `Sensor Interrupt Pin`, the default is 16
* Select `Sensor reset Pin` , the default is 21
* `Master Frequency` The maximum communication frequency defaults to 100000HZ, and you can decide whether to change it according to the situation.

## How to Use Example

Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`. default use **esp32s3**


### Build and Flash

Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.

(To exit the serial monitor, type ``Ctrl-]``.)

See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.

## Example Output

The output information is to configure the output voltage and enable status of the PMU

```
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xa (SPI_FAST_FLASH_BOOT)
Saved PC:0x403788f6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x178c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xbfc
load:0x403cc700,len:0x2d64
entry 0x403c9900
I (26) boot: ESP-IDF v5.3-dev-1288-g5524b692ee 2nd stage bootloader
I (27) boot: compile time Jan 10 2024 22:49:17
I (27) boot: Multicore bootloader
I (31) boot: chip revision: v0.2
I (35) boot.esp32s3: Boot SPI Speed : 80MHz
I (40) boot.esp32s3: SPI Mode : DIO
I (45) boot.esp32s3: SPI Flash Size : 2MB
I (49) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (58) boot: ## Label Usage Type ST Offset Length
I (66) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (73) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (81) boot: 2 factory factory app 00 00 00010000 00100000
I (88) boot: End of partition table
I (92) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0e0dch ( 57564) map
I (111) esp_image: segment 1: paddr=0001e104 vaddr=3fc93100 size=01f14h ( 7956) load
I (113) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=1acb0h (109744) map
I (137) esp_image: segment 3: paddr=0003acd8 vaddr=3fc95014 size=00994h ( 2452) load
I (138) esp_image: segment 4: paddr=0003b674 vaddr=40374000 size=0f0e0h ( 61664) load
I (163) boot: Loaded app from partition at offset 0x10000
I (163) boot: Disabling RNG early entropy source...
I (163) cpu_start: Multicore app
I (176) cpu_start: Pro cpu start user code
I (176) cpu_start: cpu freq: 240000000 Hz
I (177) cpu_start: Application information:
I (177) cpu_start: Project name: ESP_IDF_TouchDrv_Example
I (177) cpu_start: App version: v0.1.4-6-gfeaf675-dirty
I (177) cpu_start: Compile time: Jan 11 2024 14:01:31
I (177) cpu_start: ELF file SHA256: 3ce1527fc...
I (178) cpu_start: ESP-IDF: v5.3-dev-1288-g5524b692ee
I (178) cpu_start: Min chip rev: v0.0
I (178) cpu_start: Max chip rev: v0.99
I (178) cpu_start: Chip rev: v0.2
I (178) heap_init: Initializing. RAM available for dynamic allocation:
I (179) heap_init: At 3FC96290 len 00053480 (333 KiB): RAM
I (179) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (179) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (180) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (181) spi_flash: detected chip: winbond
I (181) spi_flash: flash io: dio
W (181) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
W (181) i2c: This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h`
I (182) sleep: Configure to isolate all GPIO pins in sleep state
I (182) sleep: Enable automatic switching of GPIO sleep configuration
I (183) main_task: Started on CPU0
I (193) main_task: Calling app_main()
I (193) gpio: GPIO[16]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (193) I2C: Implemented using read and write callback methods (Use lower version < 5.0 API)
I (193) mian: I2C initialized successfully
I (193) TOUCH: ----touch_drv_init----
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
I (303) TOUCH: Find touch address 0x15
I (303) TOUCH: Find touch address 0x15
I (303) TOUCH: Implemented using built-in read and write methods (Use lower version < 5.0 API)
Using ESP-IDF Driver interface.
E (303) i2c: i2c driver install error
I (303) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (303) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Chip ID:0xb5
Version :0x2
Touch type:CST816T
I (383) TOUCH: Init touch SUCCESS!
I (383) TOUCH: Some CST816 will automatically enter sleep,can use the touch.disableAutoSleep() to turn off
I (383) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (513) mian: Run...
I (513) main_task: Returned from app_main()
X[0]:143 Y[0]:127
X[0]:143 Y[0]:127
X[0]:142 Y[0]:127
X[0]:141 Y[0]:126
X[0]:138 Y[0]:125
X[0]:135 Y[0]:123
X[0]:131 Y[0]:121
X[0]:126 Y[0]:119
X[0]:121 Y[0]:117
X[0]:84 Y[0]:146
X[0]:85 Y[0]:146
X[0]:86 Y[0]:145
X[0]:87 Y[0]:143
X[0]:88 Y[0]:140
X[0]:89 Y[0]:136
X[0]:90 Y[0]:132
X[0]:91 Y[0]:127
X[0]:92 Y[0]:123
X[0]:93 Y[0]:119
X[0]:94 Y[0]:115
X[0]:95 Y[0]:111
I (513563) TOUCH: Touch Home button pressed!
I (513573) TOUCH: Touch Home button pressed!
I (513583) TOUCH: Touch Home button pressed!
I (513603) TOUCH: Touch Home button pressed!
I (513613) TOUCH: Touch Home button pressed!
I (513633) TOUCH: Touch Home button pressed!
I (513643) TOUCH: Touch Home button pressed!
```

## Build process example

Assuming you don't have esp-idf yet

```
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
git clone https://github.com/lewisxhe/XPowersLib.git
cd esp-idf
./install.sh
. ./export.sh
cd ..
cd SensorLib/examples/ESP_IDF_Example
Configure SDA,SCL,INT,RST,Pin
...
idf.py menuconfig
idf.py build
idf.py -b 921600 flash
idf.py monitor
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
idf_component_register(SRCS
"touch_drv.cpp"
"i2c_driver.cpp"
"main.cpp"
INCLUDE_DIRS ".")
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
menu "SensorLib Example Configuration"

choice I2C_COMMUNICATION_METHOD
prompt "SensorLib read and write methods"
default I2C_COMMUNICATION_METHOD_BUILTIN_RW
help
Define SensorLib read and write methods

config I2C_COMMUNICATION_METHOD_BUILTIN_RW
bool "Implemented using built-in read and write methods"
config I2C_COMMUNICATION_METHOD_CALLBACK_RW
bool "Implemented using read and write callback methods"
endchoice

config I2C_MASTER_PORT_NUM
int "Sensor I2C Port Number"
default 1
help
Port number for I2C Master device.

config I2C_MASTER_FREQUENCY
int "Master Frequency"
default 100000
help
I2C Speed of Master device.

config SENSOR_SCL
int "Sensor SCL GPIO Num"
default 17
help
GPIO number for I2C clock line.

config SENSOR_SDA
int "Sensor SDA GPIO Num"
default 18
help
GPIO number for I2C data line.

config SENSOR_IRQ
int "Sensor Interrupt Pin"
default 16
help
Sensor interrupt pin.

config SENSOR_RST
int "Sensor reset Pin"
default 21
help
Sensor reset pin.


endmenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
Loading

0 comments on commit 44459cf

Please sign in to comment.