Example #1
0
bool nrf6350_lcd_init(void)
{
  if (!twi_master_init())
  {
    return false;
  }

  // Sometimes the first command doesn't get through, so we'll try
  // sending non-important "wake up" command first and don't care if it fails.
  (void)nrf6350_lcd_wake_up();

  if (!nrf6350_lcd_set_instruction(0x38))                 // Function set.
    return false;
  if (!nrf6350_lcd_set_instruction(0x39))                 // Choose two-line mode.
    return false;
  if (!nrf6350_lcd_set_instruction(0x14))                 // Internal OSC frequency.
    return false;
  if (!nrf6350_lcd_set_contrast(LCD_CONTRAST_HIGH))       // Contrast set (low byte).
    return false;
  if (!nrf6350_lcd_set_instruction(0x5F))                 // Power/ICON control/.
    return false;
  if (!nrf6350_lcd_set_instruction(0x6A))                 // Follower control.
    return false;
  nrf_delay_us(200000);                                   // Need to wait 200ms here according to datasheet.
  if (!nrf6350_lcd_on())                                  // Display ON.
    return false;
  if (!nrf6350_lcd_clear())                               // Clear display.
    return false;
  return nrf6350_lcd_set_instruction(0x06);               // Entry mode set.
}
Example #2
0
bool nrf6350_lcd_init(void)
{
  if (!twi_master_init())
    return false;
  if (!nrf6350_lcd_set_instruction(0x38))                 // Function set
    return false;
  if (!nrf6350_lcd_set_instruction(0x39))                 // Choose two-line mode
    return false;
  if (!nrf6350_lcd_set_instruction(0x14))                 // Internal OSC frequency
    return false;
  if (!nrf6350_lcd_set_contrast(LCD_CONTRAST_HIGH))       // Contrast set (low byte)
    return false;
  if (!nrf6350_lcd_set_instruction(0x5F))                 // Power/ICON control/
    return false;
  if (!nrf6350_lcd_set_instruction(0x6A))                 // Follower control
    return false;
  nrf_delay_us(200000);                                   // Need to wait 200ms here according to datasheet
  if (!nrf6350_lcd_on())                                  // Display ON
    return false;
  if (!nrf6350_lcd_clear())                               // Clear display
    return false;
  return nrf6350_lcd_set_instruction(0x06);               // Entry mode set
}