// Activate hard/soft SPI as appropriate: void Adafruit_WS2801::begin(void) { if(hardwareSPI == true) { startSPI(); } else { pinMode(datapin, OUTPUT); pinMode(clkpin , OUTPUT); } begun = true; }
// Change pin assignments post-constructor, switching to hardware SPI: void Adafruit_WS2801::updatePins(void) { pinMode(datapin, INPUT); // Restore data and clock pins to inputs pinMode(clkpin , INPUT); datapin = clkpin = 0; hardwareSPI = true; // If begin() was previously invoked, init the SPI hardware now: if(begun == true) startSPI(); // Otherwise, SPI is NOT initted until begin() is explicitly called. }
// Change pin assignments post-constructor, switching to hardware SPI: void Adafruit_WS2801::updatePins(void) { hardwareSPI = true; datapin = clkpin = 0; // If begin() was previously invoked, init the SPI hardware now: if(begun == true) startSPI(); // Otherwise, SPI is NOT initted until begin() is explicitly called. // Note: any prior clock/data pin directions are left as-is and are // NOT restored as inputs! }
int main(void){ uart_init(); uart_puts_P(PSTR("\nETHERNET TEST > PROGRAM STARTED\n")); uart_puts_P(PSTR("UART initiated\n")); startSPI(); uint16_t v = socketNumberToAddress(2); uint8_t a[] = {v<<8, v|0xFF}; uart_puth(a , 2); uart_puts_P(PSTR("\n\n")); uart_putn(pgm_read_byte(var) & 0xFF); halt(); return 0; }
// Activate hard/soft SPI as appropriate: void LPD8806::begin(void) { if(hardwareSPI == true) startSPI(); else startBitbang(); begun = true; }