亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lcd.c

?? Atmel的AT91SAM9263-EK的TFT驅動的源程序
?? C
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support  -  ROUSSET  -
 * ----------------------------------------------------------------------------
 * Copyright (c) 2006, Atmel Corporation

 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaiimer below.
 * 
 * - Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the disclaimer below in the documentation and/or
 * other materials provided with the distribution. 
 * 
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission. 
 * 
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
//         Headers
//------------------------------------------------------------------------------

#include "lcd.h"
#include <board.h>
#include <utility/assert.h>

//------------------------------------------------------------------------------
//         Exported functions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// Enables the LCD controller, after waiting for the specified number of
/// frames.
/// \param frames  Number of frames before the LCD is enabled.
//------------------------------------------------------------------------------
void LCD_Enable(unsigned int frames)
{
    ASSERT((frames & 0xFFFFFF80) == 0,
           "LCD_Enable: Wrong frames value.\n\r");
    AT91C_BASE_LCDC->LCDC_PWRCON = AT91C_LCDC_PWR | (frames << 1);
}

//------------------------------------------------------------------------------
/// Disables the LCD controller, after waiting for the specified number of
/// frames.
/// \param frames  Number of frames before the LCD is shut down.
//------------------------------------------------------------------------------
void LCD_Disable(unsigned int frames)
{
    ASSERT((frames & 0xFFFFFF80) == 0,
           "LCD_Disable: Wrong frames value.\n\r");
    AT91C_BASE_LCDC->LCDC_PWRCON = frames << 1;
}

//------------------------------------------------------------------------------
/// Enables the DMA of the LCD controller.
//------------------------------------------------------------------------------
void LCD_EnableDma()
{
    AT91C_BASE_LCDC->LCDC_DMACON = AT91C_LCDC_DMAEN;
}

//------------------------------------------------------------------------------
/// Disables the DMA of the LCD controller.
//------------------------------------------------------------------------------
void LCD_DisableDma()
{
    AT91C_BASE_LCDC->LCDC_DMACON = 0;
}

//------------------------------------------------------------------------------
/// Configures the internal clock of the LCD controller given the master clock of
/// the system and the desired pixel clock in MHz.
/// \param masterClock  Master clock frequency.
/// \param pixelClock  Pixel clock frequency.
//------------------------------------------------------------------------------
void LCD_SetPixelClock(unsigned int masterClock, unsigned int pixelClock)
{
    AT91C_BASE_LCDC->LCDC_LCDCON1 = ((masterClock / (2 * pixelClock)) - 1) << 12;
}

//------------------------------------------------------------------------------
/// Sets the type of display used with the LCD controller.
/// \param displayType  Type of display used.
//------------------------------------------------------------------------------
void LCD_SetDisplayType(unsigned int displayType)
{
    unsigned int value;

    ASSERT((displayType & ~AT91C_LCDC_DISTYPE) == 0,
           "LCD_SetDisplayType: Wrong display type value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= ~AT91C_LCDC_DISTYPE;
    value |= displayType;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the scan mode used by the LCD (either single scan or double-scan).
/// \param scanMode  Scan mode to use.
//------------------------------------------------------------------------------
void LCD_SetScanMode(unsigned int scanMode)
{
    unsigned int value;

    ASSERT((scanMode & ~AT91C_LCDC_SCANMOD) == 0,
           "LCD_SetScanMode: Wrong scan mode value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= ~AT91C_LCDC_SCANMOD;
    value |= scanMode;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the number of bits per pixel used by the LCD display.
/// \param bitsPerPixel  Number of bits per pixel to use.
//------------------------------------------------------------------------------
void LCD_SetBitsPerPixel(unsigned int bitsPerPixel)
{
    unsigned int value;

    ASSERT((bitsPerPixel & ~AT91C_LCDC_PIXELSIZE) == 0,
           "LCD_SetScanMode: Wrong bitsPerPixel value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= ~AT91C_LCDC_PIXELSIZE;
    value |= bitsPerPixel;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the LCDD, LCDVSYNC, LCDHSYNC, LCDDOTCLK and LCDDEN signal polarities.
/// \param lcdd  LCDD signal polarity.
/// \param lcdvsync  LCDVSYNC signal polarity.
/// \param lcdhsync  LCDHSYNC signal polarity.
/// \param lcddotclk  LCDDOTCLK signal polarity.
/// \param lcdden  LCDDEN signal polarity.
//------------------------------------------------------------------------------
void LCD_SetPolarities(
    unsigned int lcdd,
    unsigned int lcdvsync,
    unsigned int lcdhsync,
    unsigned int lcddotclk,
    unsigned int lcdden)
{
    unsigned int value;

    ASSERT((lcdd & ~AT91C_LCDC_INVVD) == 0,
           "LCD_SetPolarities: Wrong lcdd value.\n\r");
    ASSERT((lcdvsync & ~AT91C_LCDC_INVFRAME) == 0,
           "LCD_SetPolarities: Wrong lcdvsync value.\n\r");
    ASSERT((lcdhsync & ~AT91C_LCDC_INVLINE) == 0,
           "LCD_SetPolarities: Wrong lcdhsync value.\n\r");
    ASSERT((lcddotclk & ~AT91C_LCDC_INVCLK) == 0,
           "LCD_SetPolarities: Wrong lcddotclk value.\n\r");
    ASSERT((lcdden & ~AT91C_LCDC_INVDVAL) == 0,
           "LCD_SetPolarities: Wrong lcdden value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= 0xFFFFE0FF;
    value |= lcdd | lcdvsync | lcdhsync | lcddotclk | lcdden;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the LCD clock mode, i.e. always active or active only during display
/// period.
/// \param clockMode  Clock mode to use.
//------------------------------------------------------------------------------
void LCD_SetClockMode(unsigned int clockMode)
{
    unsigned int value;

    ASSERT((clockMode & ~AT91C_LCDC_CLKMOD) == 0,
           "LCD_SetScanMode: Wrong scan mode value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= ~AT91C_LCDC_CLKMOD;
    value |= clockMode;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the format of the frame buffer memory.
/// \param format  Memory ordering format.
//------------------------------------------------------------------------------
void LCD_SetMemoryFormat(unsigned int format)
{
    unsigned int value;

    ASSERT((format & ~AT91C_LCDC_MEMOR) == 0,
           "LCD_SetMemoryFormat: Wrong memory format value.\n\r");

    value = AT91C_BASE_LCDC->LCDC_LCDCON2;
    value &= ~AT91C_LCDC_MEMOR;
    value |= format;
    AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
}

//------------------------------------------------------------------------------
/// Sets the size in pixel of the LCD display.
/// \param width  Width in pixel of the LCD display.
/// \param height  Height in pixel of the LCD display.
//------------------------------------------------------------------------------
void LCD_SetSize(unsigned int width, unsigned int height)
{
    ASSERT(((width - 1) & 0xFFFFF800) == 0,
           "LCD_SetSize: Wrong width value.\n\r");
    ASSERT(((height - 1) & 0xFFFFF800) == 0,
           "LCD_SetSize: Wrong height value.\n\r");

    AT91C_BASE_LCDC->LCDC_LCDFRCFG = ((width - 1) << 21) | (height - 1);
}

//------------------------------------------------------------------------------
/// Sets the vertical timings of the LCD controller. Only meaningful when
/// using a TFT display.
/// \param vfp  Number of idle lines at the end of a frame.
/// \param vbp  Number of idle lines at the beginning of a frame.
/// \param vpw  Vertical synchronization pulse width in number of lines.
/// \param vhdly  Delay between LCDVSYNC edge and LCDHSYNC rising edge, in
///               LCDDOTCLK cycles.
//------------------------------------------------------------------------------
void LCD_SetVerticalTimings(
    unsigned int vfp,
    unsigned int vbp,
    unsigned int vpw,
    unsigned int vhdly)
{
    ASSERT((vfp & 0xFFFFFF00) == 0,
           "LCD_SetVerticalTimings: Wrong vfp value.\n\r");
    ASSERT((vbp & 0xFFFFFF00) == 0,
           "LCD_SetVerticalTimings: Wrong vbp value.\n\r");
    ASSERT(((vpw-1) & 0xFFFFFFC0) == 0,
           "LCD_SetVerticalTimings: Wrong vpw value.\n\r");
    ASSERT(((vhdly-1) & 0xFFFFFFF0) == 0,
           "LCD_SetVerticalTimings: Wrong vhdly value.\n\r");

    AT91C_BASE_LCDC->LCDC_TIM1 = vfp
                                 | (vbp << 8)
                                 | ((vpw-1) << 16)
                                 | ((vhdly-1) << 24);
}

//------------------------------------------------------------------------------
/// Sets the horizontal timings of the LCD controller. Meaningful for both
/// STN and TFT displays.
/// \param hbp  Number of idle LCDDOTCLK cycles at the beginning of a line.
/// \param hpw  Width of the LCDHSYNC pulse, in LCDDOTCLK cycles.
/// \param hfp  Number of idel LCDDOTCLK cycles at the end of a line.
//------------------------------------------------------------------------------
void LCD_SetHorizontalTimings(
    unsigned int hbp,
    unsigned int hpw,
    unsigned int hfp)
{
    ASSERT(((hbp-1) & 0xFFFFFF00) == 0,
           "LCD_SetHorizontalTimings: Wrong hbp value.\n\r");
    ASSERT(((hpw-1) & 0xFFFFFFC0) == 0,
           "LCD_SetHorizontalTimings: Wrong hpw value.\n\r");
    ASSERT(((hfp-1) & 0xFFFFFF00) == 0,
           "LCD_SetHorizontalTimings: Wrong hfp value.\n\r");

    AT91C_BASE_LCDC->LCDC_TIM2 = (hbp-1) | ((hpw-1) << 8) | ((hfp-1) << 24);
}

//------------------------------------------------------------------------------
/// Sets the address of the frame buffer in the LCD controller DMA. When using
/// dual-scan mode, this is the upper frame buffer.
/// \param address  Frame buffer address.
//------------------------------------------------------------------------------
void LCD_SetFrameBufferAddress(void *address)
{
    AT91C_BASE_LCDC->LCDC_BA1 = (unsigned int) address;
}

//------------------------------------------------------------------------------
/// Sets the size in pixels of a frame (height * width * bpp).
/// \param frameSize  Size of frame in pixels.
//------------------------------------------------------------------------------
void LCD_SetFrameSize(unsigned int frameSize)
{
    ASSERT((frameSize & 0xFF800000) == 0,
           "LCD_SetFrameSize: Wrong frameSize value.\n\r");

    AT91C_BASE_LCDC->LCDC_FRMCFG = frameSize | (AT91C_BASE_LCDC->LCDC_FRMCFG & 0xFF000000);
}

//------------------------------------------------------------------------------
/// Sets the DMA controller burst length.
/// \param burstLength  Desired burst length.
//------------------------------------------------------------------------------
void LCD_SetBurstLength(unsigned int burstLength)
{
    ASSERT(((burstLength-1) & 0xFFFFFF80) == 0,
           "LCD_SetBurstLength: Wrong burstLength value.\n\r");

    AT91C_BASE_LCDC->LCDC_FRMCFG &= 0x00FFFFFF;
    AT91C_BASE_LCDC->LCDC_FRMCFG |= ((burstLength-1) << 24);

    AT91C_BASE_LCDC->LCDC_FIFO = 2048 - (2 * burstLength + 3);
}

//------------------------------------------------------------------------------
/// Sets the prescaler value of the contrast control PWM.
/// \param prescaler  Desired prescaler value.
//------------------------------------------------------------------------------
void LCD_SetContrastPrescaler(unsigned int prescaler)
{
    ASSERT((prescaler & ~AT91C_LCDC_PS) == 0,
           "LCD_SetContrastPrescaler: Wrong prescaler value\n\r");

    AT91C_BASE_LCDC->LCDC_CTRSTCON &= ~AT91C_LCDC_PS;
    AT91C_BASE_LCDC->LCDC_CTRSTCON |= prescaler;
}

//------------------------------------------------------------------------------
/// Sets the polarity of the contrast PWM.
/// \param polarity  PWM polarity
//------------------------------------------------------------------------------
void LCD_SetContrastPolarity(unsigned int polarity)
{
    ASSERT((polarity & ~AT91C_LCDC_POL) == 0,
           "LCD_SetContrastPolarity: Wrong polarity value\n\r");

    AT91C_BASE_LCDC->LCDC_CTRSTCON &= ~AT91C_LCDC_POL;
    AT91C_BASE_LCDC->LCDC_CTRSTCON |= polarity;
}

//------------------------------------------------------------------------------
/// Sets the threshold value of the constrast PWM.
/// \param value  PWM threshold value.
//------------------------------------------------------------------------------
void LCD_SetContrastValue(unsigned int value)
{
    ASSERT((value & ~AT91C_LCDC_CVAL) == 0,
           "LCD_SetContrastValue: Wrong value.\n\r");

    AT91C_BASE_LCDC->LCDC_CTRSTVAL = value;
}

//------------------------------------------------------------------------------
/// Enables the contrast PWM generator.
//------------------------------------------------------------------------------
void LCD_EnableContrast()
{
    AT91C_BASE_LCDC->LCDC_CTRSTCON |= AT91C_LCDC_ENA_PWMGEMENABLED;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人h动漫精品| 久久精品视频一区| 久久免费偷拍视频| 亚洲影视在线播放| 国产成人av电影在线| 3atv一区二区三区| 亚洲精品视频在线| 成人激情小说网站| 国产片一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 99久久国产综合精品色伊| 欧美精品一区二区三区蜜桃| 亚洲午夜影视影院在线观看| 成人激情免费电影网址| 精品国产欧美一区二区| 免费欧美在线视频| 欧美日高清视频| 香蕉加勒比综合久久| 欧美三级中文字幕| 亚洲一区二区三区三| 色94色欧美sute亚洲13| 亚洲色图色小说| 99久久夜色精品国产网站| 亚洲视频网在线直播| 韩国欧美国产一区| 日韩免费在线观看| 免费看日韩精品| 欧美一级久久久| 日韩不卡一区二区三区| 欧美一区二区三区四区在线观看 | 亚洲超丰满肉感bbw| 欧美专区亚洲专区| 亚洲成人动漫在线观看| 欧美日韩一区二区在线观看视频 | 色综合中文字幕国产| 亚洲欧洲一区二区三区| 色综合天天狠狠| 樱桃国产成人精品视频| 欧美亚洲一区二区在线观看| 亚洲国产美女搞黄色| 欧美久久久久久久久久 | 亚洲图片你懂的| 91蜜桃传媒精品久久久一区二区| 亚洲欧美一区二区不卡| 91国偷自产一区二区使用方法| 有码一区二区三区| 欧美精品久久天天躁| 久久激情五月激情| 中文久久乱码一区二区| 色美美综合视频| 奇米色777欧美一区二区| 欧美精品一区二区三区蜜臀| 成人午夜精品在线| 亚洲小说欧美激情另类| 精品国产乱子伦一区| 99精品视频在线免费观看| 一区二区三区精品在线观看| 日韩欧美一区二区视频| 成人小视频在线观看| 一区二区三区久久久| 欧美精品一区二区三区很污很色的| 风流少妇一区二区| 亚洲成人免费在线| 久久九九99视频| 在线欧美日韩国产| 国产一区二区伦理| 亚洲一区影音先锋| 欧美mv日韩mv| 色婷婷亚洲精品| 国内精品免费在线观看| 一区二区三区高清在线| 久久综合久久鬼色| 欧美丝袜丝nylons| aaa欧美日韩| 麻豆91在线观看| 亚洲综合区在线| 国产日韩av一区二区| 欧美日韩一区二区三区免费看| 精品写真视频在线观看| 中文字幕一区在线观看| 精品久久免费看| 欧美日韩一区二区三区在线看| 国产成人免费视频一区| 日韩在线一区二区| 18欧美亚洲精品| 精品国产乱码久久久久久久| 欧美日韩国产首页在线观看| 成人免费视频一区| 国产原创一区二区三区| 日本不卡在线视频| 亚洲一区二区高清| 亚洲欧美韩国综合色| 国产欧美精品国产国产专区 | 91福利在线免费观看| 国产精品自在在线| 免费成人av资源网| 午夜私人影院久久久久| 亚洲免费大片在线观看| 国产精品视频在线看| 亚洲精品一区二区精华| 日韩女优视频免费观看| 欧美一级日韩一级| 欧美麻豆精品久久久久久| 在线亚洲一区观看| 在线国产亚洲欧美| 色综合久久久久综合体| 99re这里都是精品| 成人av高清在线| 97久久精品人人做人人爽| 不卡影院免费观看| av在线一区二区| 96av麻豆蜜桃一区二区| 91浏览器打开| 在线免费观看一区| 欧美三级电影网| 欧美精品日韩一本| 3atv在线一区二区三区| 欧美一区二区成人| 欧美大胆人体bbbb| 久久久久88色偷偷免费| 国产亚洲欧美日韩在线一区| 国产视频911| 国产欧美日产一区| 亚洲视频一区二区在线| 樱花影视一区二区| 青青草国产成人99久久| 精品在线一区二区三区| 风间由美一区二区av101 | 欧美日韩www| 日韩免费视频一区二区| 久久精品欧美一区二区三区麻豆| 久久精品亚洲精品国产欧美 | 91丝袜高跟美女视频| 91国内精品野花午夜精品| 69堂成人精品免费视频| 精品日韩99亚洲| 国产精品久久精品日日| 一片黄亚洲嫩模| 久久精品国产第一区二区三区| 国产精品综合一区二区三区| 91无套直看片红桃| 91精品免费在线| 中文字幕精品综合| 午夜视频在线观看一区二区三区| 黄色小说综合网站| 色先锋资源久久综合| 日韩欧美一区二区不卡| 亚洲欧洲日产国码二区| 欧美aaa在线| 99国产一区二区三精品乱码| 欧美久久久久中文字幕| 国产精品久久久久久久久免费桃花| 亚洲一区欧美一区| 国产剧情一区在线| 欧美日韩日本视频| 国产欧美视频一区二区三区| 亚洲国产成人精品视频| 高清av一区二区| 欧美大片国产精品| 亚洲精品成a人| 国产成人精品三级| 91精品国产综合久久精品| 亚洲人午夜精品天堂一二香蕉| 免费一级片91| 欧美日韩一区二区三区不卡| 国产女人18毛片水真多成人如厕| 亚洲成在人线免费| 99久久99久久精品免费观看| 2024国产精品| 蜜桃91丨九色丨蝌蚪91桃色| 色一区在线观看| 国产精品丝袜久久久久久app| 男女性色大片免费观看一区二区| 91在线观看高清| 国产精品乱人伦一区二区| 久久精品国产亚洲5555| 欧美撒尿777hd撒尿| 亚洲美女屁股眼交3| 国产91精品一区二区麻豆网站 | 91黄色小视频| 国产精品久久久久9999吃药| 精品影院一区二区久久久| 777午夜精品免费视频| 亚洲一区日韩精品中文字幕| 色香蕉成人二区免费| 亚洲日本va在线观看| 成人免费福利片| 国产色产综合产在线视频| 麻豆精品一区二区| 日韩色在线观看| 青青国产91久久久久久| 欧美理论电影在线| 亚洲成在人线免费| 欧美日韩亚洲综合| 亚洲午夜精品网| 欧美精品18+| 蜜臀av性久久久久蜜臀aⅴ| 欧美一区二区精品在线| 久久精品理论片| 久久夜色精品一区|