📄 ssd1332.c
字号:
/******************************************************************************
** File Name: ssd1332.c *
** Author: Nick.Zhao *
** DATE: 12/13/2004 *
** Copyright: 2004 Spreatrum, Incoporated. All Rights Reserved. *
** Description: *
** This file contains driver for OLED ssd1332. *
******************************************************************************
******************************************************************************
** Edit History *
** ------------------------------------------------------------------------- *
** DATE NAME DESCRIPTION *
** 12/13/2004 Nick.Zhao Create. *
******************************************************************************/
#include "sci_types.h"
#include "lcd.h"
#include "ssd1332.h"
#include "string.h"
/**---------------------------------------------------------------------------*
** Compiler Flag
**---------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/**---------------------------------------------------------------------------*
** External variable
**---------------------------------------------------------------------------*/
// Following Defined in lcd_cfg.c
extern void *LCD_GetSubLCDBuffer(void);
#ifndef _USE_MTK
extern uint32 oled_command_adr; //address of command for main lcd.
extern uint32 oled_data_adr; //address of data for main lcd.
#endif
/**---------------------------------------------------------------------------*
** Macro Define
**---------------------------------------------------------------------------*/
#define SSD1332_WIDTH 96
#define SSD1332_HEIGHT 64
/**---------------------------------------------------------------------------*
** Function Definitions
**---------------------------------------------------------------------------*/
/*********************************************************************/
// Description: Initialize color LCD : ssd1332
// Input:
// None.
// Return:
// None.
// Note:
/*********************************************************************/
LOCAL ERR_LCD_E SSD1332_Init(void)
{
return ERR_LCD_NONE;
}
/******************************************************************************/
// Description: invalidate a rectang of in LCD
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E SSD1332_InvalidateRect(
uint16 left, //left of the rectangle
uint16 top, //top of the rectangle
uint16 right, //right of the rectangle
uint16 bottom //bottom of the rectangle
)
{
return ERR_LCD_NONE;
}
/******************************************************************************/
// Description: invalidate the whole lcd.
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E SSD1332_Invalidate(void)
{
return ERR_LCD_NONE;
}
/******************************************************************************/
// Description: Enter/Exit sleep mode .
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E SSD1332_EnterSleep(
BOOLEAN is_sleep //SCI_TRUE: exter sleep mode
//SCI_FALSE:exit sleep mode.
)
{
return ERR_LCD_NONE;
}
/******************************************************************************/
// Description: set the contrast value
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E SSD1332_SetContrast(
uint16 contrast //contrast value to set
)
{
return ERR_LCD_NONE;
}
/******************************************************************************/
// Description: Close the lcd.(include sub lcd.)
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL void SSD1332_Close(void)
{
}
/******************************************************************************/
// Description: Clear color LCD with one color
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL void SSD1332_Clear(
uint32 color //color to fill the whole lcd.
)
{
}
/*****************************************************************************/
// Description: Set the brightness of LCD.
// Global resource dependence:
// Author: Jim.zhang
// Note:
/*****************************************************************************/
LOCAL ERR_LCD_E SSD1332_SetBrightness(
uint16 brightness //birghtness to set
)
{
return ERR_LCD_FUNC_NOT_SUPPORT;
}
/*****************************************************************************/
// Description: Get the lcd base information..
// Global resource dependence:
// Author: Jim.zhang
// Note:
/*****************************************************************************/
LOCAL ERR_LCD_E SSD1332_GetInfo(
LCD_INFO_T *lcd_info_ptr //lcd information struct pointer
)
{
if ( PNULL == lcd_info_ptr )
{
return ERR_LCD_POINTER_NULL;
}
lcd_info_ptr->r_bitmask = 0xf800;
lcd_info_ptr->g_bitmask = 0x07e0;
lcd_info_ptr->b_bitmask = 0x001f;
lcd_info_ptr->bits_per_pixel = 16;
lcd_info_ptr->contrast_min = 0x00;
lcd_info_ptr->contrast_max = 15;
lcd_info_ptr->contrast_defaut =0x06;
lcd_info_ptr->lcd_width = SSD1332_WIDTH;
lcd_info_ptr->lcd_height = SSD1332_HEIGHT;
lcd_info_ptr->lcdbuff_ptr = (void *)LCD_GetSubLCDBuffer();
return ERR_LCD_NONE;
}
/*****************************************************************************/
// Description: Enable lcd to partial display mode, so can save power.
// Global resource dependence:
// Author: Jim.zhang
// Return: SCI_TRUE:SUCCESS ,SCI_FALSE:failed.
// Note: If all input parameters are 0, exit partial display mode.
/*****************************************************************************/
LOCAL ERR_LCD_E SSD1332_SetDisplayWindow(
uint16 left, //left of the window
uint16 top, //top of the window
uint16 right, //right of the window
uint16 bottom //bottom of the window
)
{
return ERR_LCD_FUNC_NOT_SUPPORT;
}
//@Zhemin.Lin, CR9122, begin
LOCAL LCD_SPEC_T g_SSD1332_spec =
{
0, //uint8 rgb_sequence; /*rgb sequence*/
/*0: R-G-B, 1: B-G-R*/
15, //uint8 min_cycle_read; /*read cycle: ns*/
15, //uint8 min_cycle_write; /*write cycle: ns*/
1, //uint8 cyclenum_sendaddr; /*operation cycle to send address*/
/* 0: once, 1:twice*/
0, //uint8 cyclenum_senddata; /*operation cycle to send data */
/* 0; once, 1:twice*/
1, //uint8 cmd_num_setupwin; /*command number to settint up widnow space*/
/*0: 4 commands for setting up window space: x-start, x-end, y-start, y-end*/
/*1: 2 commands for setting up window space: x-address, y-address*/
/*2: 1 commanns for setting up window space window address*/
/*3: no commands for setting up window space*/
1, //uint8 method_send_cmdaddr;/*how to send command & address*/
/*0: sending together, 1:sending separately*/
1, //uint8 ads_is_high; /*status of ADS when sending parameter*/
/*0: low, 1: high*/
2, //uint8 sequence_cmdaddr; /*the sequence of command & address, if not send command & address together as 16 bits*/
/*0: write 2 window area on a 16bit bus, Hitachi*/
/*1, write 1 sindow area with one command, Casio*/
/*2, write 1 command and 2 parameters separately, Samsung*/
/*3, reserved*/
/*4, write 1 command, 2 parameters for page, 4 parameters for column, Epson*/
/*5, write 1 command, 4 parameters for page, 2 parameters for column*/
/*6, write 1 command, write 4 parameters for each page/column*/
6, //uint8 cyclenum_setupwin; /*operation cycle to set up window*/
0, //uint8 method_gram_access; /*select method to begin actul data read/write address for selected window area in GRAM*/
/*0: without any assigning x/y address, use initial start address of window*/
/*1: assign 1 x/y set command and parameter onto 16bit bus at onece*/
/*2: use separate for X and Y, with upper byte consists of command and lower byte for parameter*/
/*3, 1 command for selecting X/Y adn 2 parameters, us command and parameter separately*/
/*4, set different command for x and y, and command and parameter differs*/
1, //uint8 sequence_gram_access;/*read/write command and sequence for GRAM*/
/*0: perform read/write without seperate read/write command but by strobe 'high' ADS(RS)pin, samsung*/
/*1: data cycle comes right afer read/write command, Toshiba/Matsushita/Hitachi/NEC*/
/*2: after read/write command follows start address parameter for X and Y and follows data cycle, Casio*/
/*3: similiar to 2 but sends X and Y parameters together on 16 bit BUS*/
0, //uint8 order_xy; /*order of x and y address, I think, this field is active when sequence_gram_access = 2*/
/*0: X first*/
/*1: Y first*/
1, //uint8 is_dummy_read; /*deciding first read data when reading GRAM*/
/*0: acknowledge first data as valid data*/
/*1: acknowledge first data as dummy data*/
1, //uint8 cyclenum_read; /*total cycle numbers needed to access GRAM read/write*/
0x15, //uint8 win_setstartx_cmd; /*window x start address set command*/
0x00, //uint8 win_setendx_cmd; /*window x end address set command*/
0x75, //uint8 win_setstarty_cmd; /*window y start address set command*/
0x00, //uint8 win_setendy_cmd; /*window y end address set command*/
0x00, //uint8 gram_setx_cmd; /*gram x address set command*/
0x00, //uint8 gram_sety_cmd; /*gram y address set command*/
0x5d, //uint8 gram_read_cmd; /*gram read command*/
0x5c, //uint8 gram_write_cmd; /*gram write command*/
//@zhemin.lin, add 1 line, CR9590
0x08 //uint8 line_offset; /*line offset for display on lcd*/
};
/******************************************************************************/
// Description: get the important parameter for digital camera
// Global resource dependence:
// Author: Zhemin.lin
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E SSD1332_GetMainLcdSpec(
LCD_SPEC_T *spec_ptr //spec struct pointer
)
{
return ERR_LCD_NONE;
}
//Function pointer.
LOCAL LCD_OPERATIONS_T SSD1332_operations =
{
SSD1332_Init,
SSD1332_EnterSleep,
SSD1332_SetContrast,
SSD1332_SetBrightness,
SSD1332_SetDisplayWindow,
SSD1332_GetInfo,
SSD1332_InvalidateRect,
SSD1332_Invalidate,
SSD1332_Clear,
SSD1332_Close,
SSD1332_GetMainLcdSpec
};
/******************************************************************************/
// Description: return the SSD1332 lcd driver funtion pointer
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
PUBLIC LCD_OPERATIONS_T* SSD1332_GetOperations()
{
return &SSD1332_operations;
}
/******************************************************************************/
// Description: find weather the SSD1332 lcd driver is used
// Global resource dependence:
// Author: Nick.Zhao
// Note:
/******************************************************************************/
PUBLIC BOOLEAN SSD1332_Probe(void)
{
return SCI_TRUE;
}
/**---------------------------------------------------------------------------*
** Compiler Flag *
**---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
/* end of cstn_SSD1332.c*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -