LBP311 / Origami-Electronics

Origami with Embedded Electronics
GNU General Public License v3.0
0 stars 0 forks source link

Touch Sensor Stub Fill-In #45

Open LBP311 opened 2 years ago

LBP311 commented 2 years ago

Fill-in stub functions for touch sensor for proper operation. Configure demo file as needed to ensure proper operation of component.

LBP311 commented 2 years ago

The tasks were completed as shown by the committed touch_demo.py and touch_sensor.py files. Looking to implement add_event_detect to introduce interrupts when needed.

LBP311 commented 2 years ago

Attempting to add interrupts for Sensor Pins.

Trying to figure out how to use interrupts without having to add an infinite loop containing the _eventdetected within touch_demo.py. I felt as though adding the _eventdetected within the demo file defeats the purpose of hiding certain code from the user and would provide more readability when testing the Library functions. I also attempted adding the infinite loop within the touch_sensor.py but when running the demo, I end up in an infinite loop and rest of demo code will not run.

Other idea was to use _add_eventcallback but I came across having multiple callback functions when each event serves the same purpose of printing out which Pad was touched. I wanted to have one callback function for each _add_eventcallback. Am I limited to having multiple callback functions?

@ffund @piekarski92 @mrm815 Would you be able to provide any guidance, suggestions, or ideas? Thank you!

ffund commented 2 years ago

It's not clear exactly what you want to do. ("add interrupts" doesn't make it clear what you want to do with interrupts - how do you want this new function to behave?)

You currently have functions that read the current state of a sensor pin. Do you want a function that "blocks" until a pin is touched, and then returns?

If so, you would use wait_for_edge.

LBP311 commented 2 years ago

To do: use wait_for_edge inside Wait_Pad. Estimated time: 15 minutes.