technobly / Particle-DotStar

An Implementation of Adafruit's DotStar Library for the Spark Core
GNU General Public License v3.0
8 stars 14 forks source link

'PIN_MAP' was not declared in this scope #1

Closed stevesparks closed 8 years ago

stevesparks commented 9 years ago

Veryfing code using this library in Particle Build fails with this error:

dotstar/dotstar.cpp:39:22: error: 'PIN_MAP' was not declared in this scope
 #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
                      ^

All I did was add the library via the interface.

technobly commented 9 years ago

Hey @stevesparks! Thanks for the note about this. I was JUST thinking about this library this morning. It doesn't change the fact that I'm short on time for this at the moment though. Please check out this MACRO implementation for low level GPIO between the Core and Photon that works on the NeoPixel library: https://github.com/technobly/SparkCore-NeoPixel/blob/master/firmware/neopixel.cpp#L52-L64

If you get it working and can submit a Pull Request I would be grateful!

ElectroMagus commented 9 years ago

I'm trying to verify/compile the Strand Test (with either hardware and software SPI)t, and I get the following error:

dotstarstrip.cpp:18:1: warning: "/" within comment [-Wcomment] /_ ======================= includes ================================= */ ^ dotstar/dotstar.cpp: In member function 'void Adafruit_DotStar::sw_spi_init()':

The following error messages were after the option to submit a bug report:

dotstar/dotstar.cpp:40:38: note: in expansion of macro 'pinHI'

define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

                                  ^

dotstar/dotstar.cpp:129:3: note: in expansion of macro 'pinSet' pinSet(dataPin , LOW); ^ dotstar/dotstar.cpp: In member function 'void Adafruit_DotStar::sw_spi_out(uint8_t)': dotstar/dotstar.cpp:39:22: error: 'PIN_MAP' was not declared in this scope

define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)

                  ^

dotstar/dotstar.cpp:40:38: note: in expansion of macro 'pinHI'

define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

                                  ^

dotstar/dotstar.cpp:140:18: note: in expansion of macro 'pinSet' if(n & 0x80) pinSet(dataPin, HIGH); ^ dotstar/dotstar.cpp:39:22: error: 'PIN_MAP' was not declared in this scope

define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)

                  ^

dotstar/dotstar.cpp:40:38: note: in expansion of macro 'pinHI'

define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

                                  ^

dotstar/dotstar.cpp:141:18: note: in expansion of macro 'pinSet' else pinSet(dataPin, LOW); ^ dotstar/dotstar.cpp:39:22: error: 'PIN_MAP' was not declared in this scope

define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)

                  ^

dotstar/dotstar.cpp:40:38: note: in expansion of macro 'pinHI'

define pinSet(_pin, _hilo) (_hilo ? pinHI(_pin) : pinLO(_pin))

                                  ^

dotstar/dotstar.cpp:142:5: note: in expansion of macro 'pinSet' pinSet(clockPin, HIGH); ^ make[1]: * [../build/target/user/platform-6dotstar/dotstar.o] Error 1 make: * [user] Error 2 Error: Could not compile. Please review your code.

technobly commented 8 years ago

v0.0.3 is published to Particle Libraries, tested and working on Core and Photon. Compiles for P1 and Electron (sorry no time to test those right now but they should work fine). https://build.particle.io/libs/56247fe4eef6db92ae000c69/tab/1-strandtest.cpp