【嵌入式C】中景园0.96屏幕旋转90°显示

2022-04-07  本文已影响0人  Blue_Well

这里根据ROTATE的值选择顺时针还是逆时针旋转。

void OLED_DrawPoint(u8 x, u8 y, u8 t)
{
    u8 i, m, n;
    uint8_t x0 = x, y0 = y;
    if(ROTATE == 90)
    {
        x = 95 - y0;
        y = x0;
    }
    else if(ROTATE == 270)
    {
        x = y0;
        y = 95 - x0;
    }

    i = y / 8;
    m = y % 8;
    n = 1 << m;
    if(t)
    {
        OLED_GRAM[x][i] |= n;
    }
    else
    {
        OLED_GRAM[x][i] = ~OLED_GRAM[x][i];
        OLED_GRAM[x][i] |= n;
        OLED_GRAM[x][i] = ~OLED_GRAM[x][i];
    }
}
上一篇 下一篇

猜你喜欢

热点阅读