working separate files

This commit is contained in:
Andrew Melvin
2015-08-27 18:54:15 +01:00
parent cf00e8a41b
commit e4847e6991
3 changed files with 12 additions and 20 deletions

View File

@@ -796,7 +796,7 @@ void NeoPixelBus::Show(void)
send_pixels_800(p, end, _pin); send_pixels_800(p, end, _pin);
#else #else
send_pixels_UART(p, end,true); send_pixels_UART(p, end, true);
// char buff[4]; // char buff[4];

View File

@@ -36,17 +36,11 @@ inline uint32_t _getCycleCount()
#define CYCLES_400_T1H (F_CPU / 833333) #define CYCLES_400_T1H (F_CPU / 833333)
#define CYCLES_400 (F_CPU / 400000) #define CYCLES_400 (F_CPU / 400000)
#define UART_INV_MASK (0x3f<<19)
#define UART 1
#include "eagle_soc.h" #include "eagle_soc.h"
#include "uart_register.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) void ICACHE_RAM_ATTR send_pixels_800(uint8_t* pixels, uint8_t* end, uint8_t pin)
{ {

View File

@@ -29,37 +29,35 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define UART 1 #define UART 1
const char data[4] = { 0b00110111, 0b00000111, 0b00110100, 0b00000100 }; const char data[4] = { 0b00110111, 0b00000111, 0b00110100, 0b00000100 };
void ICACHE_RAM_ATTR send_pixels_UART(uint8_t* pixels, uint8_t* end, bool force) void ICACHE_RAM_ATTR send_pixels_UART(uint8_t* pixels, uint8_t* end, bool force)
{ {
char buff[4]; char buff[4];
uint8_t count = 0; //uint8_t count = 0;
static uint8_t* position = NULL; // static uint8_t* position = NULL;
if (position != NULL && !force ) { // if (position != NULL && !force ) {
pixels = position; // pixels = position;
} else if (position == NULL && !force ) { // } else if (position == NULL && !force ) {
return; // return;
} // }
do do
{ {
uint8_t subpix = *pixels++; uint8_t subpix = *pixels++;
position = pixels; // position = pixels;
count++; // count++;
buff[0] = data[(subpix >> 6) & 3]; buff[0] = data[(subpix >> 6) & 3];
buff[1] = data[(subpix >> 4) & 3]; buff[1] = data[(subpix >> 4) & 3];
buff[2] = data[(subpix >> 2) & 3]; buff[2] = data[(subpix >> 2) & 3];
buff[3] = data[subpix & 3]; buff[3] = data[subpix & 3];
Serial1.write(buff, sizeof(buff)); Serial1.write(buff, sizeof(buff));
} while (pixels < end || count < 156 ); } while (pixels < end );
if ( pixels == end) { position = NULL; } // if ( pixels == end) { position = NULL; }
} }