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

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

?? kitronix320x240x16_ssd2119_8bit.c

?? 基于TI公司Cortex-M3的uart超級通信開發
?? C
?? 第 1 頁 / 共 3 頁
字號:
//*****************************************************************************
//
// kitronix320x240x16_ssd2119_8bit.c - Display driver for the Kitronix
//                                     K350QVG-V1-F TFT display with an SSD2119
//                                     controller.  This version assumes an
//                                     8080-8bit interface between the micro
//                                     and display (PS3-0 = 0011b).
//
// This is part of revision 5228 of the DK-LM3S9B92.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup display_api
//! @{
//
//*****************************************************************************

#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/epi.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "grlib/grlib.h"
#include "drivers/kitronix320x240x16_ssd2119_8bit.h"
#include "drivers/set_pinout.h"

//*****************************************************************************
//
// This driver operates in four different screen orientations.  They are:
//
// * Portrait - The screen is taller than it is wide, and the flex connector is
//              on the left of the display.  This is selected by defining
//              PORTRAIT.
//
// * Landscape - The screen is wider than it is tall, and the flex connector is
//               on the bottom of the display.  This is selected by defining
//               LANDSCAPE.
//
// * Portrait flip - The screen is taller than it is wide, and the flex
//                   connector is on the right of the display.  This is
//                   selected by defining PORTRAIT_FLIP.
//
// * Landscape flip - The screen is wider than it is tall, and the flex
//                    connector is on the top of the display.  This is
//                    selected by defining LANDSCAPE_FLIP.
//
// These can also be imagined in terms of screen rotation; if portrait mode is
// 0 degrees of screen rotation, landscape is 90 degrees of counter-clockwise
// rotation, portrait flip is 180 degrees of rotation, and landscape flip is
// 270 degress of counter-clockwise rotation.
//
// If no screen orientation is selected, "landscape flip" mode will be used.沒有選擇屏幕方向,一種模式被選擇
//
//*****************************************************************************
#if ! defined(PORTRAIT) && ! defined(PORTRAIT_FLIP) && \
    ! defined(LANDSCAPE) && ! defined(LANDSCAPE_FLIP)
#define PORTRAIT
#endif

//*****************************************************************************
//
// Various definitions controlling coordinate space mapping and drawing
// direction in the four supported orientations.
//坐標原點及坐標位置選擇。
//*****************************************************************************
#ifdef PORTRAIT//模式A
#define HORIZ_DIRECTION 0x28
#define VERT_DIRECTION 0x20
#define MAPPED_X(x, y) (239 - (y))
#define MAPPED_Y(x, y) (x)
#endif


#ifdef LANDSCAPE//模式B
#define HORIZ_DIRECTION 0x00
#define VERT_DIRECTION  0x08
#define MAPPED_X(x, y) (239 - (x))
#define MAPPED_Y(x, y) (319 - (y))
#endif
#ifdef PORTRAIT_FLIP//模式C
#define HORIZ_DIRECTION 0x18
#define VERT_DIRECTION 0x10
#define MAPPED_X(x, y) (y)
#define MAPPED_Y(x, y) (319 - (x))
#endif
#ifdef LANDSCAPE_FLIP//模式D
#define HORIZ_DIRECTION 0x30
#define VERT_DIRECTION  0x38
#define MAPPED_X(x, y) (x)
#define MAPPED_Y(x, y) (y)
#endif

//*****************************************************************************
//
// Defines for the pins that are used to communicate with the SSD2119.
//對PORT口的宏定義
//*****************************************************************************

#define LCD_DATAH_PINS          0xFF
#define LCD_DATAH_PERIPH        SYSCTL_PERIPH_GPIOD
#define LCD_DATAH_BASE          GPIO_PORTD_BASE

//
// LCD control line GPIO definitions.
//LCD的復位/ 讀/ 不知道控制
#define LCD_RST_PERIPH          SYSCTL_PERIPH_GPIOB
#define LCD_RST_BASE            GPIO_PORTB_BASE
#define LCD_RST_PIN             GPIO_PIN_7
#define LCD_RD_PERIPH           SYSCTL_PERIPH_GPIOB
#define LCD_RD_BASE             GPIO_PORTB_BASE
#define LCD_RD_PIN              GPIO_PIN_5
#define LCD_WR_PERIPH           SYSCTL_PERIPH_GPIOH
#define LCD_WR_BASE             GPIO_PORTH_BASE
#define LCD_WR_PIN              GPIO_PIN_6
#define LCD_DC_PERIPH           SYSCTL_PERIPH_GPIOH
#define LCD_DC_BASE             GPIO_PORTH_BASE
#define LCD_DC_PIN              GPIO_PIN_7

//*****************************************************************************
//
// Backlight control GPIO used with the Flash/SRAM/LCD daughter board.
//背光控制
//*****************************************************************************
#define LCD_BACKLIGHT_BASE      GPIO_PORTE_BASE
#define LCD_BACKLIGHT_PIN       GPIO_PIN_2

//*****************************************************************************
//
// Macro used to set the LCD data bus in preparation for writing a byte to the
// device.
//置位LCD數據總線,為寫數據做準備
//*****************************************************************************
#define SET_LCD_DATA(ucByte)                                                  \
{                                                                             \
    HWREG(LCD_DATAH_BASE + GPIO_O_DATA + (LCD_DATAH_PINS << 2)) = (ucByte);   \
}

//*****************************************************************************
//
// Various internal SD2119 registers name labels
//SD2119內部寄存器
//*****************************************************************************
#define S6D0154_DRIVER_OPT_CTRL_REG   0x01
#define S6D0154_DRV_WAVEFORM_CTRL_REG 0x02
#define S6D0154_ENTRY_MODE_REG        0x03
#define S6D0154_DISPLAY_CTRL_REG      0x07
#define S6D0154_BLANK_PERIOD_CTRL_REG 0X08
#define S6D0154_FRAME_CYCLE_CTRL_REG  0x0B
#define S6D0154_EXTERNAL_IF_CTRL_REG  0x0C
#define S6D0154_MODE_REG              0x0E
#define S6D0154_START_OSC_REG         0x0F
#define S6D0154_PWR_CTRL_1_REG        0x10
#define S6D0154_PWR_CTRL_2_REG        0x11
#define S6D0154_PWR_CTRL_3_REG        0x12
#define S6D0154_PWR_CTRL_4_REG        0x13
#define S6D0154_PWR_CTRL_5_REG        0x14
#define S6D0154_VCI_RECYCLING_REG     0x15
#define S6D0154_H_WINDOW_START_REG    0x37
#define S6D0154_H_WINDOW_END_REG      0x36
#define S6D0154_V_WINDOW_START_REG    0x39
#define S6D0154_V_WINDOW_END_REG      0x38
#define S6D0154_H_RAM_ADDR_REG        0x20
#define S6D0154_V_RAM_ADDR_REG        0x21
#define S6D0154_RAM_DATA_REG          0x22
#define S6D0154_GAMMA_CTRL_1_REG      0x50
#define S6D0154_GAMMA_CTRL_2_REG      0x51
#define S6D0154_GAMMA_CTRL_3_REG      0x52
#define S6D0154_GAMMA_CTRL_4_REG      0x53
#define S6D0154_GAMMA_CTRL_5_REG      0x54
#define S6D0154_GAMMA_CTRL_6_REG      0x55
#define S6D0154_GAMMA_CTRL_7_REG      0x56
#define S6D0154_GAMMA_CTRL_8_REG      0x57
#define S6D0154_GAMMA_CTRL_9_REG      0x58
#define S6D0154_GAMMA_CTRL_10_REG     0x59

#define ENTRY_MODE_DEFAULT 0x1028
#define MAKE_ENTRY_MODE(x) ((ENTRY_MODE_DEFAULT & 0xFF00) | (x))

//*****************************************************************************
//
// The dimensions of the LCD panel.
//定義LCD的大小
//*****************************************************************************
#define LCD_VERTICAL_MAX 240
#define LCD_HORIZONTAL_MAX 320

//*****************************************************************************
//
// Translates a 24-bit RGB color to a display driver-specific color.
//
// \param c is the 24-bit RGB color.  The least-significant byte is the blue
// channel, the next byte is the green channel, and the third byte is the red
// channel.
//
// This macro translates a 24-bit RGB color into a value that can be written
// into the display's frame buffer in order to reproduce that color, or the
// closest possible approximation of that color.
//
// \return Returns the display-driver specific color.
//獲取色素RGB值
//*****************************************************************************
#define DPYCOLORTRANSLATE(c)    ((((c) & 0x00f80000) >> 8) |               \
                                 (((c) & 0x0000fc00) >> 5) |               \
                                 (((c) & 0x000000f8) >> 3))

//*****************************************************************************
//
// Function pointer types for low level LCD controller access functions.
//定義函數指針類型
//*****************************************************************************
typedef void (*pfnWriteData)(unsigned short usData);
typedef void (*pfnWriteCommand)(unsigned char ucData);

//*****************************************************************************
//
// Function pointers for low level LCD controller access functions.
//函數指針的指向
//*****************************************************************************

static void WriteDataGPIO(unsigned short usData);
static void WriteCommandGPIO(unsigned char ucData);

pfnWriteData WriteData = WriteDataGPIO;
pfnWriteCommand WriteCommand = WriteCommandGPIO;

//*****************************************************************************
//
// Writes a data word to the SSD2119.  This function implements the basic GPIO
// interface to the LCD display.
//
//*****************************************************************************
static void
WriteDataGPIO(unsigned short usData)
{
    //
    // Write the most significant byte of the data to the bus.
    //置位總線,準備寫數據
    SET_LCD_DATA(usData >> 8);

    //
    // Assert the write enable signal.  We need to do this 3 times to ensure
    // that we don't violate the timing requirements for the display (when
    // running with a 50MHz system clock).
    //使能寫信號【寫三次】寫信號寫0使能,寫1除能
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;

    //
    // Deassert the write enable signal.
    //撤銷寫使能信號
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;

    //
    // Write the least significant byte of the data to the bus.
    //
    SET_LCD_DATA(usData);

    //
    // Assert the write enable signal.
    //再次使能寫信號
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;

    //
    // Deassert the write enable signal.  WR needs to be high for at least
    // 50nS and back-to-back inlined calls to this function could just,
    // conceivably violate this so add one access to pad the time a bit.
    //撤銷寫使能信號
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
}

//*****************************************************************************
//
// Writes a data word to the SSD2119 via the EPI interface as wired when using
// the lm3s9b96 development kit SRAM/flash daughter board.
//通過EPI接口寫一個數據
//*****************************************************************************
static void
WriteDataEPI(unsigned short usData)
{
    HWREGB(LCD_DATA_PORT) = usData >> 8;
    HWREGB(LCD_DATA_PORT) = usData;
}

//*****************************************************************************
//
// Writes a command word to the SSD2119 via the EPI interface as wired when
// using the lm3s9b96 development kit SRAM/flash daughter board.
//通過EPI接口寫一個命令
//*****************************************************************************
static void
WriteCommandEPI(unsigned char ucData)
{
    HWREGB(LCD_COMMAND_PORT) = 0;
    HWREGB(LCD_COMMAND_PORT) = ucData;
}

//*****************************************************************************
//
// Writes a command to the SSD2119.  This function implements the basic GPIO
// interface to the LCD display.
//寫命令,實現最基本的GPIO液晶顯示
//*****************************************************************************
static void
WriteCommandGPIO(unsigned char ucData)
{

    //
    // Write the most significant byte of the data to the bus. This is always
    // 0 since commands are no more than 8 bits currently.
    //置位總線,為寫數據做準備
    SET_LCD_DATA(0);

    //
    // Assert DC
    //聲明不知道
    HWREG(LCD_DC_BASE + GPIO_O_DATA + (LCD_DC_PIN << 2)) = 0;

    //
    // Assert the write enable signal.  Do this twice to 3 times to slow things
    // down a bit.
    //使能寫
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;

    //
    // Deassert the write enable signal. We need to leave WR high for at least
    // 50nS so, again, stick in a dummy write to pad the timing.
    //除能寫
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;

    //
    // Write the least significant byte of the data to the bus.
    //
    SET_LCD_DATA(ucData);

    //
    // Assert the write enable signal.  Again, do this twice to ensure
    // we meet the timing spec.
    //
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;

    //
    // Deassert the write enable signal.
    //
    HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;

    //
    // Set the DC signal high, indicating that following writes are data.  There
    // is no need to pad the timing here since we won't violate the 50nS rule
    // even if this function is inlined and it or WriteData are called
    // immediately after we exit.
    //
    HWREG(LCD_DC_BASE + GPIO_O_DATA + (LCD_DC_PIN << 2)) = LCD_DC_PIN;
}

//*****************************************************************************
//
// Initializes the pins required for the GPIO-based LCD interface.
//
// This function configures the GPIO pins used to control the LCD display
// when the basic GPIO interface is in use.  On exit, the LCD controller
// has been reset and is ready to receive command and data writes.
//
// \return None.
//
//*****************************************************************************
static void
InitGPIOLCDInterface(unsigned long ulClockMS)
{
    //
    // Convert the PB7/NMI pin into a GPIO pin.  This requires the use of the
    // GPIO lock since changing the state of the pin is otherwise disabled.
    //
    HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
    HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x80;

    //
    // Make PB7 an output.
    //
    GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_7);

    //
    // Clear the commit register, effectively locking access to registers
    // controlling the PB7 configuration.
    //
    HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
    HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x00;

    //
    // Configure the pins that connect to the LCD as GPIO outputs.
    //
    GPIOPinTypeGPIOOutput(LCD_DATAH_BASE, LCD_DATAH_PINS);
    GPIOPinTypeGPIOOutput(LCD_DC_BASE, LCD_DC_PIN);
    GPIOPinTypeGPIOOutput(LCD_RD_BASE, LCD_RD_PIN);
    GPIOPinTypeGPIOOutput(LCD_WR_BASE, LCD_WR_PIN);
    GPIOPinTypeGPIOOutput(LCD_RST_BASE, LCD_RST_PIN);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品人妖ts系列视频| 日韩视频免费观看高清完整版 | 日韩二区三区四区| 欧美日韩mp4| 首页国产欧美日韩丝袜| 欧美丰满美乳xxx高潮www| 日产精品久久久久久久性色| 日韩精品一区二区三区swag| 国产一区二区调教| 国产欧美日韩不卡免费| 99久久精品国产一区| 一区二区三区精密机械公司| 欧美日韩的一区二区| 精品亚洲porn| ...xxx性欧美| 91精品国产综合久久婷婷香蕉 | 欧美色爱综合网| 麻豆精品一区二区综合av| 久久青草欧美一区二区三区| 91在线视频在线| 亚洲成a人v欧美综合天堂| 精品国产1区2区3区| av高清久久久| 麻豆极品一区二区三区| 中文成人综合网| 欧美日韩久久久| 国产一区二区三区在线观看精品| 亚洲欧洲成人精品av97| 69堂精品视频| 成人免费视频视频| 日韩精品福利网| 国产精品国产三级国产aⅴ中文| 欧美日韩免费观看一区三区| 国产一区二区精品在线观看| 亚洲一区二区中文在线| 日韩精品在线网站| 欧美亚洲丝袜传媒另类| 国产精品白丝jk黑袜喷水| 亚洲一区二区三区在线看| 久久久久99精品一区| 91福利在线免费观看| 国产精品一二一区| 亚洲成人动漫av| 亚洲欧洲日产国码二区| 欧美tickle裸体挠脚心vk| 色先锋资源久久综合| 国产一区二区三区黄视频| 亚洲国产日韩av| 国产精品精品国产色婷婷| 91精品午夜视频| 色哦色哦哦色天天综合| 国产高清在线精品| 日韩高清在线电影| 一区二区三区国产豹纹内裤在线| 久久影院午夜片一区| 欧美精品一卡两卡| 91福利在线观看| 91香蕉视频污在线| 福利91精品一区二区三区| 国产一区二区免费视频| 免费在线看一区| 图片区小说区国产精品视频| 亚洲精品中文字幕在线观看| 日本一区二区电影| 久久久久国产精品厨房| 精品久久免费看| 日韩欧美国产一区二区三区| 欧美日韩在线播| 久久久精品影视| 日韩欧美国产成人一区二区| 69av一区二区三区| 欧美精品久久久久久久久老牛影院| 色呦呦网站一区| 91首页免费视频| www.一区二区| 成a人片国产精品| 不卡一区在线观看| 成人短视频下载| 94色蜜桃网一区二区三区| 97久久精品人人澡人人爽| av男人天堂一区| 91网站在线播放| 欧美在线观看一区二区| 在线视频你懂得一区| 欧美日韩一区二区在线视频| 欧美日韩国产中文| 欧美日韩高清一区二区| 日韩一区二区三区精品视频| 欧美一区二区三区四区视频| 日韩精品资源二区在线| 精品国内二区三区| 国产日韩精品一区二区三区在线| 国产视频一区在线播放| 国产精品久久久久国产精品日日| 最好看的中文字幕久久| 樱花影视一区二区| 午夜视频久久久久久| 欧美a级一区二区| 国产精品一区二区在线观看不卡 | 国产一区二三区| 国产福利一区二区三区视频在线| 风间由美一区二区三区在线观看 | 亚洲欧美日韩国产综合| 亚洲精品视频免费观看| 亚洲成人激情社区| 激情综合色播激情啊| 国产成人精品www牛牛影视| 91玉足脚交白嫩脚丫在线播放| 欧美综合一区二区三区| 欧美一区二区三区系列电影| 欧美国产1区2区| 午夜激情一区二区三区| 国产老肥熟一区二区三区| 91福利国产成人精品照片| 欧美大黄免费观看| ●精品国产综合乱码久久久久| 视频一区中文字幕国产| 国产成人午夜精品影院观看视频| 色婷婷久久一区二区三区麻豆| 日韩欧美精品在线视频| 中文字幕一区二区在线播放| 视频一区视频二区中文| 国产成人精品午夜视频免费| 欧美在线观看视频一区二区三区| 日韩美女一区二区三区四区| 亚洲视频综合在线| 精品一区二区三区在线播放| 91视频在线看| 精品久久人人做人人爽| 亚洲一级二级三级在线免费观看| 国产福利一区在线| 7777精品久久久大香线蕉| 综合久久给合久久狠狠狠97色 | 国产女人18毛片水真多成人如厕| 亚洲一级不卡视频| 成a人片亚洲日本久久| 日韩一区二区不卡| 亚洲自拍偷拍网站| 99视频有精品| 久久婷婷综合激情| 裸体健美xxxx欧美裸体表演| 91久久精品一区二区| 欧美激情一区二区三区蜜桃视频| 日本美女视频一区二区| 91精彩视频在线| 亚洲欧美在线aaa| 国产精品伊人色| 久久久午夜精品理论片中文字幕| 日日夜夜精品免费视频| 欧洲一区在线观看| 亚洲欧美日韩综合aⅴ视频| 国产成人一区在线| 久久久激情视频| 国产乱国产乱300精品| 日韩欧美国产综合| 免费观看在线色综合| 欧美美女视频在线观看| 一区二区视频在线| 色呦呦网站一区| 亚洲情趣在线观看| 91小视频在线免费看| 亚洲人午夜精品天堂一二香蕉| 国产91综合一区在线观看| 久久久99久久| 成人午夜视频在线观看| 久久精品视频一区二区三区| 国产一区欧美一区| 国产调教视频一区| 国产成人午夜99999| 久久精品欧美日韩| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 日韩精品一区二区三区在线播放| 天天操天天干天天综合网| 欧美日韩精品高清| 蜜桃视频一区二区三区| 日韩一级欧美一级| 韩国成人精品a∨在线观看| 精品av久久707| 国产白丝网站精品污在线入口| 国产日产精品1区| 91亚洲精品一区二区乱码| 亚洲人123区| 欧美日韩免费视频| 久久99精品一区二区三区 | 99这里都是精品| 亚洲国产视频a| 欧美一区二区三区思思人| 麻豆视频观看网址久久| 国产欧美日韩不卡| 色噜噜狠狠色综合中国| 日韩vs国产vs欧美| 久久亚洲捆绑美女| 99re视频精品| 日本aⅴ精品一区二区三区| 久久嫩草精品久久久久| 91在线视频播放| 秋霞午夜av一区二区三区| 久久综合九色综合97婷婷| 成人h动漫精品一区二区| 亚洲国产欧美在线人成|