When trying to compile an app with the neopixel library for photon locally i get an error, on the cloud I do not
Im getting error:
applications/Box5/Neopix.cpp:58:52: note: in expansion of macro 'pinLO'
#define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))
^
applications/Box5/Neopix.cpp:238:9: note: in expansion of macro 'pinSet'
pinSet(pin, HIGH); // HIGH
^
applications/Box5/Neopix.cpp:55:56: error: 'struct GPIO_TypeDef' has no member n
amed 'BSRRL'
#define pinHI(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRL = PIN_MAP2[_pin].g
pio_pin)
^
applications/Box5/Neopix.cpp:58:38: note: in expansion of macro 'pinHI'
#define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))
^
applications/Box5/Neopix.cpp:241:11: note: in expansion of macro 'pinSet'
pinSet(pin, LOW);
^
applications/Box5/Neopix.cpp:54:56: error: 'struct GPIO_TypeDef' has no member n
amed 'BSRRH'
#define pinLO(_pin) (PIN_MAP2[_pin].gpio_peripheral->BSRRH = PIN_MAP2[_pin].g
pio_pin)
^
applications/Box5/Neopix.cpp:58:52: note: in expansion of macro 'pinLO'
............. it goes on referring to the same issue
the aforementioned posts make me think i need to replace the gpio.peripheral-->bSRRH line and th e one below it with some sort of fastread/fastwrite function ?
@godjohnson, are you compiling with PLATFORM = photon? To be honest, those functions should be using the new pinSetFast() and pinResetFast() functions. I’ll ping @BDub to get his thoughts since he’s the library owner.
yes I am compiling with that line included, I wasnt sure why it compiles fine on WebIDE and particle dev but not locally. I saw in another post that you recommended replacing with those functions, but the register names did not have H and L at the end.
@godjohnson, the longer register names are used on the STM32F205 of the Photon vs the shorter names of the Core’s STM32F103. I’ll post a PR to the library but @BDub may not be able to do the merge until the Electron is released. Since you’ve copied the library files locally, the changes are simple:
#if PLATFORM_ID == 0 // Core
#define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
#define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
#elif (PLATFORM_ID == 6) || (PLATFORM_ID == 8) || (PLATFORM_ID == 10) // Photon (6) or P1 (8) or Electron (10)
#define pinLO(_pin) pinResetFast(_pin)
#define pinHI(_pin) pinSetFast(_pin)
#else
#error "*** PLATFORM_ID not supported by this library. PLATFORM should be Core, Photon, or P1 ***"
#endif
// fast pin access
#define pinSet(_pin, _hilo) digitalWriteFast(_pin, _hilo)
It’s compiling locally ok for me so I’m wondering what your full make command is, and what directory you are in? For me I’m using commands like this:
✶brett✶ ~/code/firmware/modules $ make clean all PLATFORM_ID=6 APPDIR=~/code/fw-apps/neo2 COMPILE_LTO=n -s
/Users/brett/code/firmware/modules/photon/system-part1/makefile /Users/brett/code/firmware/modules/photon/system-part2/makefile /Users/brett/code/firmware/modules/photon/user-part/makefile
text data bss dec hex filename
249704 144 132 249980 3d07c ../../../build/target/system-part1/platform-6-m/system-part1.elf
text data bss dec hex filename
169924 2044 38428 210396 335dc ../../../build/target/system-part2/platform-6-m/system-part2.elf
text data bss dec hex filename
7068 8 376 7452 1d1c /Users/brett/code/fw-apps/neo2/target/neo2.elf
✶brett✶ ~/code/firmware/modules $ make clean all PLATFORM_ID=8 APPDIR=~/code/fw-apps/neo2 COMPILE_LTO=n -s
/Users/brett/code/firmware/modules/photon/system-part1/makefile /Users/brett/code/firmware/modules/photon/system-part2/makefile /Users/brett/code/firmware/modules/photon/user-part/makefile
text data bss dec hex filename
249704 144 132 249980 3d07c ../../../build/target/system-part1/platform-8-m/system-part1.elf
text data bss dec hex filename
170420 2132 38496 211048 33868 ../../../build/target/system-part2/platform-8-m/system-part2.elf
text data bss dec hex filename
7068 8 376 7452 1d1c /Users/brett/code/fw-apps/neo2/target/neo2.elf
✶brett✶ ~/code/firmware/modules $ make clean all PLATFORM_ID=10 APPDIR=~/code/fw-apps/neo2 COMPILE_LTO=n -s
/Users/brett/code/firmware/modules/electron/system-part1/makefile /Users/brett/code/firmware/modules/electron/system-part2/makefile /Users/brett/code/firmware/modules/electron/user-part/makefile
text data bss dec hex filename
122900 192 360 123452 1e23c ../../../build/target/system-part1/platform-10-m/system-part1.elf
text data bss dec hex filename
110312 2668 5128 118108 1cd5c ../../../build/target/system-part2/platform-10-m/system-part2.elf
text data bss dec hex filename
7164 8 452 7624 1dc8 /Users/brett/code/fw-apps/neo2/target/neo2.elf
You do have to edit the example file to include function prototypes for rainbow and Wheel and #include neopixel.h" instead of #include neopixel/neopixel.h" (I also edited this one to work with an older version of the Internet Button which uses A7 and 11 pixels)
/*
* This is a minimal example, see extra-examples.cpp for a version
* with more explantory documentation, example routines, how to
* hook up your pixels and all of the pixel types that are supported.
*
*/
#include "application.h"
#include "neopixel.h"
SYSTEM_MODE(AUTOMATIC);
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN A7
#define PIXEL_COUNT 11
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void rainbow(uint8_t wait);
uint32_t Wheel(byte WheelPos);
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
rainbow(20);
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
Also make sure you have a recent commit pulled from the firmware repo.
Hey sorry I started another semester of school and have been very busy. Im assuming my problem probably lies in incorrect use of Make GNU and firmware version issues, I will try and update you when I have more time to investigate, thanks for the response.