int init_spi(void) { #if CFG_CC3000_SPI_PORT == 1 ssp1Init(); #else ssp0Init(); #endif /* Set VBAT EN pin to output */ LPC_GPIO->DIR[CFG_CC3000_EN_PORT] |= (1 << CFG_CC3000_EN_PIN); LPC_GPIO->SET[CFG_CC3000_EN_PORT] = (1 << CFG_CC3000_EN_PIN); delay(100); /* Set CS pin to output */ LPC_GPIO->DIR[CFG_CC3000_CS_PORT] |= (1 << CFG_CC3000_CS_PIN); CC3000_DEASSERT_CS; /* Set interrupt/gpio pin to input */ LPC_GPIO->DIR[CFG_CC3000_IRQ_PORT] &= ~(1 << CFG_CC3000_IRQ_PIN); /* Channel 2, sense (0=edge, 1=level), polarity (0=low/falling, 1=high/rising) */ GPIOSetPinInterrupt( 2, CFG_CC3000_IRQ_PORT, CFG_CC3000_IRQ_PIN, 0, 1 ); /* Enable interrupt 2 on falling edge */ GPIOPinIntEnable( 2, 0 ); return(ESUCCESS); }
// Initialize the VFD, set pin directions, etc. uint8_t VFDInit() { if ( VFDStatus == NOTINITIALIZED ){ LPC_GPIO->DIR[PORT0] |= (1<<4); // VFD Power LPC_GPIO->DIR[PORT1] |= (1<<14); // VFD Strobe LPC_GPIO->DIR[PORT1] |= (1<<15); // VFD Clock LPC_GPIO->DIR[PORT1] |= (1<<22); // VFD Data ssp1Init(); // Initialize SPI for the VFD } // Turn on the 40v VFD Power, and Initialize the VFD if(VFDSendCommand(VFD_ON) != 0){ return 1; } VFDStatus = INITIALIZED; return 0; }
void ws2812bInit( void ) { // Make sure SSP is initialised ssp1Init(); }