RVB2601 开箱测试-裸奔Oled+定时器+按键测试

本文作者:智峰科技年

本文转自:芯片开放社区(OCC)


RVB2601开发板到手有一段时间了,断断续续的测试集成开发环境的使用,这期间发现了很多的问题。经过摸索,在原先的演示程序的基础上修改了OLed的基本驱动,添加了可以打印汉字及英文字符串的一系列函数。将原先的测试需要操作系统的去除,直接裸奔,实现了,oled显示字符串,及定时器,按键测试。板子上面的 KEY1 压下,oled 显示KEY1。KEY2按下oled显示KEY2。


1,先说说CDK的一些问题及应对解决方法。CDK编译当前工程后,不能 点击 Debug 菜单下面的 Start/Stop Debug正确运行,一定要手动点击 Flash 菜单 下面Download将编译通过的程序写入RVB2601,然后,再点击Debug菜单下面 Start/Stop Debug的启动程序这样才能正确进入调试 。


2,如果,停止,调试后,无法再次进入调试,无论点击 Start/Stop Debug 还是 Start/Stop Debug Without Dowmload 都是无法正确调试的。必须再次Flash菜单再次Download才能再次进入调试 3, vsprintf 函数有问题,在其他开发环境正确的程序CDK编译出结果是不正确的,现象是 转换英文字符串,没有错误,转换汉字字符正确的 应该转换出2个BYTES,实际出来占用3BYTES。我的解决方案是直接调整指针。具体,可以参看我的oled 的驱动函数。


RVB2601 开箱测试-裸奔Oled+定时器+按键测试


具体的实现方法见下面的程序 main.c #define _DEFAULT_SOURCE /* needed for usleep() */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <aos/aos.h> #include "aos/cli.h"


#include "app_config.h" #include "app_init.h" #include "csi_config.h" #include "hw_config.h" #include "lvgl.h" #include "lv_label.h" #include "oled.h"


#include "board_config.h" #include "drv/gpio_pin.h" #include <drv/pin.h> #include <drv/pwm.h>


/*********************


DEFINES

*********************/ #define TAG "app"

/**********************

TYPEDEFS

**********************/

/**********************

  • STATIC PROTOTYPES **********************/ // GUI static void demo_task(void *arg);

/**********************

  • STATIC VARIABLES **********************/

/**********************

MACROS

**********************/

/**********************

  • GLOBAL FUNCTIONS **********************/

volatile uint32_t g_debug = 0; volatile uint32_t g_debug_v = 0;

static void demo_task(void *arg);

#include "csi_core.h"

extern void Myoled_init(); extern Display_5x7(unsigned int str,unsigned char x,unsigned char y,unsigned char fan); extern void LcdSet(uint16_t x0, uint16_t y0); extern void LcdPrintf(uint8_t fan,char *fmt,...);

#include "main.h"

#include <csi_config.h> #include <drv/timer.h> #include <drv/irq.h> #include "dw_timer_ll.h" #include <drv/spi.h>

#include <yoc/at_port.h> #include <devices/w800.h> #include <yoc/netmgr.h>

csi_timer_t timer1;

#define KEYDELAY 100

int test; uint32_t timeover = 0;

csi_gpio_pin_t pin_key1; csi_gpio_pin_t pin_key2;

#define KEY1_IN csi_gpio_pin_read(&pin_key1) #define KEY2_IN csi_gpio_pin_read(&pin_key2)

static void time_event_kb(csi_timer_t *timer_handle, void *arg) { timeover++; }

csi_error_t timer1_tick_init(void) { csi_error_t ret;

ret = csi_timer_init(&timer1, 0);
if (ret == CSI_OK) {
    ret = csi_timer_attach_callback(&timer1, &time_event_kb, NULL);
    if (ret == CSI_OK) {
        ret = csi_timer_start(&timer1, 1000);
    }
}
return ret;

}

/**

  • main */ int main(void) {
    csi_pin_set_mux(CONSOLE_TXD, CONSOLE_TXD_FUNC); csi_pin_set_mux(CONSOLE_RXD, CONSOLE_RXD_FUNC); // board_init(); console_init(CONSOLE_UART_IDX, 115200, 128);
    csi_pin_set_mux(PA11, PIN_FUNC_GPIO); //key1 csi_pin_set_mux(PA12, PIN_FUNC_GPIO); //key2 csi_gpio_pin_init(&pin_key1, PA11); csi_gpio_pin_dir(&pin_key1, GPIO_DIRECTION_INPUT); csi_gpio_pin_init(&pin_key2, PA12); csi_gpio_pin_dir(&pin_key2, GPIO_DIRECTION_INPUT);
    Myoled_init();
    printf("OLED Init...\n"); LcdSet(0,0); LcdPrintf(0x80,"Hello! Zhifeng!"); LcdSet(0,1); LcdPrintf(0,"Hello! Zhifeng!"); LcdSet(16,3); LcdPrintf(0x40,"-系-统-设-置-");
    timer1_tick_init();
    printf("timer Init...\n");
    while(1) {
if(timeover>100)
 {
    timeover=0;
     LcdSet(0,5);
    LcdPrintf(0,"Timer Demo %d",test++);    
    
    if(!csi_gpio_pin_read(&pin_key1))
    {
     LcdSet(0,7);
    LcdPrintf(0x80,"KEY1");                 
    }
    if(!csi_gpio_pin_read(&pin_key2))
    {
     LcdSet(40,7);
    LcdPrintf(0x80,"KEY2");                 
    }                   
 }
  • } return 0; }

main.h #ifndef MAIN_H #define MAIN_H

typedef struct { volatile uint8_t cnt; volatile uint8_t ok; volatile uint8_t dat; volatile uint8_t press; } tKEY;

#endif

OLED的驱动程序 oled.c /*

  • Copyright (C) 2015-2017 Alibaba Group Holding Limited */

/*********************

INCLUDES

*********************/ #include <stdio.h> #include <string.h> #include <soc.h> #include "lv_conf.h" #include "lvgl.h" #include "src/lv_hal/lv_hal.h" #include "oled.h" #include "board_config.h" #include "drv/gpio_pin.h" #include <drv/pin.h>

#define code

#define SPI // 4-wire Serial

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Delay Time //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void uDelay(unsigned char l) { udelay(l * 5); }

void Delay(unsigned char n) { udelay(n * 1000); }

#ifdef SPI // 4-wire Serial csi_gpio_pin_t pin_clk; csi_gpio_pin_t pin_mosi; csi_gpio_pin_t pin_cs; csi_gpio_pin_t pin_miso;

static void lcd_pinmux_init() { csi_pin_set_mux(PA28, PIN_FUNC_GPIO); //clk csi_pin_set_mux(PA29, PIN_FUNC_GPIO); //mosi csi_pin_set_mux(PA27, PIN_FUNC_GPIO); //cs csi_pin_set_mux(PA30, PIN_FUNC_GPIO); //miso }

static void lcd_gpio_init() { // csi_gpio_pin_init(&pin_clk, PA28); csi_gpio_pin_dir(&pin_clk, GPIO_DIRECTION_OUTPUT); csi_gpio_pin_init(&pin_mosi, PA29); csi_gpio_pin_dir(&pin_mosi, GPIO_DIRECTION_OUTPUT); csi_gpio_pin_init(&pin_cs, PA27); csi_gpio_pin_dir(&pin_cs, GPIO_DIRECTION_OUTPUT); csi_gpio_pin_init(&pin_miso, PA30); //dc csi_gpio_pin_dir(&pin_miso, GPIO_DIRECTION_OUTPUT); }

static void lcd_cs(uint8_t d) { if (d == 1) { csi_gpio_pin_write(&pin_cs, GPIO_PIN_HIGH); } else { csi_gpio_pin_write(&pin_cs, GPIO_PIN_LOW); } }

static void lcd_dc(uint8_t d) { if (d == 1) { csi_gpio_pin_write(&pin_miso, GPIO_PIN_HIGH); } else { csi_gpio_pin_write(&pin_miso, GPIO_PIN_LOW); } }

static void lcd_sclk(uint8_t d) { if (d == 1) { csi_gpio_pin_write(&pin_clk, GPIO_PIN_HIGH); } else { csi_gpio_pin_write(&pin_clk, GPIO_PIN_LOW); } }

static void lcd_sdin(uint8_t d) { if (d == 1) { csi_gpio_pin_write(&pin_mosi, GPIO_PIN_HIGH); } else { csi_gpio_pin_write(&pin_mosi, GPIO_PIN_LOW); } }

void Write_Command(unsigned char Data) { unsigned char i;

lcd_cs(0);
lcd_dc(0);
for (i = 0; i < 8; i++)
{
    lcd_sclk(0);
    lcd_sdin((Data & 0x80) >> 7);
    Data = Data << 1;
    lcd_sclk(1);
}
lcd_dc(1);
lcd_cs(1);

}

void Write_Data(unsigned char Data) { unsigned char i;

lcd_cs(0);
lcd_dc(1);
for (i = 0; i < 8; i++)
{
    lcd_sclk(0);
    lcd_sdin((Data & 0x80) >> 7);
    Data = Data << 1;
    lcd_sclk(1);
}
lcd_dc(1);
lcd_cs(1);

} #endif

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Instruction Setting //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void Set_Start_Column(unsigned char d) { Write_Command(0x00 + d % 16); // Set Lower Column Start Address for Page Addressing Mode // Default => 0x00 Write_Command(0x10 + d / 16); // Set Higher Column Start Address for Page Addressing Mode // Default => 0x10 }

void Set_Addressing_Mode(unsigned char d) { Write_Command(0x20); // Set Memory Addressing Mode Write_Command(d); // Default => 0x02 // 0x00 => Horizontal Addressing Mode // 0x01 => Vertical Addressing Mode // 0x02 => Page Addressing Mode }

void Set_Column_Address(unsigned char a, unsigned char b) { Write_Command(0x21); // Set Column Address Write_Command(a); // Default => 0x00 (Column Start Address) Write_Command(b); // Default => 0x7F (Column End Address) }

void Set_Page_Address(unsigned char a, unsigned char b) { Write_Command(0x22); // Set Page Address Write_Command(a); // Default => 0x00 (Page Start Address) Write_Command(b); // Default => 0x07 (Page End Address) }

void Set_Start_Line(unsigned char d) { Write_Command(0x40 | d); // Set Display Start Line // Default => 0x40 (0x00) }

void Set_Contrast_Control(unsigned char d) { Write_Command(0x81); // Set Contrast Control for Bank 0 Write_Command(d); // Default => 0x7F }

void Set_Segment_Remap(unsigned char d) { Write_Command(d); // Set Segment Re-Map // Default => 0xA0 // 0xA0 => Column Address 0 Mapped to SEG0 // 0xA1 => Column Address 0 Mapped to SEG127 }

void Set_Entire_Display(unsigned char d) { Write_Command(d); // Set Entire Display On / Off // Default => 0xA4 // 0xA4 => Normal Display // 0xA5 => Entire Display On }

void Set_Inverse_Display(unsigned char d) { Write_Command(d); // Set Inverse Display On/Off // Default => 0xA6 // 0xA6 => Normal Display // 0xA7 => Inverse Display On }

void Set_Multiplex_Ratio(unsigned char d) { Write_Command(0xA8); // Set Multiplex Ratio Write_Command(d); // Default => 0x3F (1/64 Duty) }

void Set_Display_On_Off(unsigned char d) { Write_Command(d); // Set Display On/Off // Default => 0xAE // 0xAE => Display Off // 0xAF => Display On }

void Set_Start_Page(unsigned char d) { Write_Command(0xB0 | d); // Set Page Start Address for Page Addressing Mode // Default => 0xB0 (0x00) }

void Set_Common_Remap(unsigned char d) { Write_Command(d); // Set COM Output Scan Direction // Default => 0xC0 // 0xC0 => Scan from COM0 to 63 // 0xC8 => Scan from COM63 to 0 }

void Set_Display_Offset(unsigned char d) { Write_Command(0xD3); // Set Display Offset Write_Command(d); // Default => 0x00 }

void Set_Display_Clock(unsigned char d) { Write_Command(0xD5); // Set Display Clock Divide Ratio / Oscillator Frequency Write_Command(d); // Default => 0x70 // D[3:0] => Display Clock Divider // D[7:4] => Oscillator Frequency }

void Set_Low_Power(unsigned char d) { Write_Command(0xD8); // Set Low Power Display Mode Write_Command(d); // Default => 0x04 (Normal Power Mode) }

void Set_Precharge_Period(unsigned char d) { Write_Command(0xD9); // Set Pre-Charge Period Write_Command(d); // Default => 0x22 (2 Display Clocks [Phase 2] / 2 Display Clocks [Phase 1]) // D[3:0] => Phase 1 Period in 1~15 Display Clocks // D[7:4] => Phase 2 Period in 1~15 Display Clocks }

void Set_Common_Config(unsigned char d) { Write_Command(0xDA); // Set COM Pins Hardware Configuration Write_Command(d); // Default => 0x12 // Alternative COM Pin Configuration // Disable COM Left/Right Re-Map }

void Set_VCOMH(unsigned char d) { Write_Command(0xDB); // Set VCOMH Deselect Level Write_Command(d); // Default => 0x34 (0.78*VCC) }

void Set_NOP() { Write_Command(0xE3); // Command for No Operation }

void Set_Command_Lock(unsigned char d) { Write_Command(0xFD); // Set Command Lock Write_Command(d); // Default => 0x12 // 0x12 => Driver IC interface is unlocked from entering command. // 0x16 => All Commands are locked except 0xFD. }

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Global Variables //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #define XLevelL 0x00 #define XLevelH 0x10 #define XLevel ((XLevelH & 0x0F) * 16 + XLevelL) #define Max_Column 128 #define Max_Row 64 #define Brightness 0xBF

#define SET_BIT(b, n) b |= (1 << n) #define CLR_BIT(b, n) b &= ~(uint8_t)(1 << n)

uint8_t g_oled_ram[8][128];

void oled_draw_point(uint8_t r, uint8_t c, uint8_t t) { if (t) { SET_BIT(g_oled_ram[r / 8][c], ((r % 8))); } else { CLR_BIT(g_oled_ram[r / 8][c], (r % 8)); } }

void oled_draw_frame(uint8_t p[Max_Row][Max_Column]) { unsigned char i, j;

for (i = 0; i < Max_Row; i++)
{
    for (j = 0; j < Max_Column; j++)
    {
        oled_draw_point(i, j, p[i][j]);
    }
}

}

void oled_reflesh() { unsigned char i, j; for (i = 0; i < 8; i++) { Set_Start_Page(i); Set_Start_Column(0x00);

for (j = 0; j < 128; j++)
    {
        Write_Data(g_oled_ram[i][j]);
    }
}

}

void Fill_RAM(unsigned char Data) { unsigned char i, j;

for (i = 0; i < 8; i++)
{
    Set_Start_Page(i);
    Set_Start_Column(0x00);
    for (j = 0; j < 128; j++)
    {
        Write_Data(Data);
    }
}

}

#include "font.h" #include "hz12.h" uint16_t x,y; /LCD 设置坐标***************/ void LCD_Set_Pos(unsigned char x, unsigned char y) { Write_Command(0xb0+y); Write_Command(((x&0xf0)>>4)|0x10); Write_Command((x&0x0f)|0x01); }

//显示一个5*7点阵的图符 //unsigned char X unsigned char Y //unsigned char fan Bit0=1 字符反相

void Display_5x7(char *str,unsigned char x,unsigned char y,unsigned char fan) { unsigned char i,dd; unsigned int neima; neima = (unsigned int)(str[0]-32)*5; if(x>126) { x=0; y++; } LCD_Set_Pos(x,y);

for(i=0;i<5;i++)
{
    dd=font5x7[i+neima];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}

}

//显示一个12*12点阵的图符 //unsigned char X unsigned char Y //unsigned char fan Bit0=1 字符反相

void Display_12x12(char *str,unsigned char x,unsigned char y,unsigned char fan) { unsigned char i; unsigned int dd; int j;

for(j=0;j<sizeof(GB_12)/sizeof(GB_12[0]);j++)   // 查找定位
{
    if((GB_12[j].Index[0] == str[0])&&(GB_12[j].Index[1]==str[1]))      
        break;
}
LCD_Set_Pos(x,y);
if(j>=sizeof(GB_12)/sizeof(GB_12[0]))
{
    Display_5x7('?',x,y,0);
    Display_5x7('?',x+8,y,0);
    return;
}
for (i=0;i<12;i++)
{
    dd=GB_12[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}
LCD_Set_Pos(x,y+1);
for (i=12;i<24;i++)
{
    dd=GB_12[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}

} //显示一个8*16点阵的图符 //unsigned char X unsigned char Y //unsigned char fan Bit0=1 字符反相

void Display_8x16(char *str,unsigned char x,unsigned char y,unsigned char fan) { unsigned char i,dd,j;

for(j=0;j<sizeof(ASC16)/sizeof(ASC16[0]);j++)   // 查找定位
{
    dd = ASC16[j].Index;
    if(dd == str[0])
    {
        break;
    }
}
LCD_Set_Pos(x,y);
for (i=0;i<8;i++)
{
    dd=ASC16[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}
LCD_Set_Pos(x,y+1);
for (i=8;i<16;i++)
{
    dd=ASC16[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}

}

//------------------------------------------------------ // 中文写入函数 // x方向 x+1屏幕下移动1点;y方向 y+1屏幕下移动8点 //unsigned int neima 为字符的内码 //unsigned char X unsigned char Y //unsigned char fan Bit7=1 5x7字符Bit7=0 8x16字符 Bit0=1 字符反相 //------------------------------------------------------

void Display_16x16(char *str,unsigned char x,unsigned char y,unsigned char fan) { unsigned char i,dd,j;

for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++)   // 查找定位
{
    if((GB_16[j].Index[0] == str[0])&&(GB_16[j].Index[1]==str[1]))  
        break;
}
LCD_Set_Pos(x,y);
if(j>=sizeof(GB_16)/sizeof(GB_16[0]))
{
    Display_5x7('?',x,y,0);
    Display_5x7('?',x+8,y,0);
    return;
}
for (i=0;i<16;i++)
{
    dd=GB_16[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}
LCD_Set_Pos(x,y+1);
for (i=16;i<32;i++)
{
    dd=GB_16[j].Msk[i];
    if (fan&0x01)
        dd = ~dd;
    Write_Data(dd);
}

}

//------------------------------------------------------ // 中文写入函数 // x方向 x+1屏幕下移动1点;y方向 y+1屏幕下移动8点 //unsigned char *str 显示的字符串 //unsigned char X unsigned char Y //unsigned char fan // Bit0=1 字符反相 // bit7, bit6 // 1 0 5x7字符 // 0 0 8x16字符 // 0 1 8x12字符 //------------------------------------------------------

void PutLcdStr(char *str,unsigned char fan) { while (*str) { if(fan & 0x80) { if(x>=128) //判读位置换行 { x -= 128; y += 1; }

Display_5x7(str, x,y,fan);      //5个字节
        x +=8;
    }
    else
    {
        if((*str)&0x80)             //为汉字
        {
            if(fan&0x40)
            {
                Display_12x12(str, x,y,fan);     //16个字节
                x += 12;
            }
            else
            {
                Display_16x16(str, x,y,fan);     //16个字节
                x += 16;
            }
            str++;
            str++;
        }
        else
        {
            if(x>=128)                     //判读位置换行
            {
               x -= 128;
               y += 2;
            }
            Display_8x16(str, x,y,fan);  //16个字节
            //                if(fan&0x40)
            //                AddrX += 6;
            //                else
            x += 8;
        }
    }
    str++;
}

}

/************************************************************************************** 功能描述: 在屏幕按格式显示一个字符串 输 入:

输 出: 无 **************************************************************************************/ void LcdPrintf(uint8_t fan,char *fmt,...) { va_list ap; volatile char str[64];

va_start(ap,fmt);
vsprintf(str,fmt,ap);
PutLcdStr(str,fan);
va_end(ap);

}

void LcdSet(uint16_t x0, uint16_t y0) { x=x0; y=y0; } void LcdGet(uint16_t * x0, uint16_t *y0) { *x0 = x; *y0 = y; }

/功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7******/ void Draw_BMP(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1,unsigned char BMP[]) { unsigned int j=0; unsigned char x,y;

if(y1%8==0)
    y=y1/8;
else
    y=y1/8+1;
for(y=y0;y<y1;y++)
{
    LCD_Set_Pos(x0,y);
    for(x=x0;x<x1;x++)
    {
        Write_Data(BMP[j++]);
    }
}

}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Initialization //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void OLED_Init() { Set_Command_Lock(0x12); // Unlock Driver IC (0x12/0x16) Set_Display_On_Off(0xAE); // Display Off (0xAE/0xAF) Set_Display_Clock(0xA0); // Set Clock as 116 Frames/Sec Set_Multiplex_Ratio(0x3F); // 1/64 Duty (0x0F~0x3F) Set_Display_Offset(0x00); // Shift Mapping RAM Counter (0x00~0x3F) Set_Start_Line(0x00); // Set Mapping RAM Display Start Line (0x00~0x3F) Set_Low_Power(0x04); // Set Normal Power Mode (0x04/0x05) Set_Addressing_Mode(0x02); // Set Page Addressing Mode (0x00/0x01/0x02) Set_Segment_Remap(0xA1); // Set SEG/Column Mapping (0xA0/0xA1) Set_Common_Remap(0xC8); // Set COM/Row Scan Direction (0xC0/0xC8) Set_Common_Config(0x12); // Set Alternative Configuration (0x02/0x12) Set_Contrast_Control(Brightness); // Set SEG Output Current Set_Precharge_Period(0x82); // Set Pre-Charge as 8 Clocks & Discharge as 2 Clocks Set_VCOMH(0x34); // Set VCOM Deselect Level Set_Entire_Display(0xA4); // Disable Entire Display On (0xA4/0xA5) Set_Inverse_Display(0xA6); // Disable Inverse Display On (0xA6/0xA7)

Fill_RAM(0x00); // Clear Screen
Set_Display_On_Off(0xAF); // Display On (0xAE/0xAF)

} /* Flush the content of the internal buffer the specific area on the display

  • You can use DMA or any hardware acceleration to do this operation in the background but
  • 'lv_disp_flush_ready()' has to be called when finished. */ static void oled_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_tcolor_p) { oled_draw_frame((uint8_t ()[Max_Column])color_p); oled_reflesh();/* IMPORTANT!!!
    • Inform the graphics library that you are ready with the flushing*/ lv_disp_flush_ready(disp_drv); }

static lv_disp_buf_t disp_buf1; static lv_color_t buf1[64 * 128]; static lv_color_t buf2[64 * 128]; //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // Main Program //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // #define CONFIG_OLED_TEST void oled_init() { lcd_pinmux_init(); lcd_gpio_init(); OLED_Init();

// lv_disp porting
/*Create a display buffer*/
lv_disp_buf_init(&disp_buf1, buf1, buf2, 64 * 128);
/*Create a display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.buffer = &disp_buf1;
disp_drv.flush_cb = oled_flush;
disp_drv.rotated = 0;
lv_disp_drv_register(&disp_drv);

}

//---------------------------------------------------------------------------- void Myoled_init() { lcd_pinmux_init(); lcd_gpio_init(); OLED_Init(); Fill_RAM(0); } //---------------------------------------------------------------------------- 字库就不补贴出来了, 可以找我索取 完整工程。

在此感谢官方工作人员的大力支持!

上一篇:RISC-V开发工具 | 使用CDS进行RISC-V硬件平台的开发和调试


下一篇:利用RVB2601开发板实现基于LVGL库中文显示