Page 291 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 291
#include "GLCD.h"
#include "font.h"
#define Black 0x0000 /* 0, 0, 0 */
#define Navy 0x000F /* 0, 0, 128 */
#define DarkGreen 0x03E0 /* 0, 128, 0 */
#define DarkCyan 0x03EF /* 0, 128, 128 */
#define Maroon 0x7800 /* 128, 0, 0 */
#define Purple 0x780F /* 128, 0, 128 */
#define Olive 0x7BE0 /* 128, 128, 0 */
#define LightGrey 0xC618 /* 192, 192, 192 */
#define DarkGrey 0x7BEF /* 128, 128, 128 */
#define Blue 0x001F /* 0, 0, 255 */
#define Green 0x07E0 /* 0, 255, 0 */
#define Cyan 0x07FF /* 0, 255, 255 */
#define Red 0xF800 /* 255, 0, 0 */
#define Magenta 0xF81F /* 255, 0, 255 */
#define Yellow 0xFFE0 /* 255, 255, 0 */
#define White 0xFFFF /* 255, 255, 255 */
static volatile unsigned short TextColor = Red, BackColor = Black;
//총 개수 출력용 텍스트 색
static volatile unsigned short TextColor1 = Yellow, BackColor1 = Black;
//총 가격 출력용 텍스트 색
unsigned int text;
unsigned int back;
unsigned short DeviceCode;
void GLCD_init (void)
{
/* Enable clock for GPIOA,B,C,D,E AFIO and SPI3. */
RCC->APB2ENR |= 0x0000007D;
/* NCS is PB2, GPIO output set to high. */
GPIOE->CRL = 0x33333333; //
GPIOE->CRH = 0x33333333;
GPIOD->CRH &= 0x0000ffff; //PD12,PD13,14,15
GPIOD->CRH |= 0x33330000;
GPIOD->BSRR = 0x0000F000; //cs,rs,wr,rd = 1;
- 284 -