Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //By AtomSoft : AKA Jason Lopez
- // Enjoy
- /* Includes */
- #include <stdlib.h>
- #include <string.h>
- #include "stm32f4xx_conf.h"
- #include "stm32f4xx.h"
- #include "font.h"
- void SysTick_Handler(void);
- void CONFIG_LCD_PINS(void);
- #define LCD_DB 8
- #define LCD_IOP GPIOE
- #define LCD_CTP GPIOB
- #define LCD_PINS (GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15)
- #define LCD_CONT (GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14)
- #define CS GPIO_Pin_11
- #define RS GPIO_Pin_12
- #define WR GPIO_Pin_13
- #define RD GPIO_Pin_14
- #define CS_LOW GPIO_ResetBits(LCD_CTP, CS);
- #define RS_LOW GPIO_ResetBits(LCD_CTP, RS);
- #define RD_LOW GPIO_ResetBits(LCD_CTP, RD);
- #define WR_LOW GPIO_ResetBits(LCD_CTP, WR);
- #define CS_HIGH GPIO_SetBits(LCD_CTP, CS);
- #define RS_HIGH GPIO_SetBits(LCD_CTP, RS);
- #define RD_HIGH GPIO_SetBits(LCD_CTP, RD);
- #define WR_HIGH GPIO_SetBits(LCD_CTP, WR);
- unsigned int IC_CODE; //Stores Driver IC ID (either SPFD5408A or ST7781R)
- //Basic Colors
- #define RED 0xf800
- #define GREEN 0x7e00
- #define BLUE 0x001f
- #define BLACK 0x0000
- #define YELLOW 0xffe0
- #define WHITE 0xffff
- //Other Colors
- #define CYAN 0x07ff
- #define BRIGHT_RED 0xf810
- #define GRAY1 0x8410
- #define GRAY2 0x4208
- //TFT resolution 240*320
- #define MIN_X 0
- #define MIN_Y 0
- #define MAX_X 239
- #define MAX_Y 319
- void init (void);
- void sendCommand(unsigned int index);
- void sendData(unsigned int data);
- void pushData(unsigned char data);
- unsigned char getData(void);
- unsigned int readRegister(unsigned int index);
- void setXY(unsigned int poX, unsigned int poY);
- void setPixel(unsigned int poX, unsigned int poY,unsigned int color);
- void drawLine(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1,unsigned int color);
- void drawVerticalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color);
- void drawHorizontalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color);
- void drawRectangle(unsigned int poX, unsigned int poY, unsigned int length,unsigned int width,unsigned int color);
- void fillRectangle(unsigned int poX, unsigned int poY, unsigned int length, unsigned int width, unsigned int color);
- void drawCircle(int poX, int poY, int r,unsigned int color);
- void fillCircle(int poX, int poY, int r,unsigned int color);
- void drawChar(unsigned char ascii,unsigned int poX, unsigned int poY,unsigned int size, unsigned int fgcolor);
- void drawString(char *string,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor);
- unsigned char drawNumber(long long_num,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor);
- unsigned char drawFloat(float floatNumber,unsigned char decimal,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor);
- void delay(unsigned char time, int unit);
- void all_pin_input(void);
- void all_pin_output(void);
- void all_pin_low(void);
- void setOrientation(unsigned int HV);
- void LCD_WriteReg(unsigned int INDEX, unsigned int DATA);
- GPIO_InitTypeDef LCDCTR_Setup;
- GPIO_InitTypeDef LCDIO_Setup;
- int color = WHITE;
- #define us 1
- #define ms 1000
- #define sec 100000
- int main(void)
- {
- unsigned int cur = 0;
- unsigned int nColor = 1;
- /* Configure SysTick for 1ms interrupts: */
- SysTick_Config(168000000/1000000);
- CONFIG_LCD_PINS();
- init(); //init TFT library
- fillRectangle(0,0,239,319,BLACK);
- drawString("AtomSoftTech",10,10,2,WHITE);
- drawString("Board: STM32F4-Discovery",10,30,1,WHITE);
- drawString("Speed: 168MHz",10,40,1,WHITE);
- while (1)
- {
- switch(cur)
- {
- case 0:
- nColor = BLACK;
- break;
- case 1:
- nColor = GREEN;
- break;
- case 2:
- nColor = RED;
- break;
- case 3:
- nColor = BLUE;
- break;
- case 4:
- nColor = YELLOW;
- break;
- case 5:
- nColor = WHITE;
- break;
- }
- fillRectangle(10,60,40,40,nColor);
- if(cur == 5)
- cur = 0;
- else
- cur++;
- delay(150,ms);
- }
- return(0);
- }
- unsigned int TimeCount = 0;
- unsigned char IsTimeUp = 0;
- void SysTick_Handler(void)
- {
- static unsigned int n16Count = 0;
- if(!IsTimeUp)
- {
- if (TimeCount == n16Count)
- {
- IsTimeUp = 1;
- n16Count = -1;
- }
- else
- {
- n16Count = n16Count + 1;
- }
- }
- }
- void CONFIG_LCD_PINS(void)
- {
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
- /* Configure GPIOs to drive LCD: */
- LCDIO_Setup.GPIO_Pin = LCD_PINS;
- LCDIO_Setup.GPIO_Mode = GPIO_Mode_OUT;
- LCDIO_Setup.GPIO_OType = GPIO_OType_PP;
- LCDIO_Setup.GPIO_Speed = GPIO_Speed_50MHz;
- LCDIO_Setup.GPIO_PuPd = GPIO_PuPd_NOPULL;
- GPIO_Init(LCD_IOP, &LCDIO_Setup);
- LCDCTR_Setup.GPIO_Pin = LCD_CONT;
- LCDCTR_Setup.GPIO_Mode = GPIO_Mode_OUT;
- LCDCTR_Setup.GPIO_OType = GPIO_OType_PP;
- LCDCTR_Setup.GPIO_Speed = GPIO_Speed_50MHz;
- LCDCTR_Setup.GPIO_PuPd = GPIO_PuPd_NOPULL;
- GPIO_Init(LCD_CTP, &LCDCTR_Setup);
- GPIO_ResetBits(LCD_CTP, LCD_CONT);
- GPIO_ResetBits(LCD_IOP, LCD_PINS);
- }
- void pushData(unsigned char data)
- {
- //all_pin_low();
- LCD_IOP->ODR = (int)((int)data << LCD_DB);
- }
- void delay(unsigned char time, int unit)
- {
- TimeCount=time * unit;
- IsTimeUp = 0;
- while(!IsTimeUp);
- }
- unsigned char getData(void)
- {
- unsigned char data=0;
- //delay(1,ms);
- data = (LCD_IOP->IDR >> 8);
- return data;
- }
- void sendCommand(unsigned int index)
- {
- CS_LOW;
- RS_LOW;
- RD_HIGH;
- WR_HIGH;
- WR_LOW;
- pushData(index>>8);
- //delay(10,us);
- WR_HIGH;
- WR_LOW;
- pushData(index);
- //delay(10,us);
- WR_HIGH;
- CS_HIGH;
- }
- void sendData(unsigned int data)
- {
- CS_LOW;
- RS_HIGH;
- RD_HIGH;
- WR_LOW;
- pushData(data>>8);
- //delay(10,us);
- WR_HIGH;
- WR_LOW;
- pushData(data);
- //delay(10,us);
- WR_HIGH;
- CS_HIGH;
- }
- unsigned int readRegister(unsigned int index)
- {
- unsigned int data=0;
- CS_LOW;
- RS_LOW;
- RD_HIGH;
- all_pin_output();
- //delay(50,us);
- WR_LOW;
- //delay(50,us);
- pushData(index>>8);
- WR_HIGH;
- //delay(50,us);
- WR_LOW;
- //delay(50,us);
- pushData(index);
- WR_HIGH;
- all_pin_input();
- all_pin_low();
- RS_HIGH;
- //delay(50,us);
- RD_LOW;
- //delay(50,us);
- data = (int)getData()<<8;
- RD_HIGH;
- //delay(50,us);
- RD_LOW;
- //delay(50,us);
- data |= getData();
- RD_HIGH;
- CS_HIGH;
- all_pin_output();
- return data;
- }
- void init (void)
- {
- unsigned char i;
- unsigned int f;
- CS_HIGH;
- //all_pin_output();
- //all_pin_low();
- delay(100,us);
- IC_CODE = readRegister(0x0);
- if(!IC_CODE){
- while(!IC_CODE)
- {
- IC_CODE = readRegister(0x0); //WAIT UNTIL KNOWN LCD
- }
- }
- if(IC_CODE == 0x5408) //SPFD5408B
- {
- sendCommand(0x0000);
- sendData(0x0001);
- delay(100,ms);
- sendCommand(0x0001);
- sendData(0x0000);
- sendCommand(0x0002);
- sendData(0x0700);
- sendCommand(0x0003);
- sendData(0x1030);
- sendCommand(0x0004);
- sendData(0x0000);
- sendCommand(0x0008);
- sendData(0x0207);
- sendCommand(0x0009);
- sendData(0x0000);
- sendCommand(0x000A);
- sendData(0x0000);
- sendCommand(0x000C);
- sendData(0x0000);
- sendCommand(0x000D);
- sendData(0x0000);
- sendCommand(0x000F);
- sendData(0x0000);
- //power on sequence VGHVGL
- sendCommand(0x0010);
- sendData(0x0000);
- sendCommand(0x0011);
- sendData(0x0007);
- sendCommand(0x0012);
- sendData(0x0000);
- sendCommand(0x0013);
- sendData(0x0000);
- //vgh
- sendCommand(0x0010);
- sendData(0x1290);
- sendCommand(0x0011);
- sendData(0x0227);
- delay(100,ms);
- //vregiout
- sendCommand(0x0012);
- sendData(0x001d); //0x001b
- delay(100,ms);
- //vom amplitude
- sendCommand(0x0013);
- sendData(0x1500);
- delay(100,ms);
- //vom H
- sendCommand(0x0029);
- sendData(0x0018);
- sendCommand(0x002B);
- sendData(0x000D);
- //gamma
- sendCommand(0x0030);
- sendData(0x0004);
- sendCommand(0x0031);
- sendData(0x0307);
- sendCommand(0x0032);
- sendData(0x0002);// 0006
- sendCommand(0x0035);
- sendData(0x0206);
- sendCommand(0x0036);
- sendData(0x0408);
- sendCommand(0x0037);
- sendData(0x0507);
- sendCommand(0x0038);
- sendData(0x0204);//0200
- sendCommand(0x0039);
- sendData(0x0707);
- sendCommand(0x003C);
- sendData(0x0405);// 0504
- sendCommand(0x003D);
- sendData(0x0F02);
- //ram
- sendCommand(0x0050);
- sendData(0x0000);
- sendCommand(0x0051);
- sendData(0x00EF);
- sendCommand(0x0052);
- sendData(0x0000);
- sendCommand(0x0053);
- sendData(0x013F);
- sendCommand(0x0060);
- sendData(0xA700);
- sendCommand(0x0061);
- sendData(0x0001);
- sendCommand(0x006A);
- sendData(0x0000);
- //
- sendCommand(0x0080);
- sendData(0x0000);
- sendCommand(0x0081);
- sendData(0x0000);
- sendCommand(0x0082);
- sendData(0x0000);
- sendCommand(0x0083);
- sendData(0x0000);
- sendCommand(0x0084);
- sendData(0x0000);
- sendCommand(0x0085);
- sendData(0x0000);
- //
- sendCommand(0x0090);
- sendData(0x0010);
- sendCommand(0x0092);
- sendData(0x0600);
- sendCommand(0x0093);
- sendData(0x0003);
- sendCommand(0x0095);
- sendData(0x0110);
- sendCommand(0x0097);
- sendData(0x0000);
- sendCommand(0x0098);
- sendData(0x0000);
- sendCommand(0x0007);
- sendData(0x0133);
- sendCommand(0x0022);//Start to write to display RAM
- }
- else
- {
- sendCommand(0x0001);
- sendData(0x0100);
- sendCommand(0x0002);
- sendData(0x0700);
- sendCommand(0x0003);
- sendData(0x1030);
- sendCommand(0x0004);
- sendData(0x0000);
- sendCommand(0x0008);
- sendData(0x0302);
- sendCommand(0x000A);
- sendData(0x0000);
- sendCommand(0x000C);
- sendData(0x0000);
- sendCommand(0x000D);
- sendData(0x0000);
- sendCommand(0x000F);
- sendData(0x0000);
- delay(100,ms);
- sendCommand(0x0030);
- sendData(0x0000);
- sendCommand(0x0031);
- sendData(0x0405);
- sendCommand(0x0032);
- sendData(0x0203);
- sendCommand(0x0035);
- sendData(0x0004);
- sendCommand(0x0036);
- sendData(0x0B07);
- sendCommand(0x0037);
- sendData(0x0000);
- sendCommand(0x0038);
- sendData(0x0405);
- sendCommand(0x0039);
- sendData(0x0203);
- sendCommand(0x003c);
- sendData(0x0004);
- sendCommand(0x003d);
- sendData(0x0B07);
- sendCommand(0x0020);
- sendData(0x0000);
- sendCommand(0x0021);
- sendData(0x0000);
- sendCommand(0x0050);
- sendData(0x0000);
- sendCommand(0x0051);
- sendData(0x00ef);
- sendCommand(0x0052);
- sendData(0x0000);
- sendCommand(0x0053);
- sendData(0x013f);
- delay(100,ms);
- sendCommand(0x0060);
- sendData(0xa700);
- sendCommand(0x0061);
- sendData(0x0001);
- sendCommand(0x0090);
- sendData(0x003A);
- sendCommand(0x0095);
- sendData(0x021E);
- sendCommand(0x0080);
- sendData(0x0000);
- sendCommand(0x0081);
- sendData(0x0000);
- sendCommand(0x0082);
- sendData(0x0000);
- sendCommand(0x0083);
- sendData(0x0000);
- sendCommand(0x0084);
- sendData(0x0000);
- sendCommand(0x0085);
- sendData(0x0000);
- sendCommand(0x00FF);
- sendData(0x0001);
- sendCommand(0x00B0);
- sendData(0x140D);
- sendCommand(0x00FF);
- sendData(0x0000);
- delay(100,ms);
- sendCommand(0x0007);
- sendData(0x0133);
- delay(50,ms);
- //exit standby
- sendCommand(0x0010);
- sendData(0x14E0);
- delay(100,ms);
- sendCommand(0x0007);
- sendData(0x0133);
- sendCommand(0x0022);
- }
- //paint screen black
- for(i=0;i<2;i++)
- {
- for(f=0;f<38400;f++)
- {
- sendData(BLACK);
- }
- }
- }
- void LCD_WriteReg(unsigned int INDEX, unsigned int DATA)
- {
- sendCommand(INDEX);
- sendData(DATA);
- }
- void setOrientation(unsigned int HV)//horizontal or vertical
- {
- sendCommand(0x03);
- if(HV==1)//vertical
- {
- if(IC_CODE == 0x5408) { sendData(0x1038); }
- else { sendData(0x5038); }
- }
- else//horizontal
- {
- if(IC_CODE == 0x5408) { sendData(0x1030); }
- else { sendData(0x5030); }
- }
- sendCommand(0x0022); //Start to write to display RAM
- }
- void setXY(unsigned int poX, unsigned int poY)
- {
- if(poX <0)
- poX = 0;
- if(poX>239)
- poX = 239;
- if(poY <0)
- poY = 0;
- if(poY>319)
- poY = 319;
- //poX = constrain(poX,MIN_X,MAX_X); //Limits the pixel range to 0 - 239
- //poY = constrain(poY,MIN_Y,MAX_Y); //Limits the pixel range to 0 - 319
- /* Writing to GRAM beyond the range gives unpredictable results. The above code
- is to limit this. This might also slow down the writing to TFT. You can
- remove the above two lines of code, if you think your application code
- does not write beyond this range. This would speed up TFT writing. */
- sendCommand(0x0020);//X
- sendData(poX);
- sendCommand(0x0021);//Y
- sendData(poY);
- sendCommand(0x0022);//Start to write to display RAM
- }
- void setPixel(unsigned int poX, unsigned int poY,unsigned int color)
- {
- setXY(poX,poY);
- sendData(color);
- }
- void drawCircle(int poX, int poY, int r,unsigned int color)
- {
- int x = -r, y = 0, err = 2-2*r, e2;
- do {
- setPixel(poX-x, poY+y,color);
- setPixel(poX+x, poY+y,color);
- setPixel(poX+x, poY-y,color);
- setPixel(poX-x, poY-y,color);
- e2 = err;
- if (e2 <= y) {
- err += ++y*2+1;
- if (-x == y && e2 <= x) e2 = 0;
- }
- if (e2 > x) err += ++x*2+1;
- }
- while (x <= 0);
- }
- void fillCircle(int poX, int poY, int r,unsigned int color)
- {
- int x = -r, y = 0, err = 2-2*r, e2;
- do {
- drawVerticalLine(poX-x,poY-y,2*y,color);
- drawVerticalLine(poX+x,poY-y,2*y,color);
- e2 = err;
- if (e2 <= y) {
- err += ++y*2+1;
- if (-x == y && e2 <= x) e2 = 0;
- }
- if (e2 > x) err += ++x*2+1;
- }
- while (x <= 0);
- }
- void drawLine(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1,unsigned int color)
- {
- int dx = (x1-x0), sx = x0<x1 ? 1 : -1;
- int dy = -(y1-y0), sy = y0<y1 ? 1 : -1;
- int err = dx+dy, e2; /* error value e_xy */
- for (;;){ /* loop */
- setPixel(x0,y0,color);
- e2 = 2*err;
- if (e2 >= dy) { /* e_xy+e_x > 0 */
- if (x0 == x1) break;
- err += dy;
- x0 += sx;
- }
- if (e2 <= dx) { /* e_xy+e_y < 0 */
- if (y0 == y1) break;
- err += dx;
- y0 += sy;
- }
- }
- }
- void drawVerticalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)
- {
- unsigned int i;
- if(poX <0)
- poX = 0;
- if(poX>239)
- poX = 239;
- if(poY <0)
- poY = 0;
- if(poY>319)
- poY = 319;
- //poX = constrain(poX,MIN_X,MAX_X); //Limits the pixel range to 0 - 239
- //poY = constrain(poY,MIN_Y,MAX_Y); //Limits the pixel range to 0 - 319
- setXY(poX,poY);
- setOrientation(1);
- if(length+poY>MAX_Y)
- {
- length=MAX_Y-poY;
- }
- for(i=0;i<length;i++)
- {
- sendData(color);
- }
- }
- void drawHorizontalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)
- {
- unsigned int i;
- if(poX <0)
- poX = 0;
- if(poX>239)
- poX = 239;
- if(poY <0)
- poY = 0;
- if(poY>319)
- poY = 319;
- //poX = constrain(poX,MIN_X,MAX_X); //Limits the pixel range to 0 - 239
- //poY = constrain(poY,MIN_Y,MAX_Y); //Limits the pixel range to 0 - 319
- setXY(poX,poY);
- setOrientation(0);
- if(length+poX>MAX_X)
- {
- length=MAX_X-poX;
- }
- for(i=0;i<length;i++)
- {
- sendData(color);
- }
- }
- void drawRectangle(unsigned int poX, unsigned int poY, unsigned int length,unsigned int width,unsigned int color)
- {
- drawHorizontalLine(poX, poY, length, color);
- drawHorizontalLine(poX, poY+width, length, color);
- drawVerticalLine(poX, poY, width,color);
- drawVerticalLine(poX + length, poY, width,color);
- }
- void fillRectangle(unsigned int poX, unsigned int poY, unsigned int length, unsigned int width, unsigned int color)
- {
- unsigned int i;
- for(i=0;i<width;i++)
- {
- drawHorizontalLine(poX, poY+i, length, color);
- }
- }
- void drawChar(unsigned char ascii,unsigned int poX, unsigned int poY,unsigned int size, unsigned int fgcolor)
- {
- unsigned char i;
- unsigned char temp;
- unsigned char f;
- setXY(poX,poY);
- setOrientation(1);
- if((ascii < 0x20)||(ascii > 0x7e))//Unsupported char.
- {
- ascii = '?';
- }
- for(i=0;i<8;i++)
- {
- temp = simpleFont[ascii-0x20][i];
- for(f=0;f<8;f++)
- {
- if((temp>>f)&0x01)
- {
- fillRectangle(poX+i*size, poY+f*size, size, size, fgcolor);
- }
- }
- }
- }
- void drawString(char *string,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)
- {
- while(*string)
- {
- drawChar(*string, poX, poY, size, fgcolor);
- string++;
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- }
- }
- unsigned char drawNumber(long long_num,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)
- {
- unsigned char char_buffer[10]="";
- unsigned char i = 0;
- unsigned char f = 0;
- if (long_num < 0)
- {
- f=1;
- drawChar('-',poX, poY, size, fgcolor);
- long_num = -long_num;
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- }
- else if (long_num == 0)
- {
- f=1;
- drawChar('0',poX, poY, size, fgcolor);
- return f;
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- }
- while (long_num > 0)
- {
- char_buffer[i++] = long_num % 10;
- long_num /= 10;
- }
- f=f+i;
- for(; i > 0; i--)
- {
- drawChar('0'+ char_buffer[i - 1],poX, poY, size, fgcolor);
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- }
- return f;
- }
- unsigned char drawFloat(float floatNumber,unsigned char decimal,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)
- {
- unsigned int temp=0;
- float decy=0.0;
- float rounding = 0.5;
- unsigned char f=0;
- unsigned char i;
- unsigned char howlong;
- if(floatNumber<0.0)
- {
- drawChar('-',poX, poY, size, fgcolor);
- floatNumber = -floatNumber;
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- f =1;
- }
- for (i=0; i<decimal; ++i)
- {
- rounding /= 10.0;
- }
- floatNumber += rounding;
- temp = (unsigned int)floatNumber;
- howlong=drawNumber(temp,poX, poY, size, fgcolor);
- f += howlong;
- if((poX+8*size*howlong) < MAX_X)
- {
- poX+=8*size*howlong; // Move cursor right
- }
- if(decimal>0)
- {
- drawChar('.',poX, poY, size, fgcolor);
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- f +=1;
- }
- decy = floatNumber-temp;//decimal part,
- for(i=0;i<decimal;i++)//4
- {
- decy *=10;// for the next decimal
- temp = decy;//get the decimal
- drawNumber(temp,poX, poY, size, fgcolor);
- floatNumber = -floatNumber;
- if(poX < MAX_X)
- {
- poX+=8*size; // Move cursor right
- }
- decy -= temp;
- }
- f +=decimal;
- return (unsigned char)f;
- }
- void all_pin_input(void)
- {
- LCDIO_Setup.GPIO_Mode = GPIO_Mode_IN; //SET PORT AS INPUT
- GPIO_Init(LCD_IOP, &LCDIO_Setup); //Re-Init Port
- //LCDCTR_Setup.GPIO_Mode = GPIO_Mode_IN; //SET PORT AS INPUT
- //GPIO_Init(LCD_CTP, &LCDCTR_Setup); //Re-Init Port
- }
- void all_pin_output(void)
- {
- LCDIO_Setup.GPIO_Mode = GPIO_Mode_OUT; //SET PORT AS INPUT
- GPIO_Init(LCD_IOP, &LCDIO_Setup); //Re-Init Port
- //LCDCTR_Setup.GPIO_Mode = GPIO_Mode_OUT; //SET PORT AS INPUT
- //GPIO_Init(LCD_CTP, &LCDCTR_Setup); //Re-Init Port
- }
- void all_pin_low(void)
- {
- LCD_IOP->BSRRH = LCD_PINS;
- // LCD_CTP->BSRRH = LCD_CONT;
- }
Advertisement
Add Comment
Please, Sign In to add comment