Hello all! I am working on running an LED control library on an Intel Galileo Gen 2. I tested the library and a sample sketch on an Arduino Uno and it works, but when I try to compile it for the Galileo Gen 2 I get the error "'F_CPU' was not declared in this scope". Looking at the library (for LPD8806 if it matters), I see it is using it twice.
Here:
// Teensy/Gemma-specific stuff for hardware-assisted SPI @ 2 MHz
#if (**F_CPU** > 8000000L)
#define SPI_DELAY asm volatile("rjmp .+0"); // Burn 2 cycles
#elif (**F_CPU** > 4000000L)
#define SPI_DELAY asm volatile("nop"); // Burn 1 cycle
#else
#define SPI_DELAY // Run max speed
#endif
And here:
// Enable SPI hardware and set up protocol details:
void LPD8806::startSPI(void) {
#ifdef __AVR_ATtiny85__
PORTB &= ~(_BV(PORTB1) | _BV(PORTB2)); // Outputs
DDRB |= _BV(PORTB1) | _BV(PORTB2); // DO (NOT MOSI) + SCK
#else
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
// SPI bus is run at 2MHz. Although the LPD8806 should, in theory,
// work up to 20MHz, the unshielded wiring from the Arduino is more
// susceptible to interference. Experiment and see what you get.
#if defined(__AVR__) || defined(CORE_TEENSY)
SPI.setClockDivider(SPI_CLOCK_DIV8);
#else
SPI.setClockDivider(**(F_CPU** + 1000000L) / 2000000L);
#endif
#endif
I'd like to set this so the library can be used on this board, but I'm afraid I'll brick my board if I mess up the CPU frequency. Does anyone know if I can just swap it for a different variable and set that to some default value to test?