forked from Makuna/NeoPixelBus
working separate files
This commit is contained in:
@@ -796,7 +796,7 @@ void NeoPixelBus::Show(void)
|
||||
send_pixels_800(p, end, _pin);
|
||||
#else
|
||||
|
||||
send_pixels_UART(p, end,true);
|
||||
send_pixels_UART(p, end, true);
|
||||
|
||||
// char buff[4];
|
||||
|
||||
|
@@ -36,17 +36,11 @@ inline uint32_t _getCycleCount()
|
||||
#define CYCLES_400_T1H (F_CPU / 833333)
|
||||
#define CYCLES_400 (F_CPU / 400000)
|
||||
|
||||
#define UART_INV_MASK (0x3f<<19)
|
||||
#define UART 1
|
||||
|
||||
#include "eagle_soc.h"
|
||||
#include "uart_register.h"
|
||||
|
||||
|
||||
const char data[4] = { 0b00110111, 0b00000111, 0b00110100, 0b00000100 };
|
||||
|
||||
|
||||
|
||||
|
||||
void ICACHE_RAM_ATTR send_pixels_800(uint8_t* pixels, uint8_t* end, uint8_t pin)
|
||||
{
|
||||
|
@@ -29,37 +29,35 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define UART 1
|
||||
|
||||
|
||||
|
||||
const char data[4] = { 0b00110111, 0b00000111, 0b00110100, 0b00000100 };
|
||||
|
||||
|
||||
void ICACHE_RAM_ATTR send_pixels_UART(uint8_t* pixels, uint8_t* end, bool force)
|
||||
{
|
||||
char buff[4];
|
||||
uint8_t count = 0;
|
||||
static uint8_t* position = NULL;
|
||||
//uint8_t count = 0;
|
||||
// static uint8_t* position = NULL;
|
||||
|
||||
|
||||
if (position != NULL && !force ) {
|
||||
pixels = position;
|
||||
} else if (position == NULL && !force ) {
|
||||
return;
|
||||
}
|
||||
// if (position != NULL && !force ) {
|
||||
// pixels = position;
|
||||
// } else if (position == NULL && !force ) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
do
|
||||
{
|
||||
uint8_t subpix = *pixels++;
|
||||
position = pixels;
|
||||
count++;
|
||||
// position = pixels;
|
||||
// count++;
|
||||
buff[0] = data[(subpix >> 6) & 3];
|
||||
buff[1] = data[(subpix >> 4) & 3];
|
||||
buff[2] = data[(subpix >> 2) & 3];
|
||||
buff[3] = data[subpix & 3];
|
||||
Serial1.write(buff, sizeof(buff));
|
||||
|
||||
} while (pixels < end || count < 156 );
|
||||
} while (pixels < end );
|
||||
|
||||
if ( pixels == end) { position = NULL; }
|
||||
// if ( pixels == end) { position = NULL; }
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user