Skip to content

Add compatibility with ESP32 GPIO RGB LEDs #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

brentru
Copy link
Member

@brentru brentru commented Jun 5, 2019

This pull request adds:

  • RGBLED support for using an ESP_SPIControl object, esp, provided three RGB LED pins.
  • color setter method no longer handles PWM, only color conversion and integer scaling.
    • _write_color method added to support multiple types of PWMOut methods and simplify color() setter.
  • Usage example for ESP32-connected RGBLEDs

Usage Example

import board
import adafruit_rgbled
from adafruit_esp32spi import adafruit_esp32spi

# Create ESP Object
esp32_cs = DigitalInOut(board.D13)
esp32_ready = DigitalInOut(board.D11)
esp32_reset = DigitalInOut(board.D12)
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)

esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)

with adafruit_rgbled.RGBLED(25, 26, 27, esp) as rgb_led:
    rgb_led.color = (0, 255, 0)

This pull request has been tested with: a pin-based RGB LED, PCA9685 (PWMOut object), and a RGB LED connected to an ESP32 (AirLift FeatherWing)

@brentru brentru added the enhancement New feature or request label Jun 5, 2019
@brentru brentru requested a review from a team June 5, 2019 20:52
@ladyada
Copy link
Member

ladyada commented Jun 5, 2019

i think maybe better to have ESPSPI provide the PWM objects then pass em in?

@brentru
Copy link
Member Author

brentru commented Jun 5, 2019

@ladyada
Copy link
Member

ladyada commented Jun 5, 2019

ok then update espspi to create PWMouts :)

@brentru
Copy link
Member Author

brentru commented Jun 7, 2019

This PR is no longer required as the pull request for adding a PWMOut class in ESP32SPI (adafruit/Adafruit_CircuitPython_ESP32SPI#52) creates PWMOut objects, and they're already handled in this library. Tested on Feather M4 + AirLift FeatherWing.

Closing out...

@brentru brentru closed this Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants