⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drv_lcdc.c

📁 最新版IAR FOR ARM(EWARM)5.11中的代码例子
💻 C
📖 第 1 页 / 共 5 页
字号:
/************************************************************************/
/*                                                                      */
/*    Copyright (C) 2006 Oki Electric Industry Co., LTD.                */
/*                                                                      */
/*    System Name    :  ML675050 series                                 */
/*    Module Name    :  ML675050 iccc driver program                    */
/*    File   Name    :  drv_iccc.c                                      */
/*    Date           :  2005/12/15 initial version                      */
/*                                                                      */
/************************************************************************/

#include "common.h"
#if defined(__arm)
#include "ml675050.h"
#else
#include "ml675050sim.h"
#endif
#include "hal_api.h"
#include "drv_common.h"
#include "drv_lcdc.h"


#define FTM_PORT1_SEL_MASK 0xffffefff
#define FTM_PORT1_SEL_SET  0x00001000
#define FTM_PORT2_SEL_MASK 0xffffaaaa
#define FTM_PORT2_SEL_SET  0x00005555

/******************************/
/*     Private defines        */
/******************************/
/*--------- variable ---------*/

/*--------- function ---------*/


/************************************************************************/
/*                                                                      */
/*  Function Name   : smpDrv_OpenLcdc                                   */
/*  Input           : hPixels Horizontal pixels.                        */
/*                    vPixels Vertical pixels.                          */
/*  Output          : DRV_OK(1)                                         */
/*                  : DRV_PARAM_ERROR(-2)                               */
/*                                                                      */
/*  Note : Open the driver of lcdc.                                     */
/*                                                                      */
/************************************************************************/
int16_t smpDrv_OpenLcdc(uint16_t hPixels, uint16_t vPixels) {
    int16_t rtnVal = DRV_OK;
    uPLAT_PioFunctionParam port_param;

    if (hPixels != 320) {
        return DRV_PARAM_ERROR;
    }
    
    if (vPixels != 240) {
        return DRV_PARAM_ERROR;
    }

    /* Get port function. */
    rtnVal = uplat7dHAL_PioGetFunction(&port_param);
    if (rtnVal != DRV_OK) {
        return rtnVal;
    }
    /* Set LCDC port Secondary function. */
    /* !!! Not set PORT1 PA5 for Secondary function. */
    port_param.port_sel1 = (port_param.port_sel1 & FTM_PORT1_SEL_MASK)
                           | FTM_PORT1_SEL_SET;
    port_param.port_sel2 = (port_param.port_sel2 & FTM_PORT2_SEL_MASK)
                           | FTM_PORT2_SEL_SET;
    rtnVal = uplat7dHAL_PioSetFunction(&port_param);
    if (rtnVal != DRV_OK) {
        return rtnVal;
    }

    /* !!! Set PA5 output mode. */
    rtnVal = uplat7dHAL_PioSetIo(PA, 0x20);
    
    /* !!! Output value of PA5 0. */
    if (rtnVal == DRV_OK) {
        rtnVal = uplat7dHAL_PioOutBitData(PA, BIT5, 0);
    }

    /* !!! Output value of PA5 1. */
    if (rtnVal == DRV_OK) {
        rtnVal = uplat7dHAL_PioOutBitData(PA, BIT5, 1);
    }

    /* Initailize LCDC HAL. */
    rtnVal = ml675050HAL_LcdcInit(hPixels, vPixels);

    return rtnVal;
}

/************************************************************************/
/*                                                                      */
/*  Function Name   : smpDrv_CloseLcdc                                  */
/*  Input           : void                                              */
/*  Output          : DRV_OK(1)                                         */
/*                                                                      */
/*  Note : Close the driver of lcdc.                                    */
/*                                                                      */
/************************************************************************/
int16_t smpDrv_CloseLcdc(void) {
    int16_t rtnVal = DRV_OK;

    return rtnVal;
}

/************************************************************************/
/*                                                                      */
/*  Function Name   : smpDrv_IoctlLcdc                                  */
/*  Input           : cmd The number of LCDC HAL-API.                   */
/*                    arg The argument of LCDC HAL-API.                 */
/*  Output          : DRV_OK(1)                                         */
/*                  : DRV_PARAM_ERROR(-2)                               */
/*                                                                      */
/*  Note : Control the hal of LCDC.                                     */
/*                                                                      */
/************************************************************************/
int16_t smpDrv_IoctlLcdc(uint16_t cmd, uint32_t arg) {
    int16_t rtnVal = DRV_OK;

    switch (cmd) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -