void ST7558::init(void) {
  Wire.begin();
  
  colstart= 0x80;
  rowstart= 0x40;
  
  hwReset();
  
  i2cwrite(cmd_init, sizeof(cmd_init));
  
  // set up a bounding box for screen updates
  updateBoundingBox(0, 0, _width-1, _height-1);
  
}
Ejemplo n.º 2
0
bool CLASS::increaseActivationLevel( UInt32 newLevel )
{
    bool success = false;

    switch (newLevel)
    {
        case kActivationLevelKDP:

            if ((fPCINub == 0) || (fPCINub->open(this) == false))
            {
                ERROR_LOG("%s: open provider failed\n", getName());
                break;
            }

            // Allocate software runtime resources.

            if (swInit() == false)
            {
                ERROR_LOG("%s: swInit failed\n", getName());
                break;
            }

            // Issue hardware soft reset.

            if (hwReset() == false)
            {
                ERROR_LOG("%s: hwReset failed\n", getName());
                break;
            }

            // Configure hardware but keep it disabled.

            hwInit();

            // PHY and link layer programming.

            if (phySelectMedium(getSelectedMedium(), true) !=
                kIOReturnSuccess)
            {
                ERROR_LOG("%s: phySelectMedium error\n", getName());
            }

            // Enable transmit + receive.

            WriteReg(CR, CR_TXE | CR_RXE);

            fWatchdogTimer->setTimeoutMS(kWatchdogTimerPeriodMS);
            success = true;
            break;

        case kActivationLevelBSD:

            fTransmitQueue->setCapacity(kTransmitQueueCapacity);
            fTransmitQueue->start();

            enableHardwareInterrupts();

            success = true;
            break;
    }

    return success;
}