-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
162 changed files
with
34,333 additions
and
2,667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,9 @@ | |
test | ||
.travis.yml | ||
test | ||
assets | ||
assets | ||
*.bk | ||
*.test | ||
build | ||
*.old | ||
sdkconfig |
13 changes: 9 additions & 4 deletions
13
software/firmware/source/libraries/SensorsLib/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
set(src_dirs ./src) | ||
set(src_dirs ./src | ||
./src/touch | ||
./src/platform) | ||
set(include_dirs ./src | ||
./src/REG) | ||
idf_component_register(SRC_DIRS ${src_dirs} INCLUDE_DIRS ${include_dirs}) | ||
|
||
./src/REG | ||
./src/touch | ||
./src/platform) | ||
idf_component_register(SRC_DIRS ${src_dirs} | ||
INCLUDE_DIRS ${include_dirs} | ||
REQUIRES esp_timer esp_driver_gpio driver) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
menu "SensorLib Configuration" | ||
|
||
choice SensorLib_ESP_IDF_API | ||
prompt "SensorLib library esp-idf api version" | ||
default SENSORLIB_ESP_IDF_NEW_API | ||
help | ||
Define API version | ||
|
||
config SENSORLIB_ESP_IDF_NEW_API | ||
bool "Use esp-idf higher version (>= 5.0) API" | ||
config SENSORLIB_ESP_IDF_OLD_API | ||
bool "Use esp-idf lower version ( < 5.0) API , Compatible with lower versions of esp-idf" | ||
endchoice | ||
|
||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,78 @@ | ||
``` | ||
_____ _ _ _ | ||
/ ____| | | (_) | | ||
| (___ ___ _ __ ___ ___ _ __ ___| | _| |__ | ||
\___ \ / _ \ '_ \/ __|/ _ \| '__/ __| | | | '_ \ | ||
____) | __/ | | \__ \ (_) | | \__ \ |____| | |_) | | ||
|_____/ \___|_| |_|___/\___/|_| |___/______|_|_.__/ | ||
_____ _ _ _ | ||
/ ___| | | (_)| | | ||
\ `--. ___ _ __ ___ ___ _ __ | | _ | |__ | ||
`--. \ / _ \| '_ \ / __| / _ \ | '__|| | | || '_ \ | ||
/\__/ /| __/| | | |\__ \| (_) || | | |____| || |_) | | ||
\____/ \___||_| |_||___/ \___/ |_| \_____/|_||_.__/ | ||
··· ··· | ||
> 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/SensorLib.svg?)](https://www.ardu-badge.com/SensorLib) | ||
[![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) | ||
[![FROK](https://img.shields.io/github/forks/lewisxhe/SensorsLib)](https://github.com/lewisxhe/SensorsLib/graphs/contributors) | ||
[![STAR](https://img.shields.io/github/stars/lewisxhe/SensorsLib)](https://github.com/lewisxhe/SensorsLib/stargazers) | ||
[![releases](https://img.shields.io/github/release/lewisxhe/SensorsLib)](https://github.com/lewisxhe/SensorLib/releases) | ||
|
||
![PCF8563](https://img.shields.io/badge/PCF8563-GREEN) | ||
![PCF85063](https://img.shields.io/badge/PCF85063-GREEN) | ||
![HYM8563](https://img.shields.io/badge/HYM8563-GREEN) | ||
![QMI8658](https://img.shields.io/badge/QMI8658-blue) | ||
![BMM150](https://img.shields.io/badge/BMM150-blue) | ||
![QMC6310](https://img.shields.io/badge/QMC6310-blue) | ||
![BMA423](https://img.shields.io/badge/BMA423-blue) | ||
![BHI260AP](https://img.shields.io/badge/BHI260AP-blue) | ||
![XL9555](https://img.shields.io/badge/XL9555-yellow) | ||
![DRV2605](https://img.shields.io/badge/DRV2605-teal) | ||
![CM32181](https://img.shields.io/badge/CM32181-brown) | ||
![LTR553](https://img.shields.io/badge/LTR553-brown) | ||
![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) | ||
![CST9217](https://img.shields.io/badge/CST9217-red) | ||
![CST9220](https://img.shields.io/badge/CST9220-red) | ||
|
||
Support list: | ||
|
||
| Sensor | Description | I2C | SPI | | ||
| --------------- | ------------------------ | --- | --- | | ||
| PCF8563/HYM8563 | Real-time clock | ✔️ | ❌ | | ||
| PCF85063 | Real-time clock | ✔️ | ❌ | | ||
| QMI8658 | IMU | ✔️ | ✔️ | | ||
| BHI260AP | IMU | ✔️ | ✔️ | | ||
| QMC6310 | Magnetic Sensor | ✔️ | ❌ | | ||
| BMM150 | Magnetic Sensor | ✔️ | ❌ | | ||
| XL9555 | I/O expander | ✔️ | ❌ | | ||
| BMA423 | Accelerometer | ✔️ | ❌ | | ||
| DRV2605 | Haptic Driver | ✔️ | ❌ | | ||
| CM32181 | Ambient Light Sensor | ✔️ | ❌ | | ||
| LTR553 | Light & Proximity Sensor | ✔️ | ❌ | | ||
| 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 | ✔️ | ❌ | | ||
| CST9217 | Capacitive touch | ✔️ | ❌ | | ||
| CST9220 | Capacitive touch | ✔️ | ❌ | | ||
|
41 changes: 41 additions & 0 deletions
41
software/firmware/source/libraries/SensorsLib/board/ESP32-S3-N4R2-QSPI.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"ldscript": "esp32s3_out.ld", | ||
"partitions": "default.csv", | ||
"memory_type": "qio_qspi" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV_4M_QSPI", | ||
"-DARDUINO_USB_MODE=1", | ||
"-DARDUINO_USB_CDC_ON_BOOT=1", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1", | ||
"-DBOARD_HAS_PSRAM" | ||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "qio", | ||
"hwids": [["0x303A", "0x1001"]], | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": ["wifi"], | ||
"debug": { | ||
"default_tool": "esp-builtin", | ||
"onboard_tools": ["esp-builtin"], | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": ["arduino", "espidf"], | ||
"name": "ESP32-S3 Dev Modlue (4M Flash 2M QSPI PSRAM )", | ||
"upload": { | ||
"flash_size": "4MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 4194304, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "https://www.espressif.com", | ||
"vendor": "espressif" | ||
} |
41 changes: 41 additions & 0 deletions
41
software/firmware/source/libraries/SensorsLib/board/ESP32-S3-R8-N16-QSPI.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"ldscript": "esp32s3_out.ld", | ||
"partitions": "default.csv", | ||
"memory_type": "qio_qspi" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV_16M_QSPI", | ||
"-DARDUINO_USB_MODE=1", | ||
"-DARDUINO_USB_CDC_ON_BOOT=1", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1", | ||
"-DBOARD_HAS_PSRAM" | ||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "qio", | ||
"hwids": [["0x303A", "0x1001"]], | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": ["wifi"], | ||
"debug": { | ||
"default_tool": "esp-builtin", | ||
"onboard_tools": ["esp-builtin"], | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": ["arduino", "espidf"], | ||
"name": "ESP32-S3 Dev Modlue (16M Flash 8M QSPI PSRAM )", | ||
"upload": { | ||
"flash_size": "16MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 16777216, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "https://www.espressif.com", | ||
"vendor": "espressif" | ||
} |
39 changes: 39 additions & 0 deletions
39
software/firmware/source/libraries/SensorsLib/board/ESP32-S3-R8-OPI.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"ldscript": "esp32s3_out.ld", | ||
"memory_type": "qio_opi", | ||
"partitions": "default_16MB.csv" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV_16M_OPI", | ||
"-DARDUINO_USB_MODE=1", | ||
"-DARDUINO_USB_CDC_ON_BOOT=1", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1", | ||
"-DBOARD_HAS_PSRAM" | ||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "qio", | ||
"hwids": [["0x303A", "0x1001"]], | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": ["wifi", "bluetooth"], | ||
"debug": { | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": ["arduino", "espidf"], | ||
"name": "ESP32-S3 Dev Modlue (16M Flash 8M OPI PSRAM )", | ||
"upload": { | ||
"flash_size": "16MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 16777216, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "https://www.espressif.com", | ||
"vendor": "espressif" | ||
} |
88 changes: 88 additions & 0 deletions
88
...rmware/source/libraries/SensorsLib/examples/BAM423_Accelerometer/BAM423_Accelerometer.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/** | ||
* | ||
* @license MIT License | ||
* | ||
* Copyright (c) 2022 lewis he | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
* @file BAM423_Accelerometer.ino | ||
* @author Lewis He ([email protected]) | ||
* @date 2023-04-01 | ||
* | ||
*/ | ||
#include <Wire.h> | ||
#include <SPI.h> | ||
#include <Arduino.h> | ||
#include "SensorBMA423.hpp" | ||
|
||
#ifndef SENSOR_SDA | ||
#define SENSOR_SDA 21 | ||
#endif | ||
|
||
#ifndef SENSOR_SCL | ||
#define SENSOR_SCL 22 | ||
#endif | ||
|
||
#ifndef SENSOR_IRQ | ||
#define SENSOR_IRQ 39 | ||
#endif | ||
|
||
SensorBMA423 accel; | ||
uint32_t lastMillis; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
while (!Serial); | ||
|
||
pinMode(SENSOR_IRQ, INPUT); | ||
|
||
if (!accel.begin(Wire, BMA423_SLAVE_ADDRESS, SENSOR_SDA, SENSOR_SCL)) { | ||
Serial.println("Failed to find BMA423 - check your wiring!"); | ||
while (1) { | ||
delay(1000); | ||
} | ||
} | ||
Serial.println("Init BAM423 Sensor success!"); | ||
|
||
//Default 4G ,200HZ | ||
accel.configAccelerometer(); | ||
|
||
accel.enableAccelerometer(); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
int16_t x = 0, y = 0, z = 0; | ||
accel.getAccelerometer(x, y, z); | ||
Serial.print("X:"); | ||
Serial.print(x); Serial.print(" "); | ||
Serial.print("Y:"); | ||
Serial.print(y); Serial.print(" "); | ||
Serial.print("Z:"); | ||
Serial.print(z); | ||
Serial.println(); | ||
|
||
delay(50); | ||
} | ||
|
||
|
||
|
Oops, something went wrong.