Commit f8fb41e8 authored by Frank Radzio 's avatar Frank Radzio

add OTAA and LowPower V2

parent 9c0eec04
......@@ -95,8 +95,8 @@ function Decoder(b, port)
/************************************************************
* GPS Definitionen
************************************************************/
static const int RXPin = 9, TXPin = 8; //GPS PIN
static const uint32_t GPSBaud = 4800; //GPS Baud
static const int RXPin = 8, TXPin = 9; //GPS PIN
static const uint32_t GPSBaud = 9600; //GPS Baud
uint8_t coords[10]; //Array für die Koordinaten
/********************************************************
......@@ -135,9 +135,9 @@ static const u1_t NWKSKEY[16] = NWKSKEY1;
static const u1_t APPSKEY[16] = APPSKEY1;
static const u4_t DEVADDR = DEVADDR1;
#else
static const PROGMEM u1_t NWKSKEY[16] = { 0x63, 0x7B, 0x0D, 0x9E, 0xDF, 0x0F, 0xC2, 0x24, 0x1A, 0x00, 0x8C, 0x8E, 0x4D, 0x8C, 0x4D, 0xDB }; // LoRaWAN NwkSKey, network session key
static const u1_t PROGMEM APPSKEY[16] = { 0xB8, 0x24, 0x48, 0x9D, 0xAD, 0xB5, 0xE1, 0xD5, 0x27, 0xAB, 0x9F, 0x04, 0xCE, 0x16, 0xE6, 0xED }; // LoRaWAN AppSKey, application session key
static const u4_t DEVADDR = 0x260110D2 ; // LoRaWAN end-device address (DevAddr)
static const PROGMEM u1_t NWKSKEY[16] = { 0x58, 0xAF, 0xB3, 0x4E, 0xB9, 0xFC, 0x5C, 0x2C, 0xE2, 0x2B, 0xA7, 0xF7, 0xC5, 0x71, 0x43, 0x0F }; // LoRaWAN NwkSKey, network session key (mbs)
static const u1_t PROGMEM APPSKEY[16] = { 0x45, 0x78, 0xF3, 0x59, 0xC4, 0x41, 0x4A, 0x55, 0x9C, 0x91, 0x5F, 0xB5, 0xCD, 0x47, 0x55, 0x8F }; // LoRaWAN AppSKey, application session key (mbs)
static const u4_t DEVADDR = 0x26011647 ; // LoRaWAN end-device address (DevAddr)
#endif
/****************************************************
* OTAA
......@@ -263,7 +263,11 @@ void onEvent (ev_t ev)
debugPrintLn(F(" bytes")); // of payload
}
// Schedule next transmission
// os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
// os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
for (int i=0; i<int(TX_INTERVAL/8); i++) {
// Use library from https://github.com/rocketscream/Low-Power
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
LMIC_transmitted = 1;
break;
case EV_LOST_TSYNC:
......@@ -551,14 +555,14 @@ void loop()
/********************************************************************************
* Hier wird der Node in den Schlafmodus gelegt
*******************************************************************************/
if (interval > TRACKINGINTERVAL)
{
for (int i = 0; i < interval; i++)
{
i +=7 ; // no normal 1 second run but 8 second loops m.
// Enter power down state for 8 s with ADC and BOD module disabled
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
}
// if (interval > TRACKINGINTERVAL)
// {
// for (int i = 0; i < interval; i++)
// {
// i +=7 ; // no normal 1 second run but 8 second loops m.
// // Enter power down state for 8 s with ADC and BOD module disabled
// LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// }
// }
//debugPrintLn("---");
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***************************************************************************
This is a library for the BME280 humidity, temperature & pressure sensor
/*!
* @file Adafruit_BME280.h
*
* Designed specifically to work with the Adafruit BME280 Breakout
* ----> http://www.adafruit.com/products/2650
*
* These sensors use I2C or SPI to communicate, 2 or 4 pins are required
* to interface.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Written by Kevin "KTOWN" Townsend for Adafruit Industries.
*
* BSD license, all text here must be included in any redistribution.
*
*/
Designed specifically to work with the Adafruit BME280 Breakout
----> http://www.adafruit.com/products/2650
These sensors use I2C or SPI to communicate, 2 or 4 pins are required
to interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit andopen-source hardware by purchasing products
from Adafruit!
Written by Limor Fried & Kevin Townsend for Adafruit Industries.
BSD license, all text above must be included in any redistribution
***************************************************************************/
#ifndef __BME280_H__
#define __BME280_H__
......@@ -26,15 +29,19 @@
#include <Adafruit_Sensor.h>
#include <Wire.h>
/*=========================================================================
I2C ADDRESS/BITS
-----------------------------------------------------------------------*/
/**************************************************************************/
/*!
@brief default I2C address
*/
/**************************************************************************/
#define BME280_ADDRESS (0x77)
/*=========================================================================*/
/*=========================================================================
REGISTERS
-----------------------------------------------------------------------*/
/**************************************************************************/
/*!
@brief Register addresses
*/
/**************************************************************************/
enum
{
BME280_REGISTER_DIG_T1 = 0x88,
......@@ -73,33 +80,33 @@
BME280_REGISTER_HUMIDDATA = 0xFD
};
/*=========================================================================*/
/*=========================================================================
CALIBRATION DATA
-----------------------------------------------------------------------*/
/**************************************************************************/
/*!
@brief calibration data
*/
/**************************************************************************/
typedef struct
{
uint16_t dig_T1;
int16_t dig_T2;
int16_t dig_T3;
uint16_t dig_P1;
int16_t dig_P2;
int16_t dig_P3;
int16_t dig_P4;
int16_t dig_P5;
int16_t dig_P6;
int16_t dig_P7;
int16_t dig_P8;
int16_t dig_P9;
uint8_t dig_H1;
int16_t dig_H2;
uint8_t dig_H3;
int16_t dig_H4;
int16_t dig_H5;
int8_t dig_H6;
uint16_t dig_T1; ///< temperature compensation value
int16_t dig_T2; ///< temperature compensation value
int16_t dig_T3; ///< temperature compensation value
uint16_t dig_P1; ///< pressure compensation value
int16_t dig_P2; ///< pressure compensation value
int16_t dig_P3; ///< pressure compensation value
int16_t dig_P4; ///< pressure compensation value
int16_t dig_P5; ///< pressure compensation value
int16_t dig_P6; ///< pressure compensation value
int16_t dig_P7; ///< pressure compensation value
int16_t dig_P8; ///< pressure compensation value
int16_t dig_P9; ///< pressure compensation value
uint8_t dig_H1; ///< humidity compensation value
int16_t dig_H2; ///< humidity compensation value
uint8_t dig_H3; ///< humidity compensation value
int16_t dig_H4; ///< humidity compensation value
int16_t dig_H5; ///< humidity compensation value
int8_t dig_H6; ///< humidity compensation value
} bme280_calib_data;
/*=========================================================================*/
......@@ -124,8 +131,18 @@ class Adafruit_BME280_Unified : public Adafruit_Sensor
*/
/**************************************************************************/
/*!
@brief Class that stores state and functions for interacting with BME280 IC
*/
/**************************************************************************/
class Adafruit_BME280 {
public:
/**************************************************************************/
/*!
@brief sampling rates
*/
/**************************************************************************/
enum sensor_sampling {
SAMPLING_NONE = 0b000,
SAMPLING_X1 = 0b001,
......@@ -135,12 +152,22 @@ class Adafruit_BME280 {
SAMPLING_X16 = 0b101
};
/**************************************************************************/
/*!
@brief power modes
*/
/**************************************************************************/
enum sensor_mode {
MODE_SLEEP = 0b00,
MODE_FORCED = 0b01,
MODE_NORMAL = 0b11
};
/**************************************************************************/
/*!
@brief filter values
*/
/**************************************************************************/
enum sensor_filter {
FILTER_OFF = 0b000,
FILTER_X2 = 0b001,
......@@ -149,7 +176,11 @@ class Adafruit_BME280 {
FILTER_X16 = 0b100
};
// standby durations in ms
/**************************************************************************/
/*!
@brief standby duration in ms
*/
/**************************************************************************/
enum standby_duration {
STANDBY_MS_0_5 = 0b000,
STANDBY_MS_10 = 0b110,
......@@ -237,7 +268,7 @@ class Adafruit_BME280 {
unsigned int spi3w_en : 1;
unsigned int get() {
return (t_sb << 5) | (filter << 3) | spi3w_en;
return (t_sb << 5) | (filter << 2) | spi3w_en;
}
};
config _configReg;
......@@ -270,7 +301,7 @@ class Adafruit_BME280 {
unsigned int mode : 2;
unsigned int get() {
return (osrs_t << 5) | (osrs_p << 3) | mode;
return (osrs_t << 5) | (osrs_p << 2) | mode;
}
};
ctrl_meas _measReg;
......
# Adafruit BME280 Library [![Build Status](https://travis-ci.org/adafruit/Adafruit_BME280_Library.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_BME280_Library)
<img src="https://cdn-shop.adafruit.com/970x728/2652-00.jpg" height="300"/>
This is a library for the Adafruit BME280 Humidity, Barometric Pressure + Temp sensor
Designed specifically to work with the Adafruit BME280 Breakout
......
......@@ -37,7 +37,7 @@ void setup() {
Serial.begin(9600);
Serial.println(F("BME280 test"));
if (! bme.begin(&Wire1)) {
if (! bme.begin(&Wire)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
......@@ -101,6 +101,7 @@ void setup() {
// = 40ms (25Hz)
// with standby time that should really be 24.16913... Hz
delayTime = 41;
*/
/*
// gaming
......
name=Adafruit BME280 Library
version=1.0.7
version=1.0.8
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for BME280 sensors.
......
......@@ -36,7 +36,7 @@
@returns True if device is set up, false on any failure
*/
/**************************************************************************/
boolean Adafruit_CircuitPlayground::begin(uint8_t brightness) {
bool Adafruit_CircuitPlayground::begin(uint8_t brightness) {
pinMode(CPLAY_REDLED, OUTPUT);
pinMode(CPLAY_BUZZER, OUTPUT);
#ifdef __AVR__
......@@ -132,7 +132,7 @@ uint16_t Adafruit_CircuitPlayground::readCap(uint8_t p, uint8_t samples) {
@param v pass true to turn LED on, false to turn LED off
*/
/**************************************************************************/
void Adafruit_CircuitPlayground::redLED(boolean v) {
void Adafruit_CircuitPlayground::redLED(bool v) {
digitalWrite(CPLAY_REDLED, v);
}
......@@ -142,7 +142,7 @@ void Adafruit_CircuitPlayground::redLED(boolean v) {
@returns true if slide switch in set, false if not
*/
/**************************************************************************/
boolean Adafruit_CircuitPlayground::slideSwitch(void) {
bool Adafruit_CircuitPlayground::slideSwitch(void) {
return digitalRead(CPLAY_SLIDESWITCHPIN);
}
......@@ -152,7 +152,7 @@ boolean Adafruit_CircuitPlayground::slideSwitch(void) {
@returns true if button is pressed, false if not
*/
/**************************************************************************/
boolean Adafruit_CircuitPlayground::leftButton(void) {
bool Adafruit_CircuitPlayground::leftButton(void) {
return digitalRead(CPLAY_LEFTBUTTON);
}
......@@ -162,7 +162,7 @@ boolean Adafruit_CircuitPlayground::leftButton(void) {
@returns true if button is pressed, false if not
*/
/**************************************************************************/
boolean Adafruit_CircuitPlayground::rightButton(void) {
bool Adafruit_CircuitPlayground::rightButton(void) {
return digitalRead(CPLAY_RIGHTBUTTON);
}
......@@ -176,9 +176,53 @@ boolean Adafruit_CircuitPlayground::rightButton(void) {
It is also not the same loudness over all frequencies but is designed to be the loudest at around 4 KHz
*/
/**************************************************************************/
void Adafruit_CircuitPlayground::playTone(uint16_t freq, uint16_t time, boolean wait) {
void Adafruit_CircuitPlayground::playTone(
uint16_t freq, uint16_t time, bool wait) {
#ifdef __AVR__
#define F_PLL 48000000
if(!freq) return;
uint32_t ocr;
uint16_t prescale = 1;
uint8_t scalebits = 0;
uint8_t hi1, lo1, hi2, lo2;
// Determine best prescaler setting for 10-bit timer
do {
scalebits++;
ocr = F_PLL / freq / prescale - 1;
prescale *= 2;
if(prescale >= 16384) {
ocr = 1023;
scalebits = 0b1111;
}
} while(ocr > 1023);
// Set up Timer4 for fast PWM on !OC4A
PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk
TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on
TCCR4B = _BV(PWM4X) | scalebits; // PWM invert
TCCR4D = 0; // Fast PWM mode
TCCR4E = 0; // Not enhanced mode
DT4 = 0; // No dead time
hi1 = ocr >> 8;
lo1 = ocr & 0xFF;
hi2 = ocr >> 9;
lo2 = (ocr >> 1) & 0xFF;
noInterrupts(); // TC4H accesses MUST be atomic
TC4H = hi1;
OCR4C = lo1; // TOP
TC4H = hi2;
OCR4A = lo2; // 50% duty
interrupts();
pinMode(5, OUTPUT); // Enable output
delay(time);
pinMode(5, INPUT); // Disable output
TCCR4A = 0; // PWMA off
#else
tone(CPLAY_BUZZER, freq, time);
if (wait) delay(time);
delay(time); // time argument to tone() isn't working, so...
#endif
if(wait) delay(time);
}
/**************************************************************************/
......@@ -357,7 +401,7 @@ void Adafruit_CircuitPlayground::senseColor(uint8_t& red, uint8_t& green, uint8_
@returns True if the device is a CircuitPlayground Express, false if it is a 'classic'.
*/
/**************************************************************************/
boolean Adafruit_CircuitPlayground::isExpress(void) {
bool Adafruit_CircuitPlayground::isExpress(void) {
#ifdef __AVR__
return false;
#else
......
......@@ -87,7 +87,7 @@
/**************************************************************************/
class Adafruit_CircuitPlayground {
public:
boolean begin(uint8_t brightness=20);
bool begin(uint8_t brightness=20);
Adafruit_CPlay_NeoPixel strip; ///< the neopixel strip object
Adafruit_CPlay_LIS3DH lis; ///< the accelerometer object
......@@ -103,11 +103,11 @@ class Adafruit_CircuitPlayground {
IRsend irSend; ///< the IR send object
#endif
boolean slideSwitch(void);
void redLED(boolean v);
void playTone(uint16_t freq, uint16_t time, boolean wait=true);
boolean leftButton(void);
boolean rightButton(void);
bool slideSwitch(void);
void redLED(bool v);
void playTone(uint16_t freq, uint16_t time, bool wait=true);
bool leftButton(void);
bool rightButton(void);
uint16_t lightSensor(void);
int16_t soundSensor(void);
float temperature(void);
......@@ -218,7 +218,7 @@ class Adafruit_CircuitPlayground {
return ((uint32_t)red << 16) | ((uint32_t)green << 8) | blue;
}
boolean isExpress(void);
bool isExpress(void);
private:
......
name=Adafruit Circuit Playground
version=1.8.1
version=1.8.3
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=All in one library to control Adafruit's Circuit Playground board.
......
......@@ -12,16 +12,32 @@
*/
/**************************************************************************/
void Adafruit_CPlay_Speaker::begin(void) {
if(!started) {
#ifdef __AVR__
pinMode(5, OUTPUT); // Enable output
// Set up Timer4 for fast PWM on !OC4A
PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk
TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on
TCCR4B = _BV(PWM4X) | _BV(CS40); // PWM invert, 1:1 prescale
TCCR4D = 0; // Fast PWM mode
TCCR4E = 0; // Not enhanced mode
DT4 = 0; // No dead time
noInterrupts(); // TC4H accesses must be atomic
TC4H = 0; // Not 10-bit mode
OCR4C = 255; // TOP
TC4H = 0;
OCR4A = 127; // 50% duty (idle position) to start
interrupts();
pinMode(5, OUTPUT); // Enable output
#else
pinMode(CPLAY_SPEAKER_SHUTDOWN, OUTPUT);
digitalWrite(CPLAY_SPEAKER_SHUTDOWN, HIGH);
// PWM/timer not needed on CPlay Express, has true analog out.
// Set analogWrite resolution to 8 bits to match AVR calls.
analogWriteResolution(8);
pinMode(A0, OUTPUT); // Enable output
pinMode(CPLAY_SPEAKER_SHUTDOWN, OUTPUT);
digitalWrite(CPLAY_SPEAKER_SHUTDOWN, HIGH);
// PWM/timer not needed on CPlay Express, has true analog out.
// Set analogWrite resolution to 8 bits to match AVR calls.
analogWriteResolution(8);
pinMode(A0, OUTPUT); // Enable output
#endif
started = true;
}
}
/**************************************************************************/
......@@ -31,9 +47,8 @@ void Adafruit_CPlay_Speaker::begin(void) {
*/
/**************************************************************************/
void Adafruit_CPlay_Speaker::enable(boolean e) {
#ifdef __AVR__
#else // circuit playground express has nicer amp w/shutdown
void Adafruit_CPlay_Speaker::enable(bool e) {
#if !defined(__AVR__) // circuit playground express has nicer amp w/shutdown
digitalWrite(CPLAY_SPEAKER_SHUTDOWN, e);
#endif
}
......@@ -44,13 +59,16 @@ void Adafruit_CPlay_Speaker::enable(boolean e) {
*/
/**************************************************************************/
void Adafruit_CPlay_Speaker::end(void) {
if(started) {
#ifdef __AVR__
TCCR4A = 0; // PWMA off
pinMode(5, INPUT);
TCCR4A = 0; // PWMA off
pinMode(5, INPUT);
#else
pinMode(A0, INPUT);
pinMode(A0, INPUT);
enable(false);
#endif
started = false;
started = false;
}
}
/**************************************************************************/
......@@ -62,7 +80,7 @@ void Adafruit_CPlay_Speaker::end(void) {
void Adafruit_CPlay_Speaker::set(uint8_t value) {
if(!started) begin();
#ifdef __AVR__
TCCR4A = value;
OCR4A = value;
#else
analogWrite(A0, value);
#endif
......@@ -83,25 +101,11 @@ void Adafruit_CPlay_Speaker::set(uint8_t value) {
*/
/**************************************************************************/
void Adafruit_CPlay_Speaker::playSound(
const uint8_t *data, uint32_t len, uint16_t sampleRate, boolean tenBit) {
const uint8_t *data, uint32_t len, uint16_t sampleRate, bool tenBit) {
uint32_t i;
if(!started) {
#ifdef __AVR__
// Set up Timer4 for fast PWM on !OC4A
PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk
TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on
TCCR4B = _BV(PWM4X) |_BV(CS40); // PWM invert, 1:1 prescale
TCCR4D = 0; // Fast PWM mode
TCCR4E = 0; // Not enhanced mode
TC4H = 0; // Not 10-bit mode
DT4 = 0; // No dead time
OCR4C = 255; // TOP
OCR4A = 127; // 50% duty (idle position) to start
started = true;
#endif
}
if(!started) begin();
#ifdef __AVR__
uint16_t interval = 1000000L / sampleRate;
......
......@@ -6,8 +6,7 @@
#include <Arduino.h>
#ifdef __AVR__
#else // circuit playground express has nicer amp w/shutdown
#if !defined(__AVR__) // circuit playground express has nicer amp w/shutdown
#define CPLAY_SPEAKER_SHUTDOWN 11 ///< shutdown pin (Express boards only)
#endif
......@@ -22,10 +21,11 @@ class Adafruit_CPlay_Speaker {
void begin(void),
end(void),
set(uint8_t value),
playSound(const uint8_t *data, uint32_t length, uint16_t sampleRate, boolean tenBit=false),
playSound(const uint8_t *data, uint32_t length, uint16_t sampleRate,
bool tenBit=false),
say(const uint8_t *addr);
void enable(boolean e);
void enable(bool e);
/**************************************************************************/
/*!
......@@ -44,7 +44,7 @@ class Adafruit_CPlay_Speaker {
void on(void) { enable(true); };
private:
boolean started;
bool started;
};
#endif // ADAFRUIT_CPLAY_SPEAKER_H
......@@ -33,7 +33,7 @@
#include "Adafruit_NeoPixel.h"
#if defined(NRF52)
#if defined(NRF52) || defined(NRF52_SERIES)
#include "nrf.h"
// Interrupt is only disabled if there is no PWM device available
......@@ -145,7 +145,7 @@ void Adafruit_NeoPixel::show(void) {
// to the PORT register as needed.
// NRF52 may use PWM + DMA (if available), may not need to disable interrupt
#ifndef NRF52
#if !( defined(NRF52) || defined(NRF52_SERIES) )
noInterrupts(); // Need 100% focus on instruction timing
#endif
......@@ -1201,9 +1201,9 @@ void Adafruit_NeoPixel::show(void) {
#error "Sorry, only 48 MHz is supported, please set Tools > CPU Speed to 48 MHz"
#endif // F_CPU == 48000000
// Begin of support for NRF52832 based boards -------------------------
// Begin of support for nRF52 based boards -------------------------
#elif defined(NRF52)
#elif defined(NRF52) || defined(NRF52_SERIES)
// [[[Begin of the Neopixel NRF52 EasyDMA implementation
// by the Hackerspace San Salvador]]]
// This technique uses the PWM peripheral on the NRF52. The PWM uses the
......@@ -1245,7 +1245,7 @@ void Adafruit_NeoPixel::show(void) {
//
// If there is no device available an alternative cycle-counter
// implementation is tried.
// The nRF52832 runs with a fixed clock of 64Mhz. The alternative
// The nRF52 runs with a fixed clock of 64Mhz. The alternative
// implementation is the same as the one used for the Teensy 3.0/1/2 but
// with the Nordic SDK HAL & registers syntax.
// The number of cycles was hand picked and is guaranteed to be 100%
......@@ -1277,8 +1277,14 @@ void Adafruit_NeoPixel::show(void) {
// Try to find a free PWM device, which is not enabled
// and has no connected pins
NRF_PWM_Type* PWM[3] = {NRF_PWM0, NRF_PWM1, NRF_PWM2};
for(int device = 0; device<3; device++) {
NRF_PWM_Type* PWM[] = {
NRF_PWM0, NRF_PWM1, NRF_PWM2
#ifdef NRF_PWM3
,NRF_PWM3
#endif
};
for(int device = 0; device < (sizeof(PWM)/sizeof(PWM[0])); device++) {
if( (PWM[device]->ENABLE == 0) &&
(PWM[device]->PSEL.OUT[0] & PWM_PSEL_OUT_CONNECT_Msk) &&
(PWM[device]->PSEL.OUT[1] & PWM_PSEL_OUT_CONNECT_Msk) &&
......@@ -1292,7 +1298,7 @@ void Adafruit_NeoPixel::show(void) {
// only malloc if there is PWM device available
if ( pwm != NULL ) {
#ifdef ARDUINO_FEATHER52 // use thread-safe malloc
#ifdef ARDUINO_NRF52_ADAFRUIT // use thread-safe malloc
pixels_pattern = (uint16_t *) rtos_malloc(pattern_size);
#else
pixels_pattern = (uint16_t *) malloc(pattern_size);
......@@ -1307,7 +1313,7 @@ void Adafruit_NeoPixel::show(void) {
for(uint16_t n=0; n<numBytes; n++) {
uint8_t pix = pixels[n];
for(uint8_t mask=0x80, i=0; mask>0; mask >>= 1, i++) {
for(uint8_t mask=0x80; mask>0; mask >>= 1) {
#ifdef NEO_KHZ400
if( !is800KHz ) {
pixels_pattern[pos] = (pix & mask) ? MAGIC_T1H_400KHz : MAGIC_T0H_400KHz;
......@@ -1322,8 +1328,8 @@ void Adafruit_NeoPixel::show(void) {
}
// Zero padding to indicate the end of que sequence
pixels_pattern[++pos] = 0 | (0x8000); // Seq end
pixels_pattern[++pos] = 0 | (0x8000); // Seq end
pixels_pattern[pos++] = 0 | (0x8000); // Seq end
pixels_pattern[pos++] = 0 | (0x8000); // Seq end
// Set the wave mode to count UP