1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

mpr121: Add GPIO support (#6776)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
polyfloyd
2024-05-23 23:08:28 +02:00
committed by GitHub
parent aed0593793
commit c2d67659f3
14 changed files with 332 additions and 206 deletions

View File

@@ -0,0 +1,41 @@
i2c:
- id: i2c_mpr121
scl: ${i2c_scl}
sda: ${i2c_sda}
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 6
output:
- platform: gpio
id: gpio1
pin:
mpr121: mpr121_first
number: 7
mode: OUTPUT
- platform: gpio
id: gpio2
pin:
mpr121: mpr121_first
number: 11
mode: OUTPUT
inverted: true

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 16
sda: 17
substitutions:
i2c_scl: GPIO16
i2c_sda: GPIO17
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 16
sda: 17
substitutions:
i2c_scl: GPIO16
i2c_sda: GPIO17
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -1,26 +1,5 @@
i2c:
- id: i2c_mpr121
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: mpr121
id: touchkey0
name: touchkey0
channel: 0
- platform: mpr121
id: bin1
name: touchkey1
channel: 1
- platform: mpr121
id: bin2
name: touchkey2
channel: 2
- platform: mpr121
id: bin3
name: touchkey3
channel: 3
<<: !include common.yaml

View File

@@ -344,10 +344,6 @@ apds9960:
address: 0x20
update_interval: 60s
mpr121:
id: mpr121_first
address: 0x5A
binary_sensor:
- platform: apds9960
direction: up
@@ -371,25 +367,6 @@ binary_sensor:
direction: right
name: APDS9960 Right
- platform: mpr121
id: touchkey0
channel: 0
name: touchkey0
- platform: mpr121
channel: 1
name: touchkey1
id: bin1
- platform: mpr121
channel: 2
name: touchkey2
id: bin2
- platform: mpr121
channel: 3
name: touchkey3
id: bin3
on_press:
then:
- switch.toggle: mpr121_toggle
- platform: ttp229_lsf
channel: 1
name: TTP229 LSF Test
@@ -443,10 +420,6 @@ grove_tb6612fng:
address: 0x14
switch:
- platform: template
name: mpr121_toggle
id: mpr121_toggle
optimistic: true
- platform: gpio
id: gpio_switch1
pin: