- Notifications
You must be signed in to change notification settings - Fork 7.7k
Initial version of rmt driver #1525
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
Changes from 1 commit
964cc98
282deb3
16f4d12
488ca06
c2a669f
23e45a4
2e76fc0
d2f3e69
f1c1dd6
826ef0e
4397831
506ced8
396ce23
fc39193
8aa03e7
1cb7560
ab4ffbc
8d72750
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
| @@ -5,7 +5,8 @@ | |
| ||
#include "esp32-hal.h" | ||
| ||
#define LED_MATRIX_SIZE 8*4*24 | ||
#define NR_OF_LEDS 8*4 | ||
#define NR_OF_PIXELS 24*NR_OF_LEDS | ||
| ||
// | ||
// Note: This example uses Neopixel LED board, 32 LEDs chained one | ||
| @@ -32,12 +33,10 @@ | |
// +-------------+ +-- | ||
// | 0.8us | 0.4us | | ||
| ||
rmt_data_t led_data[LED_MATRIX_SIZE]; | ||
rmt_data_t led_data[NR_OF_PIXELS]; | ||
| ||
rmt_obj_t* rmt_send = NULL; | ||
| ||
static EventGroupHandle_t events; | ||
| ||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
| @@ -58,27 +57,27 @@ int led_index = 0; | |
void loop() | ||
{ | ||
// Init data with only one led ON | ||
int i; | ||
int item, bit, inx; | ||
for (i=0; i<LED_MATRIX_SIZE; i++) { | ||
| ||
item = i/24; | ||
| ||
bit = i%8; | ||
inx = i/8; | ||
| ||
if ( (color[inx%3] & (1<<(8-bit))) && (item == led_index) ) | ||
led_data[i].val = 0x80070006; | ||
else | ||
led_data[i].val = 0x80040008; | ||
int led, col, bit; | ||
int i=0; | ||
for (led=0; led<NR_OF_LEDS; led++) { | ||
for (col=0; col<3; col++ ) { | ||
for (bit=0; bit<8; bit++){ | ||
if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) { | ||
led_data[i].val = 0x80070006; | ||
| ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These values are different,. a direct conversion between the led_data[i].level0 = 1; led_data[i].duration0 = 7; led_data[i].level1 = 0; led_data[i].duration1 = 6; Did you want to change the values? Chuck There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you chuck, good catch! Indeed I meant to update the values (to be in line with the diagrams), but not that much. wanted to use pulses 8/4 instead of 7/6 (the led's are quite tolerant so it's accepted) | ||
led_data[i].val = 0x80040008; | ||
} | ||
i++; | ||
} | ||
} | ||
} | ||
// make the led travel in the pannel | ||
if ((++led_index)>=4*8) { | ||
if ((++led_index)>=NR_OF_LEDS) { | ||
led_index = 0; | ||
} | ||
| ||
// Send the data | ||
rmtWrite(rmt_send, led_data, LED_MATRIX_SIZE); | ||
rmtWrite(rmt_send, led_data, NR_OF_PIXELS); | ||
| ||
delay(100); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be number of bits. each led is a pixel