• 大小: 5KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-15
  • 语言: 其他
  • 标签: 嵌入式  

资源简介

附件为ssd1306控制器的驱动oled,调试ok,有需求的可下载。

资源截图

代码片段和文件信息

#include “DalSsd1306.h“
#include “nrf_log.h“
#include “nrf_log_ctrl.h“



typedef struct
{
    OPERATE_HANDLE pvI2cHandle;
}TDalOledMgr;


TDalOledMgr g_tDalOledMgr = {NULL};

#define DAL_OLED_WRITE_CMD   0x00 //write cmd 
#define DAL_OLED_WRITE_DATA  0x40 // write data

#define OLED_INIT_TRANSFER_COUNT 1


#define DAL_OLED_RST_PIN_NUM (8)  // oled reset pin 
#define DAL_OLED_DIS_EN_PIN_NUM (2)


static uint8_t  g_u8OledCtrl[] = {DAL_OLED_WRITE_CMDDAL_OLED_WRITE_DATA};

app_twi_transfer_t const g_u8OledWriteCmd = {
    .p_data = &g_u8OledCtrl[0]
    .length = 1
    .operation = (DAL_OLED_SLAVE_ADDR << 1) | 0
    .flags = 0

};
    
app_twi_transfer_t const g_u8OledWriteData = {
    .p_data = &g_u8OledCtrl[1]
    .length = 1
    .operation = (DAL_OLED_SLAVE_ADDR << 1) | 1
    .flags = 0  
};


// oled init buffer
#ifdef USE_64_X_32_OLED
static uint8_t  g_u8OledInitBuffer1[] = {0xAE0x000x120x000XB00x810xFF0xA10xA60xA8 };
static uint8_t  g_u8OledInitBuffer2[] = {0x1F0xC80xD30x000xD50x800xD90x1F0xDA0x12};
static uint8_t  g_u8OledInitBuffer3[] = {0xDB0X400x8D0x140xAF };
#else
static uint8_t  g_u8OledInitBuffer1[] = {0xAE0xD50xF00xA80X270xD30x000x400x8D0x10 };
static uint8_t  g_u8OledInitBuffer2[] = {0x200x020xA10xC80xDA0x120xAD0x300x810xFF};
static uint8_t  g_u8OledInitBuffer3[] = {0xD90X220xDB0x200xA40xA60x0C0x110xAF};
//static uint8_t  g_u8OledInitBuffer1[] = {0xAE0x000x100x400XB00x810x2F0xA10xA6};
//static uint8_t  g_u8OledInitBuffer2[] = {0xA80x270xC80xD30x000xD50xF00xD80x050xD90x22};
//static uint8_t  g_u8OledInitBuffer3[] = {0xDA0x120xDB0x200x8D0x100xAF };


#endif

app_twi_transfer_t const g_u8OledInit1 =
{
    .p_data = &g_u8OledInitBuffer1[0]
    .length = sizeof(g_u8OledInitBuffer1)
    .operation = (DAL_OLED_SLAVE_ADDR << 1) | 0
    .flags = 0

};
app_twi_transfer_t const g_u8OledInit2 =
{
    .p_data = &g_u8OledInitBuffer2[0]
    .length = sizeof(g_u8OledInitBuffer2)
    .operation = (DAL_OLED_SLAVE_ADDR << 1) | 0
    .flags = 0

};
app_twi_transfer_t const g_u8OledInit3 =
{
    .p_data = &g_u8OledInitBuffer3[0]
    .length = sizeof(g_u8OledInitBuffer3)
    .operation = (DAL_OLED_SLAVE_ADDR << 1) | 0
    .flags = 0

};

//uint8_t g_u8OledGram[DAL_OLED_COLUM][DAL_OLED_PAGE];


static uint32_t u32DalOledInit(void);
static EErrorCodeInf eDalOledOpen(void* pvArgs pvDevIntCallBackFun pfOledIntCb);
static void vDalOledTransBufferCreat(app_twi_transfer_t * ptDataStructuint8_t u8RdOrWrite uint8_t * pu8Datauint32_t u32DataLen);
//static void vDalOledGramRefresh(void) ;
static void vDalOledClearScreen(void);
static uint32_t u32DalOledWriteCmd(uint8_t* u8CmdBufferuint32_t u32CmdLen);
static EErrorCodeInf eDalOledCtrl(EDevCmd eCmd void* pvArg);
static void vDalOledAllOn(void);

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

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      26508  2018-07-19 13:57  SSD1306驱动Oled\DalSsd1306.c

     文件        992  2018-06-27 11:26  SSD1306驱动Oled\DalSsd1306.h

     目录          0  2018-07-27 13:29  SSD1306驱动Oled

----------- ---------  ---------- -----  ----

                27500                    3


评论

共有 条评论