コード例 #1
0
ファイル: S65L2F50.cpp プロジェクト: Overtuner/Arduino-Libs
void S65L2F50::begin(uint_least8_t clock_div)
{
  //init pins
#if defined(RST_PIN)
  pinMode(RST_PIN, OUTPUT);
  RST_ENABLE();
#endif
  pinMode(CS_PIN, OUTPUT);
  pinMode(RS_PIN, OUTPUT);
  pinMode(CLK_PIN, OUTPUT);
  pinMode(MOSI_PIN, OUTPUT);
  CS_DISABLE();

#if !defined(SOFTWARE_SPI)
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(clock_div);
  SPI.begin();
#endif

  //reset display
  reset(clock_div);

  return;
}
コード例 #2
0
ファイル: MI0283QT2.cpp プロジェクト: verlhac/Arduino-Libs
void MI0283QT2::begin(uint_least8_t clock_div)
{
  //init pins
#if defined(RST_PIN)
  pinMode(RST_PIN, OUTPUT);
  RST_ENABLE();
#endif
  pinMode(LED_PIN, OUTPUT);
  pinMode(CS_PIN, OUTPUT);
  pinMode(CLK_PIN, OUTPUT);
  pinMode(MOSI_PIN, OUTPUT);
  pinMode(MISO_PIN, INPUT);
  LED_DISABLE();
  CS_DISABLE();
#if defined(ADS7846)
  pinMode(ADSCS_PIN, OUTPUT);
  ADSCS_DISABLE();
#endif

#if !defined(SOFTWARE_SPI)
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(clock_div);
  SPI.begin();
#endif

  //reset display
  reset(clock_div);

  //enable backlight
  led(50);

  return;
}
コード例 #3
0
ファイル: MI0283QT9.cpp プロジェクト: Bokinis/Arduino-Libs
void MI0283QT9::begin(uint_least8_t clock_div)
{
  //init pins
#if defined(RST_PIN)
  pinMode(RST_PIN, OUTPUT);
  RST_ENABLE();
#endif
  pinMode(LED_PIN, OUTPUT);
  pinMode(CS_PIN, OUTPUT);
#if defined(LCD_8BIT_SPI)
  pinMode(RS_PIN, OUTPUT);
  RS_HIGH();
#endif
  pinMode(SCK_PIN, OUTPUT);
  pinMode(MOSI_PIN, OUTPUT);
  pinMode(MISO_PIN, INPUT);
  LED_DISABLE();
  CS_DISABLE();
#if defined(ADS7846)
  pinMode(ADSCS_PIN, OUTPUT);
  ADSCS_DISABLE();
#endif

#if !defined(SOFTWARE_SPI)
  lcd_clock_div = clock_div;
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  //SPI.setClockDivider(clock_div);
  SPI.begin();
#endif

  //SPI speed-down
#if !defined(SOFTWARE_SPI)
# if F_CPU >= 128000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV64);
# elif F_CPU >= 64000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV32);
# elif F_CPU >= 32000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV16);
# elif F_CPU >= 16000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV8);
# else //elif F_CPU >= 8000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV4);
# endif
#endif

  //reset display
  reset();

  //SPI speed-up
#if !defined(SOFTWARE_SPI)
  SPI.setClockDivider(clock_div);
#endif

  //enable backlight
  led(50);

  return;
}
コード例 #4
0
ファイル: display.c プロジェクト: cnvogelg/knobterm
void display_reset(void)
{
    //reset
    CS_DISABLE();
    RST_ENABLE();
    _delay_ms(50);
    RST_DISABLE();
    _delay_ms(50);

    //driving ability
    wr_cmd(0xEA, 0x0000);
    wr_cmd(0xEB, 0x0020);
    wr_cmd(0xEC, 0x000C);
    wr_cmd(0xED, 0x00C4);
    wr_cmd(0xE8, 0x0040);
    wr_cmd(0xE9, 0x0038);
    wr_cmd(0xF1, 0x0001);
    wr_cmd(0xF2, 0x0010);
    wr_cmd(0x27, 0x00A3);

    //power voltage
    wr_cmd(0x1B, 0x001B);
    wr_cmd(0x1A, 0x0001);
    wr_cmd(0x24, 0x002F);
    wr_cmd(0x25, 0x0057);

    //VCOM offset
    wr_cmd(0x23, 0x008D); //for flicker adjust

    //power on
    wr_cmd(0x18, 0x0036);
    wr_cmd(0x19, 0x0001); //start osc
    wr_cmd(0x01, 0x0000); //wakeup
    wr_cmd(0x1F, 0x0088);
    _delay_ms(5);
    wr_cmd(0x1F, 0x0080);
    _delay_ms(5);
    wr_cmd(0x1F, 0x0090);
    _delay_ms(5);
    wr_cmd(0x1F, 0x00D0);
    _delay_ms(5);

    //color selection
    wr_cmd(0x17, 0x0005); //0x0005=65k, 0x0006=262k

    //panel characteristic
    wr_cmd(0x36, 0x0000);

    //display on
    wr_cmd(0x28, 0x0038);
    _delay_ms(40);
    wr_cmd(0x28, 0x003C);

    //display options
    display_set_orientation(0);
}
コード例 #5
0
ファイル: S65L2F50.cpp プロジェクト: G0Z/Arduino-Libs
void S65L2F50::begin(uint_least8_t clock_div)
{
  //init pins
#if defined(RST_PIN)
  pinMode(RST_PIN, OUTPUT);
  RST_ENABLE();
#endif
  pinMode(CS_PIN, OUTPUT);
  pinMode(RS_PIN, OUTPUT);
  pinMode(SCK_PIN, OUTPUT);
  pinMode(MOSI_PIN, OUTPUT);
  CS_DISABLE();

#if !defined(SOFTWARE_SPI)
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  //SPI.setClockDivider(clock_div);
  SPI.begin();
#endif

  //SPI speed-down
#if !defined(SOFTWARE_SPI)
# if F_CPU >= 128000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV64);
# elif F_CPU >= 64000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV32);
# elif F_CPU >= 32000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV16);
# elif F_CPU >= 16000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV8);
# else //elif F_CPU >= 8000000UL
  SPI.setClockDivider(SPI_CLOCK_DIV4);
# endif
#endif

  //reset display
  reset();

  //SPI speed-up
#if !defined(SOFTWARE_SPI)
  SPI.setClockDivider(clock_div);
#endif

  return;
}
コード例 #6
0
ファイル: RedFly.cpp プロジェクト: CMon/arduinoWifiRemote
uint8_t REDFLY::init(uint32_t br, uint8_t pwr)
{
  uint8_t ret=0xFF, i;
  uint32_t timeout;

  //init pins
#ifdef CS_PIN
  pinMode(CS_PIN, OUTPUT);
  digitalWriteFast(CS_PIN, HIGH); //deselect
#endif
#ifdef RST_PIN
  pinMode(RST_PIN, OUTPUT);
  digitalWriteFast(RST_PIN, LOW); //reset on
#endif
#ifdef TX_PIN
  pinMode(TX_PIN, OUTPUT);
  digitalWriteFast(TX_PIN, HIGH);
#endif
#ifdef RX_PIN
  pinMode(RX_PIN, INPUT);
  digitalWriteFast(RX_PIN, HIGH); //pull-up on
#endif

  //reset vars
  memset(ipaddr, 0, sizeof(ipaddr));
  memset(buffer, 0, sizeof(buffer));

  //set serial port config
  baudrate = br;
  setbaudrate(br);

  //enable module communication
  enable();

  //reset module
  delay_10ms(2); //wait 20ms
  RST_ENABLE();
  delay_10ms(30); //wait 300ms
  RST_DISABLE()

  //auto baud rate detection
  delay_10ms(10); //wait 100ms
  for(i=4; i!=0; i--) //try 4 times
  {
    write(0x1C); //transmit 0x1C
    for(timeout=F_CPU/64UL; timeout!=0; timeout--) //wait for response
    {
      if(available())
      {
        if(read() == 0x55) //wait for 0x55
        {
          write(0x55); //transmit 0x55
          delay_10ms(10);  //wait 100ms
          //skip firmware upgrade question at power on
          write('n');
          write('\n');
          ret = 0xFE;
          i = 1;  //break 1st for loop
          break; //break 2nd for loop
        }
      }
    }
  }
  delay_10ms(20); //wait 200ms for booting

  //get firmware version and set config
  // if(ret == 0xFE)
  // {
    for(i=3; i!=0; i--) //try 3 times
    {
      flush();
      if(cmd(PSTR(CMD_FWVERSION)) == 0)
      {
        //cmd(PSTR(CMD_RESET)); //soft reset
        cmd(PSTR(CMD_BAND BAND24));
        cmd(PSTR(CMD_INIT));
        tx_power = pwr;
        ret = 0;
        break;
      }
      delay_10ms(10);
    }
  // }

  if(ret)
  {
    disable();
  }

  return ret;
}