Example #1
0
 def OLED_WriteData(self, Data):
     if config.USE_SPI_4W == 1:
         config.digital_write(config.DC_PIN, GPIO.HIGH)
         config.digital_write(config.CS_PIN, GPIO.LOW)
         config.SPI4W_Write_Byte([Data])
         config.digital_write(config.CS_PIN, GPIO.HIGH)
     else:
         config.i2c_writebyte(Data, config.I2C_RAM)
Example #2
0
 def OLED_WriteReg(self, Reg):
     if config.USE_SPI_4W == 1:
         config.digital_write(config.DC_PIN, GPIO.LOW)
         config.digital_write(config.CS_PIN, GPIO.LOW)
         config.SPI4W_Write_Byte([Reg])
         config.digital_write(config.CS_PIN, GPIO.HIGH)
     else:
         config.i2c_writebyte(Reg, config.I2C_CMD)
Example #3
0
 def ShowImage(self, pBuf):
     for page in range(0,8):
         # set page address #
         self.command(0xB0 + page);
         # set low column address #
         self.command(0x02); 
         # set high column address #
         self.command(0x10); 
         # write data #
         time.sleep(0.01)
         if(self.Device == Device_SPI):
             GPIO.output(self._dc, GPIO.HIGH);
         for i in range(0,self.width):#for(int i=0;i<self.width; i++)
             if(self.Device == Device_SPI):
                 config.spi_writebyte([~pBuf[i+self.width*page]]); 
             else :
                 config.i2c_writebyte(0x40, ~pBuf[i+self.width*page])
Example #4
0
 def command(self, cmd):
     if(self.Device == Device_SPI):
         GPIO.output(self._dc, GPIO.LOW)
         config.spi_writebyte([cmd])
     else:
         config.i2c_writebyte(0x00, cmd)