Ejemplo n.º 1
0
/**  scalable horizontally and vertically 
 */
void OLED_Putchar(char ch)
{
    uint8_t i, j, k, byte;
    const uint8_t *f = &font[(ch-' ')*5];
    const uint8_t mask[]={1, 3, 7, 0xf };
    
    for(i=0; i<6; i++) {
        uint32_t word;
        byte = *f++ << 1;
        if (i==5) byte = 0;
        for(j=0; j<8; j++) { // expand byte to word
            word <<= _sy;
            if (byte & 0x80) word |= mask[_sy-1];
            byte <<= 1;
        }
        for(j=0; j<_sy; j++){ // exp vert
            OLED_SetRow(_y+j) ;  
            OLED_SetColumn(_x+i*_sx);
            for(k=0; k<_sx; k++){ // exp horiz
                OLED_Data(word);
            }
            word >>= 8;
        }
    }
    
    _x+= 6 * _sx; 
    if (_x >= OLED_WIDTH) { // wrap x
        _x = 0; OLED_SetColumn(0); 
        _y += _sy;   
        if (_y >= 5-_sy) { // wrap y
            _y = 0;
        }
        OLED_SetRow(_y);
    }
}
Ejemplo n.º 2
0
void OLED_PutPicture(const uint8_t *pic)
{
    unsigned char i,j;
    for(i=0; i<5; i++) // 5*8=40 pixel rows (actually 39)
    {
        OLED_SetRow(i);
        OLED_SetColumn(0);
        for(j=0; j<96; j++)  // 96 pixel columns
        {
            OLED_Data(*pic++);
        }
    }
}
Ejemplo n.º 3
0
void OLED_Clear(void)
{
    unsigned char i,j;
    for(i=0; i<5; i++) // 5*8=40 pixel rows (actually 39)
    {
        OLED_SetRow(i);
        OLED_SetColumn(0);
        for(j=0; j<96; j++)  OLED_Data(0);
    }
    _x = 0; _y = 0;
    OLED_SetRow(0);
    OLED_SetColumn(0);
}
Ejemplo n.º 4
0
static void OLED_SendData(unsigned char dat)
{
  char i;
  OLED_Data();
  OLED_SelectDSPL();
  OLED_sendByte(dat);
  /*
  for (i=8;i>0;i--)
  {
    if(dat&0x80) P5OUT|=MOSI; else P5OUT&=~MOSI;
    P5OUT^=UCLK;
    dat=dat<<1;
    P5OUT^=UCLK;
  }
  */
  OLED_DeselectDSPL();
}