32 #if defined(CONFIG_USI_SPI_AVAILABLE) && defined(CONFIG_USI_SPI_ENABLE) 35 #include <util/atomic.h> 37 #define PORT_SPI PORTB 43 static void ssd1306_spiConfigure_Usi()
45 DDR_SPI |= (1<<DD_DO);
46 DDR_SPI |= (1<<DD_SCK);
52 static void ssd1306_spiClose_Usi()
56 static void ssd1306_spiStart_Usi()
62 USICR = (0<<USIWM1) | (1<<USIWM0) |
63 (1<<USICS1) | (0<<USICS0) | (1<<USICLK);
66 static void ssd1306_spiSendByte_Usi(uint8_t data)
70 ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
72 while ( (USISR & (1<<USIOIF)) == 0 )
79 static void ssd1306_spiSendBytes_Usi(
const uint8_t *buffer, uint16_t size)
85 ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
87 while ( (USISR & (1<<USIOIF)) == 0 )
96 static void ssd1306_spiStop_Usi()
105 ssd1306_spiSendByte_Usi( 0x00 );
115 pinMode(cesPin, OUTPUT);
116 digitalWrite(cesPin, HIGH);
118 if (dcPin >= 0) pinMode(dcPin, OUTPUT);
119 if ((cesPin >= 0) || (dcPin >= 0))
125 ssd1306_spiConfigure_Usi();
void(* send)(uint8_t data)
void(* close)(void)
deinitializes internal resources, allocated for interface.
ssd1306_lcd_t ssd1306_lcd
void ssd1306_spiInit_Usi(int8_t cesPin, int8_t dcPin)
ssd1306_interface_t ssd1306_intf
void(* send_buffer)(const uint8_t *buffer, uint16_t size)
Sends bytes to SSD1306 device.