void OledUpdate() { int ipag; BYTE * pb; pb = rgbOledBmp; for (ipag = 0; ipag < cpagOledMax; ipag++) { PORTClearBits(prtDataCmd, bitDataCmd); /* Set the page address */ Spi2PutByte(0x22); //Set page command Spi2PutByte(ipag); //page number /* Start at the left column */ Spi2PutByte(0x00); //set low nybble of column Spi2PutByte(0x10); //set high nybble of column PORTSetBits(prtDataCmd, bitDataCmd); /* Copy this memory page of display data. */ OledPutBuffer(ccolOledMax, pb); pb += ccolOledMax; } }
void OledUpdate() { int gpioReg = 0; int ipag; uint8_t * pb; pb = rgbOledBmp; gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); for (ipag = 0; ipag < cpagOledMax; ipag++) { XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & ( RESET_MASK | VDD_CTRL_MASK | VBAT_CTRL_MASK )); /* Set the page address */ Spi2PutByte(0x22); //Set page command Spi2PutByte(ipag); //page number /* Start at the left column */ Spi2PutByte(0x00); //set low nybble of column Spi2PutByte(0x10); //set high nybble of column XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg | DATA_CMD_MASK); /* Copy this memory page of display data. */ OledPutBuffer(ccolOledMax, pb); pb += ccolOledMax; } }
void OledDevInit() { int gpioReg = 0; /* We're going to be sending commands, so clear the Data/Cmd bit */ gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & (RESET_MASK | VBAT_CTRL_MASK)); gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); printf("OledDevInit: d/cmd, vdd set to 0, gpioReg: %X", gpioReg); usleep(1000); /* Display off command */ Spi2PutByte(cmdOledDisplayOff); /* Bring Reset low and then high */ gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & ( VBAT_CTRL_MASK | VDD_CTRL_MASK | DATA_CMD_MASK)); gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); printf("OledDevInit: reset set to 0, gpioReg: %X", gpioReg); usleep(1000); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg | RESET_MASK); gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); printf("OledDevInit: reset set to 1, gpioReg: %X", gpioReg); /* Send the Set Charge Pump and Set Pre-Charge Period commands */ Spi2PutByte(0x8D); //From Univision data sheet, not in SSD1306 data sheet Spi2PutByte(0x14); Spi2PutByte(0xD9); //From Univision data sheet, not in SSD1306 data sheet Spi2PutByte(0xF1); /* Turn on VCC and wait 100ms */ gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & ( RESET_MASK | VDD_CTRL_MASK | DATA_CMD_MASK)); gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); printf("OledDevInit: vbat set to 0, gpioReg: %X", gpioReg); usleep(100000); /* Send the commands to invert the display. */ Spi2PutByte(cmdOledSegRemap); //remap columns Spi2PutByte(cmdOledComDir); //remap the rows /* Send the commands to select sequential COM configuration */ Spi2PutByte(cmdOledComConfig); //set COM configuration command Spi2PutByte(0x20); //sequential COM, left/right remap enabled /* Send Display On command */ Spi2PutByte(cmdOledDisplayOn); }
void OledDevInit() { /* We're going to be sending commands, so clear the Data/Cmd bit */ PORTClearBits(prtDataCmd, bitDataCmd); /* Start by turning VDD on and wait a while for the power to come up. */ PORTClearBits(prtVddCtrl, bitVddCtrl); delay(1); /* Display off command */ Spi2PutByte(cmdOledDisplayOff); /* Bring Reset low and then high */ PORTClearBits(prtReset, bitReset); delay(1); PORTSetBits(prtReset, bitReset); /* Send the Set Charge Pump and Set Pre-Charge Period commands */ Spi2PutByte(0x8D); //From Univision data sheet, not in SSD1306 data sheet Spi2PutByte(0x14); Spi2PutByte(0xD9); //From Univision data sheet, not in SSD1306 data sheet Spi2PutByte(0xF1); /* Turn on VCC and wait 100ms */ PORTClearBits(prtVbatCtrl, bitVbatCtrl); delay(100); /* Send the commands to invert the display. */ Spi2PutByte(cmdOledSegRemap); //remap columns Spi2PutByte(cmdOledComDir); //remap the rows /* Send the commands to select sequential COM configuration */ Spi2PutByte(cmdOledComConfig); //set COM configuration command Spi2PutByte(0x20); //sequential COM, left/right remap enabled /* Send Display On command */ Spi2PutByte(cmdOledDisplayOn); }
void OledDisplayOff() { PORTClearBits(prtDataCmd, bitDataCmd); Spi2PutByte(cmdOledDisplayOff); }
void OledDisplayOff() { int gpioReg = 0; gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & ( RESET_MASK | VDD_CTRL_MASK | VBAT_CTRL_MASK )); Spi2PutByte(cmdOledDisplayOff); }
void OledDevTerm() { /* Send the Display Off command. */ Spi2PutByte(cmdOledDisplayOff); /* Turn off VCC */ PORTSetBits(prtVbatCtrl, bitVbatCtrl); delay(100); /* Turn off VDD */ PORTClearBits(prtVddCtrl, bitVddCtrl); }
void OledDevTerm() { int gpioReg = 0; /* Send the Display Off command. */ Spi2PutByte(cmdOledDisplayOff); /* Turn off VCC */ gpioReg = XGpio_DiscreteRead(&gpioInstance, 1); XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg | VBAT_CTRL_MASK); usleep(100000); /* Turn off VDD */ XGpio_DiscreteWrite(&gpioInstance, 1, gpioReg & ( RESET_MASK | VDD_CTRL_MASK | DATA_CMD_MASK)); }