Esempio n. 1
0
//
// init
void LiquidCrystal_SR::init(uint8_t srdata, uint8_t srclock, uint8_t enable, 
                            uint8_t lines, uint8_t font)
{
   // Initialise private variables
   _two_wire = 0;
   
   _srDataRegister = fio_pinToOutputRegister(srdata);
   _srDataBit = fio_pinToBit(srdata);
   _srClockRegister = fio_pinToOutputRegister(srclock);
   _srClockBit = fio_pinToBit(srclock);
   
   if ((enable == TWO_WIRE) || (enable == srdata))
   {
      _two_wire = 1;
      _srEnableRegister = _srDataRegister;
      _srEnableBit = _srDataBit;
   }
   else
   {
      _srEnableRegister = fio_pinToOutputRegister(enable);
      _srEnableBit = fio_pinToBit(enable);
   }
   
   // Configure control pins as outputs
   // ------------------------------------------------------------------------
   
   _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
}
//
// init
void LiquidCrystal_SR2W::init(uint8_t srdata, uint8_t srclock, t_backlighPol blpol, uint8_t lines, uint8_t font)
{
	_srDataRegister = fio_pinToOutputRegister(srdata);
	_srDataMask = fio_pinToBit(srdata);
	_srClockRegister = fio_pinToOutputRegister(srclock);
	_srClockMask = fio_pinToBit(srclock);
   
	_blPolarity = blpol;
   
	_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
   
	backlight(); // set default backlight state to on
}