Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Add GPIO interrupt abstraction #535

Merged
merged 9 commits into from
Mar 3, 2019
Merged

Add GPIO interrupt abstraction #535

merged 9 commits into from
Mar 3, 2019

Conversation

OttoWinter
Copy link
Member

@OttoWinter OttoWinter commented Feb 28, 2019

Description:

Add GPIO interrupt abstraction and rewrite some stuff.

The basic problem is that all code that runs in ISR needs to be tagged ICACHE_RAM_ATTR so that it gets linked into instruction ram. This is because fetching data from flash in an ISR context results in an exception (fetching the data relies itself on an interrupt, but that will never fire while in an ISR).

Unfortunately, vtables are also stored in flash, so all classes that use multiple-inheritance and alike will result in these exceptions as well - same is potentially true for all C++ std library calls, so we're limited to bare minimums C with no cstdlib calls.

Related issue (if applicable): fixes esphome/feature-requests#71, fixes esphome/feature-requests#70

Pull request in esphome with python changes (if applicable): esphome/esphome#
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Checklist:

  • The code change is tested and works locally.
  • The code change follows the standards

If user exposed functionality or configuration variables are added/changed:

This Arduino API is just *horrible* to work with.
# Conflicts:
#	src/esphome/api/user_services.cpp
#	src/esphome/api/util.cpp
#	src/esphome/display/nextion.cpp
#	src/esphome/esphal.cpp
#	src/esphome/mqtt/mqtt_component.cpp
#	src/esphome/mqtt/mqtt_component.h
#	src/esphome/remote/remote_receiver.cpp
#	src/esphome/remote/remote_receiver.h
#	src/esphome/sensor/duty_cycle_sensor.cpp
#	src/esphome/sensor/pulse_counter.cpp
#	src/esphome/sensor/pulse_counter.h
#	src/esphome/sensor/rotary_encoder.cpp
#	src/esphome/sensor/rotary_encoder.h
#	src/esphome/sensor/ultrasonic_sensor.cpp
#	src/esphome/sensor/ultrasonic_sensor.h
#	src/esphome/uart_component.cpp
@OttoWinter OttoWinter merged commit e691aa9 into dev Mar 3, 2019
@OttoWinter OttoWinter deleted the rotary-encoder-rewrite branch March 3, 2019 10:54
@esphome esphome locked and limited conversation to collaborators Jun 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert ultrasonic sensor to using interrupts Add base abstraction for pin interrupts
1 participant