Beispiel #1
0
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 tm1637::i2cAck (void)
{
    CLK_LOW();
    DIO_HIGH();
    delayMicroseconds (5); 
    while (digitalRead(_dio));
    CLK_HIGH();
    delayMicroseconds (2);
    CLK_LOW();
}
/// ========================================
void tm1637::i2cStop (void) 
{
    CLK_LOW();
    delayMicroseconds (2);
    DIO_LOW();
    delayMicroseconds (2);
    CLK_HIGH();
    delayMicroseconds (2);
    DIO_HIGH();
}
Beispiel #4
0
static void spear_adc_set_clk(struct spear_adc_info *info, u32 val)
{
	u32 clk_high, clk_low, count;
	u32 apb_clk = clk_get_rate(info->clk);

	count = (apb_clk + val - 1) / val;
	clk_low = count / 2;
	clk_high = count - clk_low;
	info->current_clk = apb_clk / count;

	__raw_writel(CLK_LOW(clk_low) | CLK_HIGH(clk_high),
		     &info->adc_base_spear6xx->clk);
}
void tm1637::i2cWrite (uint8_t oneByte)
{
    uint8_t i;
    for (i=0; i<8; i++)
    {
        CLK_LOW();
        (oneByte & 0x01)? DIO_HIGH(): DIO_LOW();
        delayMicroseconds (3);
        oneByte = oneByte >> 1;
        CLK_HIGH();
        delayMicroseconds (3);
    }
}
Beispiel #6
0
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;
}