void MI0283QT9::draw(uint16_t color) { //9th bit MOSI_HIGH(); //data CLK_LOW(); #if defined(SOFTWARE_SPI) CLK_HIGH(); #else SPCR &= ~(1<<SPE); //disable SPI CLK_HIGH(); SPCR |= (1<<SPE); //enable SPI #endif wr_spi(color>>8); //9th bit MOSI_HIGH(); //data CLK_LOW(); #if defined(SOFTWARE_SPI) CLK_HIGH(); #else SPCR &= ~(1<<SPE); //disable SPI CLK_HIGH(); SPCR |= (1<<SPE); //enable SPI #endif wr_spi(color); return; }
void ADS7846_wr_spi(uint_least8_t data) { #if defined(SOFTWARE_SPI) ti_lib_ioc_pin_type_gpio_output(BOARD_IOID_SPI_MOSI); for (uint_least8_t mask = 0x80; mask != 0; mask >>= 1) { SCK_LOW(); if (mask & data) { MOSI_HIGH(); } else { MOSI_LOW(); } ADS7846_delay_ms(1); SCK_HIGH(); ADS7846_delay_ms(1); } SCK_LOW(); ADS7846_delay_ms(1); SCK_HIGH(); ADS7846_delay_ms(1); SCK_LOW(); #else SPI.transfer(data); #endif return; }
uchar ispTransmit(uchar send_byte) { uchar rec_byte = 0; uchar i; for (i = 0; i < 8; i++) { /* set MSB to MOSI-pin */ if ((send_byte & 0x80) != 0) { MOSI_HIGH() ; /* MOSI high */ } else { MOSI_LOW() ; /* MOSI low */ } /* shift to next bit */ send_byte = send_byte << 1; /* receive data */ rec_byte = rec_byte << 1; if (READ_MISO() != 0) { rec_byte++; } /* pulse SCK */ SCK_HIGH() ; /* SCK high */ ispDelay() ; SCK_LOW() ; /* SCK low */ ispDelay() ; } return rec_byte; }
void MI0283QT9::draw(uint_least16_t color) { #if defined(USE_8BIT_SPI) // RS_HIGH(); //data # else //9th bit MOSI_HIGH(); //data CLK_LOW(); # if defined(__AVR__) && !defined(SOFTWARE_SPI) SPCR &= ~(1<<SPE); //disable SPI CLK_HIGH(); SPCR |= (1<<SPE); //enable SPI # else CLK_HIGH(); # endif #endif wr_spi(color>>8); #if defined(USE_8BIT_SPI) // RS_HIGH(); //data # else //9th bit MOSI_HIGH(); //data CLK_LOW(); # if defined(__AVR__) && !defined(SOFTWARE_SPI) SPCR &= ~(1<<SPE); //disable SPI CLK_HIGH(); SPCR |= (1<<SPE); //enable SPI # else CLK_HIGH(); # endif #endif wr_spi(color); return; }
void MI0283QT9::draw(uint_least16_t color) { #if defined(LCD_8BIT_SPI) // RS_HIGH(); //data # else //9th bit MOSI_HIGH(); //data SCK_LOW(); # if !defined(SOFTWARE_SPI) && (defined(__AVR__) || defined(ARDUINO_ARCH_AVR)) SPCR &= ~(1<<SPE); //disable SPI SCK_HIGH(); SPCR |= (1<<SPE); //enable SPI # else SCK_HIGH(); # endif #endif wr_spi(color>>8); #if defined(LCD_8BIT_SPI) // RS_HIGH(); //data # else //9th bit MOSI_HIGH(); //data SCK_LOW(); # if !defined(SOFTWARE_SPI) && (defined(__AVR__) || defined(ARDUINO_ARCH_AVR)) SPCR &= ~(1<<SPE); //disable SPI SCK_HIGH(); SPCR |= (1<<SPE); //enable SPI # else SCK_HIGH(); # endif #endif wr_spi(color); return; }
void DAC8760::wr_spi(uint_least8_t data) { #if defined(SOFTWARE_SPI) for(uint_least8_t mask=0x80; mask!=0; mask>>=1) { SCK_LOW(); if(mask & data) { MOSI_HIGH(); } else { MOSI_LOW(); } SCK_HIGH(); } SCK_LOW(); #else SPI.transfer(data); #endif return; }