changed to component

This commit is contained in:
nopnop2002
2025-06-14 13:19:06 +09:00
parent 94eb38d483
commit 664a93ac09
8 changed files with 109 additions and 167 deletions

View File

@@ -25,27 +25,63 @@ idf.py flash
```
# Configuration
![config-top](https://user-images.githubusercontent.com/6020549/147515950-b6e2cf2f-5a82-4114-a565-df7a78085c8d.jpg)
![config-mpr121](https://github.com/nopnop2002/esp-idf-mpr121/assets/6020549/6780b5af-256e-4a12-866a-742868694124)
![Image](https://github.com/user-attachments/assets/66e7e417-3a55-49aa-ab57-8e9ff0f848a3)
![Image](https://github.com/user-attachments/assets/40d3a5ac-43cd-4fc7-a80d-4f330d677d94)
# Wirering
|MPR121||ESP32|ESP32-S2/S3|ESP32-C2/C3/C6|
|:-:|:-:|:-:|:-:|:-:|
|SCL|--|GPIO22|GPIO12|GPIO6|
|SDA|--|GPIO21|GPIO11|GPIO5|
|SCL|--|GPIO19|GPIO12|GPIO6|
|SDA|--|GPIO18|GPIO11|GPIO5|
|IRQ|--|GPIO15|GPIO18|GPIO4|
|GND|--|GND|GND|GND|
|VCC|--|3.3V|3.3V|3.3V|
__You can change it to any pin using menuconfig.__
__Note:__It is recommended to add external pull-up resistors for SDA/SCL pins to make the communication more stable, though the driver will enable internal pull-up resistors.
__You can change it to any pin using menuconfig.__
# Screen Shot
![mpr121-2](https://user-images.githubusercontent.com/6020549/147515969-54901561-66f5-4077-b6f8-7dbd7fe49f2c.jpg)
Supports multiple simultaneous touches.
```
I (55786) MAIN: electrode 0 was just touched
I (55786) MAIN: electrode 1 was just touched
I (55786) MAIN: electrode 2 was just touched
I (55786) MAIN: electrode 3 was just touched
I (58446) MAIN: electrode 0 was just released
I (58446) MAIN: electrode 1 was just released
I (58446) MAIN: electrode 2 was just released
I (58446) MAIN: electrode 3 was just released
```
# How to use this component in your project
Create idf_component.yml in the same directory as main.c.
```
YourProject --+-- CMakeLists.txt
+-- main --+-- main.c
+-- CMakeLists.txt
+-- idf_component.yml
```
Contents of idf_component.yml.
```
dependencies:
nopnop2002/mpr121:
path: components/mpr121
git: https://github.com/nopnop2002/esp-idf-mpr121.git
```
When you build a projects esp-idf will automaticly fetch repository to managed_components dir and link with your code.
```
YourProject --+-- CMakeLists.txt
+-- main --+-- main.c
| +-- CMakeLists.txt
| +-- idf_component.yml
+-- managed_components ----- nopnop2002__mpr121
```
# Reference
https://github.com/nopnop2002/esp-idf-ttp229