0.96寸OLED驱动程序

drv_oled.h

/**
 * @file drv_oled.h
 *
 * @brief 0.96寸OLED SPI驱动程序
 * @author BusyBox (busybox177634@gmail.com)
 * @date 2024/9/2
 *
 */

#pragma once

#include "stdint.h"


enum OLED_FONT_SIZE
{
    OLED_FONT_SIZE_0608 = 1,
    OLED_FONT_SIZE_0612 = 2,
};

typedef void(*oled_spi_tx_callback_t)(uint8_t *data, uint32_t len);
typedef void(*oled_gpio_rst_callback_t)(uint8_t level);
typedef void(*oled_gpio_dc_callback_t)(uint8_t level);
typedef void(*oled_delay_callback_t)(uint32_t ms);

/**!
 * @brief oled驱动初始化
 *
 * @param[in] tx_callback    spi 数据发送回调
 * @param[in] rst_callback   rst 引脚控制回调
 * @param[in] dc_callback    dc  引脚控制回调
 * @param[in] delay_callback 延时回调
 * @return 0 初始化成功 -1 回调函数空指针错误
 */
int drv_oled_init(oled_spi_tx_callback_t   tx_callback,
                  oled_gpio_rst_callback_t rst_callback,
                  oled_gpio_dc_callback_t  dc_callback,
                  oled_delay_callback_t    delay_callback);

/**!
 * @brief 将内存缓冲区内的图像写入oled设备
 */
void oled_refresh_gram();

/**!
 * @brief 开启OLED显示
 */
void oled_display_on();

/**!
 * @brief 关闭OLED显示
 */
void oled_display_off();

/**!
 * @brief OLED清屏
 */
void oled_clear();

/**!
 * @brief 在内存缓冲区内画点
 *
 * @param[in] x
 * @param[in] y
 * @param[in] value 1 显示 0 不显示
 */
void oled_draw_point(uint8_t x, uint8_t y, uint8_t value);

/**!
 * @brief 以矩形方式填充内存缓冲区
 *
 * @param[in] x1 左上角x坐标
 * @param[in] y1 左上角y坐标
 * @param[in] x2 右下角x坐标
 * @param[in] y2 右下角y坐标
 * @param value 1 显示 0 不显示
 */
void oled_fill(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t value);

/**!
 * @brief 在内存缓冲区内写字符
 *
 * @param[in] x
 * @param[in] y
 * @param[in] ch
 * @param[in] font_size 一共支持3种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612, OLED_FONT_SIZE_1224
 */
void oled_draw_char(uint8_t x, uint8_t y, uint8_t ch, enum OLED_FONT_SIZE font_size);

/**!
 * @brief 在内存缓冲区中写数字字符串
 *
 * @param[in] x
 * @param[in] y
 * @param[in] number
 * @param[in] len 字符串长度,数字位数不足len的前面补0
 * @param[in] font_size 一共支持2种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612
 */
void oled_draw_number(uint8_t x, uint8_t y, uint32_t number, uint8_t len, enum OLED_FONT_SIZE font_size);

/**!
 * @brief 在内存缓冲区中写字符串
 *
 * @param[in] x
 * @param[in] y
 * @param[in] str
 * @param[in] font_size 一共支持2种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612
 */
void oled_draw_string(uint8_t x, uint8_t y, const uint8_t *str, enum OLED_FONT_SIZE font_size);

drv_oled.c

/**
 * @file drv_oled.h
 *
 * @brief 0.96寸OLED SPI驱动程序
 * @author BusyBox (busybox177634@gmail.com)
 * @date 2024/9/2
 *
 */

#include "math.h"

#include "oled_font.h"

#include "drv_oled.h"


#define OLED_DC_CMD  0
#define OLED_DC_DATA 1


static oled_spi_tx_callback_t   oled_spi_tx_callback_   = 0;
static oled_gpio_rst_callback_t oled_gpio_rst_callback_ = 0;
static oled_gpio_dc_callback_t  oled_gpio_dc_callback_  = 0;
static oled_delay_callback_t    oled_delay_callback_    = 0;

volatile static uint8_t oled_gram_[128][8];


static void oled_write_byte(uint8_t data, uint8_t cmd)
{
    oled_gpio_dc_callback_(cmd);
    oled_spi_tx_callback_(&data, 1);
    oled_gpio_dc_callback_(OLED_DC_DATA);
}

/**!
 * @brief oled驱动初始化
 *
 * @param[in] tx_callback    spi 数据发送回调
 * @param[in] rst_callback   rst 引脚控制回调
 * @param[in] dc_callback    dc  引脚控制回调
 * @param[in] delay_callback 延时回调
 * @return 0 初始化成功 -1 回调函数空指针错误
 */
int drv_oled_init(oled_spi_tx_callback_t   tx_callback,
                  oled_gpio_rst_callback_t rst_callback,
                  oled_gpio_dc_callback_t  dc_callback,
                  oled_delay_callback_t    delay_callback)
{
    oled_spi_tx_callback_   = tx_callback;
    oled_gpio_rst_callback_ = rst_callback;
    oled_gpio_dc_callback_  = dc_callback;
    oled_delay_callback_    = delay_callback;

    if (!tx_callback)    return -1;
    if (!rst_callback)   return -1;
    if (!dc_callback)    return -1;
    if (!delay_callback) return -1;


    oled_gpio_dc_callback_(OLED_DC_DATA);

    oled_gpio_rst_callback_(0);
    oled_delay_callback_(100);
    oled_gpio_rst_callback_(1);


    oled_write_byte(0xAE, OLED_DC_CMD);
    oled_write_byte(0xD5, OLED_DC_CMD);
    oled_write_byte(0x80, OLED_DC_CMD);
    oled_write_byte(0xA8, OLED_DC_CMD);
    oled_write_byte(0X3F, OLED_DC_CMD);
    oled_write_byte(0xD3, OLED_DC_CMD);
    oled_write_byte(0X00, OLED_DC_CMD);

    oled_write_byte(0x40, OLED_DC_CMD);

    oled_write_byte(0x8D, OLED_DC_CMD);
    oled_write_byte(0x14, OLED_DC_CMD);
    oled_write_byte(0x20, OLED_DC_CMD);
    oled_write_byte(0x02, OLED_DC_CMD);
    oled_write_byte(0xA1, OLED_DC_CMD);
    oled_write_byte(0xC0, OLED_DC_CMD);
    oled_write_byte(0xDA, OLED_DC_CMD);
    oled_write_byte(0x12, OLED_DC_CMD);

    oled_write_byte(0x81, OLED_DC_CMD);
    oled_write_byte(0xEF, OLED_DC_CMD);
    oled_write_byte(0xD9, OLED_DC_CMD);
    oled_write_byte(0xf1, OLED_DC_CMD);
    oled_write_byte(0xDB, OLED_DC_CMD);
    oled_write_byte(0x30, OLED_DC_CMD);

    oled_write_byte(0xA4, OLED_DC_CMD);
    oled_write_byte(0xA6, OLED_DC_CMD);
    oled_write_byte(0xAF, OLED_DC_CMD);
    oled_clear();

}

/**!
 * @brief 将内存缓冲区内的图像写入oled设备
 */
void oled_refresh_gram()
{
    for (uint8_t i = 0; i < 8; i++) {
        oled_write_byte(0xb0 + i, OLED_DC_CMD);
        oled_write_byte(0x00, OLED_DC_CMD);
        oled_write_byte(0x10, OLED_DC_CMD);

        for (uint8_t n = 0; n < 128; n++) {
            oled_write_byte(oled_gram_[n][i], OLED_DC_DATA);
        }
    }
}

/**!
 * @brief 开启OLED显示
 */
void oled_display_on()
{
    oled_write_byte(0X8D, OLED_DC_CMD);
    oled_write_byte(0X14, OLED_DC_CMD);
    oled_write_byte(0XAF, OLED_DC_CMD);
}

/**!
 * @brief 关闭OLED显示
 */
void oled_display_off()
{
    oled_write_byte(0X8D, OLED_DC_CMD);
    oled_write_byte(0X10, OLED_DC_CMD);
    oled_write_byte(0XAE, OLED_DC_CMD);
}

/**!
 * @brief OLED清屏
 */
void oled_clear()
{
    for (uint8_t i = 0; i < 8; i++)
        for (uint8_t n = 0; n < 128; n++)
            oled_gram_[n][i] = 0;

    oled_refresh_gram();
}

/**!
 * @brief 在内存缓冲区内画点
 *
 * @param[in] x
 * @param[in] y
 * @param[in] value 1 显示 0 不显示
 */
void oled_draw_point(uint8_t x, uint8_t y, uint8_t value)
{
    if (x > 127 || y > 63) return ;

    uint8_t pos  = 7 - y / 8;
    uint8_t bx   = y % 8;
    uint8_t temp = 1 << (7 - bx);

    if (value) oled_gram_[x][pos] |=  temp;
    else       oled_gram_[x][pos] &= ~temp;
}

/**!
 * @brief 以矩形方式填充内存缓冲区
 *
 * @param[in] x1 左上角x坐标
 * @param[in] y1 左上角y坐标
 * @param[in] x2 右下角x坐标
 * @param[in] y2 右下角y坐标
 * @param value 1 显示 0 不显示
 */
void oled_fill(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t value)
{
    for (uint8_t x = x1; x <= x2; x++)
        for (uint8_t y = y1; y <= y2; y++)
            oled_draw_point(x, y, value);
}


/**!
 * @brief 在内存缓冲区内写字符
 *
 * @param[in] x
 * @param[in] y
 * @param[in] ch
 * @param[in] font_size 一共支持2种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612
 */
void oled_draw_char(uint8_t x, uint8_t y, uint8_t ch, enum OLED_FONT_SIZE font_size)
{
    uint8_t height, width;
    switch (font_size) {
        case OLED_FONT_SIZE_0608:
            width  = 6;
            height = 8;
            break;
        case OLED_FONT_SIZE_0612:
            width  = 6;
            height = 12;
            break;
        default:
            return;
    }

    uint8_t y0 = y;
    uint8_t csize = (height / 8 + ((height% 8 ) ? 1 : 0)) * width;
    ch = ch- ' ';

    for (uint8_t t = 0; t < csize; t++) {
        uint8_t temp;
        switch (font_size) {
            case OLED_FONT_SIZE_0608:
                temp = asc2_0608[ch][t];
                break;
            case OLED_FONT_SIZE_0612:
                temp = asc2_0612[ch][t];
                break;
        }

        for (uint8_t t1 = 0; t1 < 8; t1++) {
            if (temp & 0x80) oled_draw_point(x, y, 1);
            else oled_draw_point(x, y, 0);
            temp <<= 1;
            y++;
            if ((y - y0) == height) {
                y = y0;
                x++;
                break;
            }
        }
    }
}

/**!
 * @brief 在内存缓冲区中写数字字符串
 *
 * @param[in] x
 * @param[in] y
 * @param[in] number
 * @param[in] len 字符串长度,数字位数不足len的前面补0
 * @param[in] font_size 一共支持2种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612
 */
void oled_draw_number(uint8_t x, uint8_t y, uint32_t number, uint8_t len, enum OLED_FONT_SIZE font_size)
{
    uint8_t width;
    switch (font_size) {
        case OLED_FONT_SIZE_0608:
            width  = 6;
            break;
        case OLED_FONT_SIZE_0612:
            width  = 6;
            break;
        default:
            return;
    }

    uint8_t enshow = 0;
    for (uint8_t t = 0; t < len; t++) {
        uint8_t temp = (number / (int)pow(10, len - t - 1)) % 10;
        if (enshow == 0 && t < (len - 1)) {
            if(temp == 0) {
                oled_draw_char(x + width * t, y, '0', font_size);
                continue;
            } else {
                enshow = 1;
            }
        }
        oled_draw_char(x + width * t, y, temp + '0', font_size);
    }
}

/**!
 * @brief 在内存缓冲区中写字符串
 *
 * @param[in] x
 * @param[in] y
 * @param[in] str
 * @param[in] font_size 一共支持2种 OLED_FONT_SIZE_0608, OLED_FONT_SIZE_0612
 */
void oled_draw_string(uint8_t x, uint8_t y, const uint8_t *str, enum OLED_FONT_SIZE font_size)
{
    uint8_t width, height;
    switch (font_size) {
        case OLED_FONT_SIZE_0608:
            width  =  6;
            height =  8;
            break;
        case OLED_FONT_SIZE_0612:
            width  =  6;
            height = 12;
            break;
        default:
            return;
    }

    while ((*str <= '~') && (*str >= ' ')) {
        if (x > (128 - width)) {
            x = 0;
            y += height;
        }
        if (y > (64 - height)) {
            y = x = 0;
            oled_clear();
        }
        oled_draw_char(x, y, *str, font_size);
        x += width;
        str++;
    }
}


oled_font.h

/**
 * @file drv_font.h
 *
 * @brief 0.96寸OLED 字体
 * @author BusyBox (busybox177634@gmail.com)
 * @date 2024/9/2
 *
 */

#pragma once

#include "stdint.h"

const uint8_t asc2_0608[95][6]={
        {0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
        {0x00,0x00,0x60,0xFA,0x60,0x00},/*"!",1*/
        {0x00,0xE0,0xC0,0x00,0xE0,0xC0},/*""",2*/
        {0x00,0x24,0x7E,0x24,0x7E,0x24},/*"#",3*/
        {0x00,0x24,0xD4,0x56,0x48,0x00},/*"$",4*/
        {0x00,0xC6,0xC8,0x10,0x26,0xC6},/*"%",5*/
        {0x00,0x6C,0x92,0x6A,0x04,0x0A},/*"&",6*/
        {0x00,0x00,0xE0,0xC0,0x00,0x00},/*"'",7*/
        {0x00,0x00,0x7C,0x82,0x00,0x00},/*"(",8*/
        {0x00,0x00,0x82,0x7C,0x00,0x00},/*")",9*/
        {0x00,0x10,0x7C,0x38,0x7C,0x10},/*"*",10*/
        {0x00,0x10,0x10,0x7C,0x10,0x10},/*"+",11*/
        {0x00,0x00,0x07,0x06,0x00,0x00},/*",",12*/
        {0x00,0x10,0x10,0x10,0x10,0x10},/*"-",13*/
        {0x00,0x00,0x06,0x06,0x00,0x00},/*".",14*/
        {0x00,0x04,0x08,0x10,0x20,0x40},/*"/",15*/
        {0x00,0x7C,0x8A,0x92,0xA2,0x7C},/*"0",16*/
        {0x00,0x00,0x42,0xFE,0x02,0x00},/*"1",17*/
        {0x00,0x46,0x8A,0x92,0x92,0x62},/*"2",18*/
        {0x00,0x44,0x92,0x92,0x92,0x6C},/*"3",19*/
        {0x00,0x18,0x28,0x48,0xFE,0x08},/*"4",20*/
        {0x00,0xF4,0x92,0x92,0x92,0x8C},/*"5",21*/
        {0x00,0x3C,0x52,0x92,0x92,0x0C},/*"6",22*/
        {0x00,0x80,0x8E,0x90,0xA0,0xC0},/*"7",23*/
        {0x00,0x6C,0x92,0x92,0x92,0x6C},/*"8",24*/
        {0x00,0x60,0x92,0x92,0x94,0x78},/*"9",25*/
        {0x00,0x00,0x36,0x36,0x00,0x00},/*":",26*/
        {0x00,0x00,0x37,0x36,0x00,0x00},/*";",27*/
        {0x00,0x10,0x28,0x44,0x82,0x00},/*"<",28*/
        {0x00,0x24,0x24,0x24,0x24,0x24},/*"=",29*/
        {0x00,0x00,0x82,0x44,0x28,0x10},/*">",30*/
        {0x00,0x40,0x80,0x9A,0x90,0x60},/*"?",31*/
        {0x00,0x7C,0x82,0xBA,0xAA,0x78},/*"@",32*/
        {0x00,0x7E,0x88,0x88,0x88,0x7E},/*"A",33*/
        {0x00,0xFE,0x92,0x92,0x92,0x6C},/*"B",34*/
        {0x00,0x7C,0x82,0x82,0x82,0x44},/*"C",35*/
        {0x00,0xFE,0x82,0x82,0x82,0x7C},/*"D",36*/
        {0x00,0xFE,0x92,0x92,0x92,0x82},/*"E",37*/
        {0x00,0xFE,0x90,0x90,0x90,0x80},/*"F",38*/
        {0x00,0x7C,0x82,0x92,0x92,0x5E},/*"G",39*/
        {0x00,0xFE,0x10,0x10,0x10,0xFE},/*"H",40*/
        {0x00,0x00,0x82,0xFE,0x82,0x00},/*"I",41*/
        {0x00,0x0C,0x02,0x02,0x02,0xFC},/*"J",42*/
        {0x00,0xFE,0x10,0x28,0x44,0x82},/*"K",43*/
        {0x00,0xFE,0x02,0x02,0x02,0x02},/*"L",44*/
        {0x00,0xFE,0x40,0x20,0x40,0xFE},/*"M",45*/
        {0x00,0xFE,0x40,0x20,0x10,0xFE},/*"N",46*/
        {0x00,0x7C,0x82,0x82,0x82,0x7C},/*"O",47*/
        {0x00,0xFE,0x90,0x90,0x90,0x60},/*"P",48*/
        {0x00,0x7C,0x82,0x8A,0x84,0x7A},/*"Q",49*/
        {0x00,0xFE,0x90,0x90,0x98,0x66},/*"R",50*/
        {0x00,0x64,0x92,0x92,0x92,0x4C},/*"S",51*/
        {0x00,0x80,0x80,0xFE,0x80,0x80},/*"T",52*/
        {0x00,0xFC,0x02,0x02,0x02,0xFC},/*"U",53*/
        {0x00,0xF8,0x04,0x02,0x04,0xF8},/*"V",54*/
        {0x00,0xFC,0x02,0x3C,0x02,0xFC},/*"W",55*/
        {0x00,0xC6,0x28,0x10,0x28,0xC6},/*"X",56*/
        {0x00,0xE0,0x10,0x0E,0x10,0xE0},/*"Y",57*/
        {0x00,0x8E,0x92,0xA2,0xC2,0x00},/*"Z",58*/
        {0x00,0x00,0xFE,0x82,0x82,0x00},/*"[",59*/
        {0x00,0x40,0x20,0x10,0x08,0x04},/*"\",60*/
        {0x00,0x00,0x82,0x82,0xFE,0x00},/*"]",61*/
        {0x00,0x20,0x40,0x80,0x40,0x20},/*"^",62*/
        {0x01,0x01,0x01,0x01,0x01,0x01},/*"_",63*/
        {0x00,0x00,0xC0,0xE0,0x00,0x00},/*"`",64*/
        {0x00,0x04,0x2A,0x2A,0x2A,0x1E},/*"a",65*/
        {0x00,0xFE,0x22,0x22,0x22,0x1C},/*"b",66*/
        {0x00,0x1C,0x22,0x22,0x22,0x14},/*"c",67*/
        {0x00,0x1C,0x22,0x22,0x22,0xFE},/*"d",68*/
        {0x00,0x1C,0x2A,0x2A,0x2A,0x10},/*"e",69*/
        {0x00,0x10,0x7E,0x90,0x90,0x00},/*"f",70*/
        {0x00,0x18,0x25,0x25,0x25,0x3E},/*"g",71*/
        {0x00,0xFE,0x20,0x20,0x1E,0x00},/*"h",72*/
        {0x00,0x00,0x00,0xBE,0x02,0x00},/*"i",73*/
        {0x00,0x02,0x01,0x21,0xBE,0x00},/*"j",74*/
        {0x00,0xFE,0x08,0x14,0x22,0x00},/*"k",75*/
        {0x00,0x00,0x00,0xFE,0x02,0x00},/*"l",76*/
        {0x00,0x3E,0x20,0x18,0x20,0x1E},/*"m",77*/
        {0x00,0x3E,0x20,0x20,0x1E,0x00},/*"n",78*/
        {0x00,0x1C,0x22,0x22,0x22,0x1C},/*"o",79*/
        {0x00,0x3F,0x22,0x22,0x22,0x1C},/*"p",80*/
        {0x00,0x1C,0x22,0x22,0x22,0x3F},/*"q",81*/
        {0x00,0x22,0x1E,0x22,0x20,0x10},/*"r",82*/
        {0x00,0x10,0x2A,0x2A,0x2A,0x04},/*"s",83*/
        {0x00,0x20,0x7C,0x22,0x24,0x00},/*"t",84*/
        {0x00,0x3C,0x02,0x04,0x3E,0x00},/*"u",85*/
        {0x00,0x38,0x04,0x02,0x04,0x38},/*"v",86*/
        {0x00,0x3C,0x06,0x0C,0x06,0x3C},/*"w",87*/
        {0x00,0x36,0x08,0x08,0x36,0x00},/*"x",88*/
        {0x00,0x39,0x05,0x06,0x3C,0x00},/*"y",89*/
        {0x00,0x26,0x2A,0x2A,0x32,0x00},/*"z",90*/
        {0x00,0x10,0x7C,0x82,0x82,0x00},/*"{",91*/
        {0x00,0x00,0x00,0xEE,0x00,0x00},/*"|",92*/
        {0x00,0x00,0x82,0x82,0x7C,0x10},/*"}",93*/
        {0x00,0x40,0x80,0x40,0x80,0x00},/*"~",94*/
};

const uint8_t asc2_0612[95][12]={
        {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
        {0x00,0x00,0x00,0x00,0x3F,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
        {0x00,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x40,0x00,0x00,0x00},/*""",2*/
        {0x09,0x00,0x0B,0xC0,0x3D,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00},/*"#",3*/
        {0x18,0xC0,0x24,0x40,0x7F,0xE0,0x22,0x40,0x31,0x80,0x00,0x00},/*"$",4*/
        {0x18,0x00,0x24,0xC0,0x1B,0x00,0x0D,0x80,0x32,0x40,0x01,0x80},/*"%",5*/
        {0x03,0x80,0x1C,0x40,0x27,0x40,0x1C,0x80,0x07,0x40,0x00,0x40},/*"&",6*/
        {0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
        {0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x40,0x20},/*"(",8*/
        {0x00,0x00,0x40,0x20,0x20,0x40,0x1F,0x80,0x00,0x00,0x00,0x00},/*")",9*/
        {0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00},/*"*",10*/
        {0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x00,0x00},/*"+",11*/
        {0x00,0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
        {0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"-",13*/
        {0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
        {0x00,0x20,0x01,0xC0,0x06,0x00,0x38,0x00,0x40,0x00,0x00,0x00},/*"/",15*/
        {0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"0",16*/
        {0x00,0x00,0x10,0x40,0x3F,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"1",17*/
        {0x18,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x18,0x40,0x00,0x00},/*"2",18*/
        {0x10,0x80,0x20,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"3",19*/
        {0x02,0x00,0x0D,0x00,0x11,0x00,0x3F,0xC0,0x01,0x40,0x00,0x00},/*"4",20*/
        {0x3C,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x23,0x80,0x00,0x00},/*"5",21*/
        {0x1F,0x80,0x24,0x40,0x24,0x40,0x34,0x40,0x03,0x80,0x00,0x00},/*"6",22*/
        {0x30,0x00,0x20,0x00,0x27,0xC0,0x38,0x00,0x20,0x00,0x00,0x00},/*"7",23*/
        {0x1B,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"8",24*/
        {0x1C,0x00,0x22,0xC0,0x22,0x40,0x22,0x40,0x1F,0x80,0x00,0x00},/*"9",25*/
        {0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
        {0x00,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
        {0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40},/*"<",28*/
        {0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00},/*"=",29*/
        {0x00,0x00,0x40,0x40,0x20,0x80,0x11,0x00,0x0A,0x00,0x04,0x00},/*">",30*/
        {0x18,0x00,0x20,0x00,0x23,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"?",31*/
        {0x1F,0x80,0x20,0x40,0x27,0x40,0x29,0x40,0x1F,0x40,0x00,0x00},/*"@",32*/
        {0x00,0x40,0x07,0xC0,0x39,0x00,0x0F,0x00,0x01,0xC0,0x00,0x40},/*"A",33*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00},/*"B",34*/
        {0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00},/*"C",35*/
        {0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"D",36*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x40,0x30,0xC0,0x00,0x00},/*"E",37*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x00,0x30,0x00,0x00,0x00},/*"F",38*/
        {0x0F,0x00,0x10,0x80,0x20,0x40,0x22,0x40,0x33,0x80,0x02,0x00},/*"G",39*/
        {0x20,0x40,0x3F,0xC0,0x04,0x00,0x04,0x00,0x3F,0xC0,0x20,0x40},/*"H",40*/
        {0x20,0x40,0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x00,0x00},/*"I",41*/
        {0x00,0x60,0x20,0x20,0x20,0x20,0x3F,0xC0,0x20,0x00,0x20,0x00},/*"J",42*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x0B,0x00,0x30,0xC0,0x20,0x40},/*"K",43*/
        {0x20,0x40,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0xC0},/*"L",44*/
        {0x3F,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x3F,0xC0,0x00,0x00},/*"M",45*/
        {0x20,0x40,0x3F,0xC0,0x0C,0x40,0x23,0x00,0x3F,0xC0,0x20,0x00},/*"N",46*/
        {0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00},/*"O",47*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x00,0x18,0x00,0x00,0x00},/*"P",48*/
        {0x1F,0x80,0x21,0x40,0x21,0x40,0x20,0xE0,0x1F,0xA0,0x00,0x00},/*"Q",49*/
        {0x20,0x40,0x3F,0xC0,0x24,0x40,0x26,0x00,0x19,0xC0,0x00,0x40},/*"R",50*/
        {0x18,0xC0,0x24,0x40,0x24,0x40,0x22,0x40,0x31,0x80,0x00,0x00},/*"S",51*/
        {0x30,0x00,0x20,0x40,0x3F,0xC0,0x20,0x40,0x30,0x00,0x00,0x00},/*"T",52*/
        {0x20,0x00,0x3F,0x80,0x00,0x40,0x00,0x40,0x3F,0x80,0x20,0x00},/*"U",53*/
        {0x20,0x00,0x3E,0x00,0x01,0xC0,0x07,0x00,0x38,0x00,0x20,0x00},/*"V",54*/
        {0x38,0x00,0x07,0xC0,0x3C,0x00,0x07,0xC0,0x38,0x00,0x00,0x00},/*"W",55*/
        {0x20,0x40,0x39,0xC0,0x06,0x00,0x39,0xC0,0x20,0x40,0x00,0x00},/*"X",56*/
        {0x20,0x00,0x38,0x40,0x07,0xC0,0x38,0x40,0x20,0x00,0x00,0x00},/*"Y",57*/
        {0x30,0x40,0x21,0xC0,0x26,0x40,0x38,0x40,0x20,0xC0,0x00,0x00},/*"Z",58*/
        {0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x00,0x00},/*"[",59*/
        {0x00,0x00,0x70,0x00,0x0C,0x00,0x03,0x80,0x00,0x40,0x00,0x00},/*"\",60*/
        {0x00,0x00,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00},/*"]",61*/
        {0x00,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
        {0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10},/*"_",63*/
        {0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
        {0x00,0x00,0x02,0x80,0x05,0x40,0x05,0x40,0x03,0xC0,0x00,0x40},/*"a",65*/
        {0x20,0x00,0x3F,0xC0,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"b",66*/
        {0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x06,0x40,0x00,0x00},/*"c",67*/
        {0x00,0x00,0x03,0x80,0x04,0x40,0x24,0x40,0x3F,0xC0,0x00,0x40},/*"d",68*/
        {0x00,0x00,0x03,0x80,0x05,0x40,0x05,0x40,0x03,0x40,0x00,0x00},/*"e",69*/
        {0x00,0x00,0x04,0x40,0x1F,0xC0,0x24,0x40,0x24,0x40,0x20,0x00},/*"f",70*/
        {0x00,0x00,0x02,0xE0,0x05,0x50,0x05,0x50,0x06,0x50,0x04,0x20},/*"g",71*/
        {0x20,0x40,0x3F,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"h",72*/
        {0x00,0x00,0x04,0x40,0x27,0xC0,0x00,0x40,0x00,0x00,0x00,0x00},/*"i",73*/
        {0x00,0x10,0x00,0x10,0x04,0x10,0x27,0xE0,0x00,0x00,0x00,0x00},/*"j",74*/
        {0x20,0x40,0x3F,0xC0,0x01,0x40,0x07,0x00,0x04,0xC0,0x04,0x40},/*"k",75*/
        {0x20,0x40,0x20,0x40,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x00},/*"l",76*/
        {0x07,0xC0,0x04,0x00,0x07,0xC0,0x04,0x00,0x03,0xC0,0x00,0x00},/*"m",77*/
        {0x04,0x40,0x07,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40},/*"n",78*/
        {0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00},/*"o",79*/
        {0x04,0x10,0x07,0xF0,0x04,0x50,0x04,0x40,0x03,0x80,0x00,0x00},/*"p",80*/
        {0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x50,0x07,0xF0,0x00,0x10},/*"q",81*/
        {0x04,0x40,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x00,0x00},/*"r",82*/
        {0x00,0x00,0x06,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x00,0x00},/*"s",83*/
        {0x00,0x00,0x04,0x00,0x1F,0x80,0x04,0x40,0x00,0x40,0x00,0x00},/*"t",84*/
        {0x04,0x00,0x07,0x80,0x00,0x40,0x04,0x40,0x07,0xC0,0x00,0x40},/*"u",85*/
        {0x04,0x00,0x07,0x00,0x04,0xC0,0x01,0x80,0x06,0x00,0x04,0x00},/*"v",86*/
        {0x06,0x00,0x01,0xC0,0x07,0x00,0x01,0xC0,0x06,0x00,0x00,0x00},/*"w",87*/
        {0x04,0x40,0x06,0xC0,0x01,0x00,0x06,0xC0,0x04,0x40,0x00,0x00},/*"x",88*/
        {0x04,0x10,0x07,0x10,0x04,0xE0,0x01,0x80,0x06,0x00,0x04,0x00},/*"y",89*/
        {0x00,0x00,0x04,0x40,0x05,0xC0,0x06,0x40,0x04,0x40,0x00,0x00},/*"z",90*/
        {0x00,0x00,0x00,0x00,0x04,0x00,0x7B,0xE0,0x40,0x20,0x00,0x00},/*"{",91*/
        {0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00},/*"|",92*/
        {0x00,0x00,0x40,0x20,0x7B,0xE0,0x04,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
        {0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
};

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.3OLED全套资料 132 X 64 Dot Matrix OLED/PLED Preliminary Segment/Common Driver with Controller 1 V0.2 Features „ Support maximum 132 X 64 dot matrix panel „ Embedded 132 X 64 bits SRAM „ Operating voltage: - Logic voltage supply: VDD1 = 1.65V - 3.5V - DC-DC voltage supply: VDD2 = 3.0V – 4.2V - OLED Operating voltage supply: External VPP supply = 6.4V - 13.0V Internal VPP generator = 6.4V - 9.0V „ Maximum segment output current: 200μA „ Maximum common sink current: 27mA „ 8-bit 6800-series parallel interface, 8-bit 8080-series parallel interface, 3-wire & 4-wire serial peripheral interface, 400KHz fast I2C bus interface „ Programmable frame frequency and multiplexing ratio „ Row re-mapping and column re-mapping (ADC) „ Vertical scrolling „ On-chip oscillator „ Programmable Internal charge pump circuit output „ 256-step contrast control on monochrome passive OLED panel „ Low power consumption - Sleep mode: <5μA - VDD1=0V,VDD2=3.0V – 4.2V: <5μA - VDD1,2=0V,VPP=3.0V – 4.2V: <5μA „ Wide range of operating temperatures: -40 to +85°C „ Available in COG form, thickness: 300μm General Description SH1106 is a single-chip CMOS OLED/PLED driver with controller for organic/polymer light emitting diode dot-matrix graphic display system. SH1106 consists of 132 segments, 64 commons that can support a maximum display resolution of 132 X 64. It is designed for Common Cathode type OLED panel. SH1106 embeds with contrast control, display RAM oscillator and efficient DC-DC converter, which reduces the number of external components and power consumption. SH1106 is suitable for a wide range of compact portable applications, such as sub-display of mobile phone, calculator and MP3 player, etc.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值