0

Invert communication in Adafruit_NeoPixel
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Invert communication in Adafruit_NeoPixel

by arilarralde on Fri Jul 26, 2019 11:23 am

In the desing of my circuit, when the microcontroller sends 1 from the pin associated to the led WS2812B, the led receives a 0; while when write a 0 the led receives a 1. I need to fork the library and develop a mechanism in order to invert the comunication between the microcontroller and the led.
Could you help me understand where in the library should I change the code in order to make this happen.

Microcontroller: ESP32
Led: WS2812B

Thanks!

arilarralde
 
Posts: 1
Joined: Fri Jul 26, 2019 11:03 am

Re: Invert communication in Adafruit_NeoPixel

by adafruit_support_bill on Fri Jul 26, 2019 11:46 am

That is a lot of hand-tuned assembly code - with many cases to handle different processors and different pins on those different processors.

It looks like most of the different cases use the same pattern for defining logic HIGH and logic LOW. If you find all occurrences of the following and swap 'hi' and 'lo' may be enough to do what you want.
Code: Select all | TOGGLE FULL SIZE
      hi = PORTD |  pinMask;
      lo = PORTD & ~pinMask;

adafruit_support_bill
 
Posts: 74687
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.