Commit Graph

45 Commits

Author SHA1 Message Date
Gregg fd3955f0c2 verified functionality on ESP32 original 2022-01-17 12:52:09 -06:00
Gregg b6d21fd2c0 streamlined identification of interrupt masks and memory size 2022-01-17 12:36:02 -06:00
Gregg 89f0d0dd94 verified works on C3 when either channel 0 or 1 is used 2022-01-17 11:30:55 -06:00
Gregg 5f513c4c34 updated 2022-01-17 08:25:26 -06:00
Gregg 79c028c057 moved loadData into interrupt 2022-01-17 07:16:31 -06:00
Gregg 40c05bd53f some more cleanup
Next up:  Move loadData into isrHandler, if possible.
To Do: redo single-color methods
2022-01-16 23:24:54 -06:00
Gregg 1a99df4214 check in progress 2022-01-16 23:14:12 -06:00
Gregg 46d7ade046 Re-doing Pixel class once again
This time using customized interrupts to fill RMT memory on-the-fly.

* Added getChannel() to RFControl
* Add 3rd, optional, boolean argument to RFControl(int pin, bool refTick, bool defaultDrive) to that RMT can be initialized but without the default driver (allows for use of custom interrupt code instead)
2022-01-16 14:16:52 -06:00
Gregg aefa737675 Completed "optimization"
Pixels now lets you reserve memory for pixels so that the call to start the RF transmission can be done for multiple pixels at once.  However, gain is not as much as expected.  May need to revisit if driving a large matrix of pixels is needed.
2022-01-08 17:28:43 -06:00
Gregg ee6c270de3 optimizing to allow for pulse train batching 2022-01-08 16:18:37 -06:00
Gregg 9d0c56799c Update extras.ino 2022-01-07 06:58:40 -06:00
Gregg 1b402b5ebc changed range of S and V to be 0-100 instead of 0-1
But still use float so that values of 50.3, 99.5, etc. are still distinguishable.
2022-01-07 06:25:11 -06:00
Gregg 3020b800a6 testing 2022-01-06 21:43:54 -06:00
Gregg f10f5cffcd Normalized and optimized Pixel methods
created color_t typedef and use as basis for all RGB and HSV methods
2022-01-06 21:15:03 -06:00
Gregg d5b27d6e14 Added ability to set same color on multiple pixels
Added 4th, optional argument, nPixels, to setRGB() and setHSV().
2022-01-06 18:09:22 -06:00
Gregg 368a06301a renamed sk68xx class to Pixel and made it generic
Constructor now allows you to specify high/low timings for 1-bit and 0-bit, as well as timing for reset delay.  Default parameters are included if none are specified.
2021-12-31 18:10:51 -06:00
Gregg 3b6bc13b1c Added setHSV() to sk68xx class 2021-12-31 15:34:20 -06:00
Gregg facba4c02a Added Pixel.h and Pixel.cpp and implemented SK68XX Addressable LED Class
Also add getPin() to RFControl (which is used by SK68XX Class) as well as boolean operator overrides for both RFControl and PwmPin/ServoPin so that instances can be checked for validity.
2021-12-31 14:51:42 -06:00
HomeSpan 82d86001e2 Update extras.ino 2021-10-16 14:49:50 -05:00
HomeSpan 1566f93274 Update extras.ino 2021-10-16 11:33:49 -05:00
Gregg 760abae5ce Testing pronto codes 2021-10-16 08:16:22 -05:00
Gregg 5976fd3d0d Add enableCarrier(uint32_t frequency, float duty) and disableCarrier() to RFControl
Allows you to overlay a carrier wave on the RF Signal - in practice this is only used for IR signals (not RF).  Automatically scales frequency to account for 80x difference between APB Clock and Ref Tick Clock depending on which is used.   Checks to ensure resulting parameters (high period and low period) are all in bounds (0,65536) and reports an error if they are not.
2021-10-15 22:32:03 -05:00
Gregg 4ad607951f Add clock selection to RFControl (80 MHz or 1 MHz)
Added second argument to RFControl(uint8_t pin, boolean refClock=true) to allow choice of Ref Tick (1 MHz) clock or APB (80 MHz) clock.  Default is to use 1 MHz Ref Tick.

Also fixed bug in logic that divides clock for ESP32-C3.  Factor should be 79, not 80, since divider is apparently configured to divide by factor+1.
2021-10-15 18:16:18 -05:00
Gregg 5bced71345 Changed rf.add() and rf.phase() to allow for uint32_t durations
Instead of limiting number of ticks to 15-bits (32767), RFControl allows for tick size to be any 32-bit number.  If ticks > 32767, RFControl adds repeated LOW or HIGH phases as needed to match full duration.  This provides for much more flexibility in creating pulse trains that include very long-duration "spaces" between repeats.
2021-10-15 17:42:17 -05:00
Gregg 641e2ca955 Added check in RFControl to allow for backwards compatibility with Arduino-ESP 1.0.6
To do: Disable watchdog timer in ESP32-C3
2021-10-03 22:01:37 -05:00
Gregg 7980273609 Completed update of RFControl for ESP32-S2 and -C3 compatability
Testing completed for RFControl and PWM on all three ESP32 chip types.

To Do: update RFControl documentation to include total number of usable channels per chip, as well as the alternate version of start();
2021-10-03 18:08:07 -05:00
Gregg dc5844b520 Updated RFControl for compatibility with ESP32-S2 and ESP32-C3
Complete re-write of code.
2021-10-03 12:08:33 -05:00
Gregg 61a87ccc63 Clean up PWM - ready for testing
To do: Test RGB LED Examples with ESP32 and ESP32-S2 boards.

Next:  Re-work Remote Control routines to make compatible with S2 and C3
2021-09-19 13:53:20 -05:00
Gregg 0ccb1d34a0 More updates to PWM to ensure S2 and C3 compatibility
New IDF parameter in 2.0.0 for LEDC allows PWM signal to be inverted!  Need to ensure flags.output_inverted is set to 0!

Also:  Deleted old PWM class, which was saved for backwards compatibility.  This "breaks" HomeSpan for those using the old PWM class (instead of LedPin).

Also:  Added checks to ensure that frequency is achievable (for S2 and C3, the 14-bit duty resolution is insufficient to allow frequencies slower than 5 Hz - this is  not a practical limit when using LedPin to drive actual LEDs and lights).
2021-09-19 13:39:40 -05:00
HomeSpan 7255a9530f Updating Extras to work through S2 and C3 issues 2021-09-18 16:28:56 -05:00
Gregg 6c9bf39f54 Added PWM diagnostic messages and chip-specific maximum duty resolution 2021-09-14 21:09:58 -05:00
HomeSpan 60cb20f132 Completed update to PWM code
Should now work with ESP32-S2 and C3.  Allows for as many LEDs and Servos as there are channels and timers across low and high (esp32 only) modes. Allows LED to be set with floating point precession instead of just uint8.  Allows specification of LED frequency for each LED (1-65535 Hz).  Automatically provides maximum duty resolution for frequency chosen.
2021-09-12 15:17:27 -05:00
HomeSpan 0a0c536b6d Starting work on ServoPin update 2021-09-12 12:31:08 -05:00
HomeSpan a5d31b1ea5 Re-working PWM routines 2021-09-12 09:23:29 -05:00
Gregg 451a2885b1 Changed PwmPin to LedPin in all Tutorial Examples
Greatly simplifies use interface.  No need to specify or save channels.  And no need to even save pin number since that can be found using LedPin->getPin() method whenever needed.
2021-03-21 09:54:57 -05:00
Gregg d49bca9bbe Completed LedPin() and ServoPin()
Both classes check that total number of combined instantiations does not exceed 16.  ServoPin() has additional limit of only 8 instantiations.

DEPRECATED: PwmPin().  Keep for backwards compatibility only.
TO DO:  Update Tutorial Examples to replace PwmPin with LedPin, and update Extras.h documentations with LedPin and ServoPin.
2021-03-20 23:21:09 -05:00
Gregg 59e34fde05 Updated LedPin() 2021-03-20 17:19:47 -05:00
Gregg bc498c32e4 Created LedPin()
This is a replacement for PwmPin().   It keeps track of channel numbers internally, which greatly simplifies the user interface.  Starts by using the 8 Low Speed Timer channels and then moves to the 8 High Speed Timer channels if more than 8 LedPins are instantiated.  Throws a non-fatal error if more than 16 LedPins are instantiated, and ignores any attempts to set the duty cycle of those channels.
2021-03-20 17:14:19 -05:00
Gregg 65df97c563 Added ServoPin() class to PwmPin.h
Controls a 50-Hz servo motor using ESP32 built-in LED PWM.  Allows custom range for microseconds and degrees.
2021-03-20 12:20:43 -05:00
Gregg 61655845a9 Updated PWM
Removed need to include channel number in set() method.  Why was this ever there?  Need to update Examples and PwmPin docs.  But keep stub method that includes channel for backwards compatibility.
2021-03-19 06:38:41 -05:00
Gregg cc748f346c Updated RFControl
Changed enum class PHASE back to simple uint8.  Was too complicated to have a dedicted structure just to represent HIGH and LOW.
2020-12-22 17:27:56 -06:00
Gregg e7e6d4de61 Added 'phase' method to RFControl
RFControl::phase() allows you to add either a HIGH or LOW entry (i.e. a single phase of a pulse.  RFControl::add() continues to add a full HIGH/LOW pulse so these changes are fully backwards compatible.
2020-12-21 22:07:58 -06:00
Gregg f200138a2d Added back src/ino files which will be excluded via .gitattributes instead of .gitignore
This keeps them in the reop, but excludes them from releases.
2020-11-08 07:41:36 -06:00
Gregg d3029af569 Delete extras.ino 2020-10-05 21:33:55 -05:00
Gregg 57fef4b496 Create /extras folder
Created /extras folder and moved PwmPin and RFControl files from src into src/extras.
2020-07-25 20:47:05 -05:00