48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/**
|
|
* @file
|
|
* @author xxx
|
|
* @date 2023-08-29 14:28:04
|
|
* @brief LCD驱动
|
|
* @copyright Copyright (c) 2023 by xxx, All Rights Reserved.
|
|
*/
|
|
|
|
#include "lcds.h"
|
|
#include "lcd_st7525.h"
|
|
#include "lcd_sharp.h"
|
|
#include "lcd_154.h"
|
|
#include <string.h>
|
|
|
|
#define BACK_COLOR WHITE
|
|
// static uint8_t dotbuf[64]; // 字符点阵缓冲
|
|
|
|
void lcd_free(lcd_t *handle)
|
|
{
|
|
DBG_ASSERT(handle != NULL __DBG_LINE);
|
|
osel_mem_free(handle);
|
|
}
|
|
|
|
// LCD初始化
|
|
lcd_t *lcd_create(lcd_info_t info)
|
|
{
|
|
lcd_t *handle = (lcd_t *)osel_mem_alloc(sizeof(lcd_t));
|
|
DBG_ASSERT(handle != NULL __DBG_LINE);
|
|
osel_memcpy((uint8_t *)&handle->info, (uint8_t *)&info, sizeof(lcd_info_t));
|
|
handle->driver.idel = TRUE;
|
|
switch (info.type)
|
|
{
|
|
case LCD_ST7525:
|
|
// lcd_st7525_init(&handle->driver);
|
|
break;
|
|
case LCD_SHARP:
|
|
// lcd_sharp_init(&handle->driver);
|
|
break;
|
|
case LCD_154:
|
|
lcd_154_init(&handle->driver);
|
|
break;
|
|
default:
|
|
lcd_free(handle);
|
|
return NULL;
|
|
}
|
|
return handle;
|
|
}
|