static void lcd_rst(void) { GPIO_ResetBits(RST_Port, RST_Pin); DWT_Delay(100000); GPIO_SetBits(RST_Port, RST_Pin); DWT_Delay(100000); }
void HP1600_leds(HP1600_LEDS value) { while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET); GPIO_ResetBits(CS_Port,CS_Pin); SPI_I2S_SendData(SPI1,0x9000|value); while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) == SET); GPIO_SetBits(CS_Port,CS_Pin); DWT_Delay(50); }
void S6B33BG_Sleep(void) { wr_cmd(S6B33BG_DISPLAY_OFF); wr_cmd(S6B33BG_STANDBY_MODE_ON); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x00); wr_cmd(S6B33BG_OSCILATION_MODE); wr_cmd(0x00); DWT_Delay(300000); }
void MP6090R_init(CONTRAST c) { GPIO_SetBits(RESET_Port,RESET_Pin); DWT_Delay(10000); control_data1=0xFC; control_data2=0; MP6090R_clear_buf(FALSE); MP6090R_contrast(c); }
uint8_t S6B33BG_Init(uint8_t AddressSetupTime,uint8_t DataSetupTime) { GPIO_Configuration(); FSMC_LCD_Init(AddressSetupTime,DataSetupTime); lcd_rst(); wr_cmd(S6B33BG_STANDBY_MODE_OFF); DWT_Delay(20000); wr_cmd(S6B33BG_OSCILATION_MODE); wr_cmd(0x01);// OSC ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x01);// DCDC1 ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x09);// AMP ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x0B);// DCDC2 ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x0F);// DCDC3 ON DWT_Delay(20000); S6B33BG_OrientationMode(ORIENTATION_PORTRAIT); wr_cmd(S6B33BG_DC_DC_SELECT); wr_cmd(0x02); wr_cmd(S6B33BG_DC_DC_CLK_DIVISION); wr_cmd(0x08); wr_cmd(S6B33BG_TEMPERATURE_COMPENSATION); wr_cmd(0x02); wr_cmd(S6B33BG_CONTRAST_CTRL); wr_cmd(0x41);// Contrast S6B33BG_ColorMode(COLOR_16BIT); wr_cmd(S6B33BG_ROW_VECTOR_MODE); wr_cmd(0x0E); wr_cmd(S6B33BG_NBLOCK_INVERSION); wr_cmd(0xD0); wr_cmd(S6B33BG_DRIVING_MODE); wr_cmd(0x00); wr_cmd(S6B33BG_ENTRY_MODE); wr_cmd(0x80);// 8bit data bus wr_cmd(S6B33BG_RAM_SKIP_AREA); wr_cmd(0x00); wr_cmd(S6B33BG_SPECIFIED_DIPLAY_PATTERN); wr_cmd(0x00); wr_cmd(S6B33BG_PARTIAL_DISPLAY_MODE); wr_cmd(0x00); DWT_Delay(100000); wr_cmd(S6B33BG_DISPLAY_ON); return S6B33BG_OK; }
void KDC_5060R_init(void) { GPIO_Configuration(); ADC_DMA_Configuration(); DWT_Delay(10000); // S0=0 S1=0 K0=0 K1=1 P0=1 P1=1 SC=0 DR=0 DD=0 display_data[8]=0x0E; // DD=1 display_data[17]=0x80; // DD=2 display_data[26]=0x40; KDC_5060R_send(); }
void Gradient(uint32_t color_inc,uint32_t cnt,uint32_t px_inc,uint32_t delay) { uint32_t i,j,c; c=0; i=32; for(j=0;j<cnt;j++){ HD66773R_Fill(0,i,HD66773R_GetWidth()-1,i+px_inc-1,c); i+=px_inc; c+=color_inc; } DWT_Delay(delay); c=0; i=160; for(j=0;j<cnt;j++){ HD66773R_Fill(0,i-px_inc,HD66773R_GetWidth()-1,i-1,c); i-=px_inc; c+=color_inc; } DWT_Delay(delay); c=0; i=0; for(j=0;j<cnt;j++){ HD66773R_Fill(i,32,i+px_inc-1,HD66773R_GetHeight()-1,c); i+=px_inc; c+=color_inc; } DWT_Delay(delay); c=0; i=128; for(j=0;j<cnt;j++){ HD66773R_Fill(i-px_inc,32,i-1,HD66773R_GetHeight()-1,c); i-=px_inc; c+=color_inc; } DWT_Delay(delay); }
static void HP1600_sendByte(uint8_t value, uint16_t mode) { while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET); GPIO_ResetBits(CS_Port,CS_Pin); SPI_I2S_SendData(SPI1,mode|(value&0xF0)); while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) == SET); GPIO_SetBits(CS_Port,CS_Pin); while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET); GPIO_ResetBits(CS_Port,CS_Pin); SPI_I2S_SendData(SPI1,mode|((value&0x0F)<<4)); while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) == SET); GPIO_SetBits(CS_Port,CS_Pin); DWT_Delay(20); }
void demo1(int delay,int on,int flush) { uint8_t i; for(i=0;i<sizeof(symbols)/sizeof(uint8_t);i++) { KDC_5060R_symbol(symbols[i],on,flush); DWT_Delay(delay); } if(on) { KDC_5060R_digit(8,flush); } else { KDC_5060R_digit_off(flush); } }
uint8_t NokiaN70_Init(uint8_t AddressSetupTime,uint8_t DataSetupTime) { GPIO_Configuration(); FSMC_LCD_Init(AddressSetupTime,DataSetupTime); lcd_rst(); wr_cmd(SLEEP_OUT); wr_cmd(DISPLAY_INVERSION_OFF); wr_cmd(IDLE_MODE_OFF); wr_cmd(NORMAL_DISPLAY_MODE_ON); DWT_Delay(125000); wr_cmd(DISPLAY_ON); return NokiaN70_OK; }
void S6B33BG_Wakeup(void) { wr_cmd(S6B33BG_STANDBY_MODE_OFF); DWT_Delay(20000); wr_cmd(S6B33BG_OSCILATION_MODE); wr_cmd(0x01);// OSC ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x01);// DCDC1 ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x09);// AMP ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x0B);// DCDC2 ON DWT_Delay(20000); wr_cmd(S6B33BG_DC_DC_AMP); wr_cmd(0x0F);// DCDC3 ON DWT_Delay(100000); wr_cmd(S6B33BG_DISPLAY_ON); }
int main(void) { int i; DWT_Init(); KDC_5060R_init(); ADC_SoftwareStartConvCmd(ADC1, ENABLE); DWT_Delay(1000000); demo1(0,TRUE,FALSE); KDC_5060R_text_all(TRUE,TRUE); DWT_Delay(5000000); demo1(0,FALSE,FALSE); KDC_5060R_text_all(FALSE,TRUE); DWT_Delay(1000000); demo1(0,TRUE,FALSE); KDC_5060R_text_all(TRUE,TRUE); DWT_Delay(1000000); demo1(0,FALSE,FALSE); KDC_5060R_text_all(FALSE,TRUE); DWT_Delay(1000000); demo1(0,TRUE,FALSE); KDC_5060R_text_all(TRUE,TRUE); DWT_Delay(1000000); demo1(0,FALSE,FALSE); KDC_5060R_text_all(FALSE,TRUE); DWT_Delay(1000000); for(i=0;i<10;i++) { KDC_5060R_digit(i,TRUE); DWT_Delay(200000); } KDC_5060R_digit_off(TRUE); KDC_5060R_text("HI WORLD",0,TRUE,TRUE); DWT_Delay(1000000); demo1(100000,TRUE,TRUE); DWT_Delay(1000000); demo1(100000,FALSE,TRUE); DWT_Delay(500000); demo1(0,TRUE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,FALSE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,TRUE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,FALSE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,TRUE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,FALSE,FALSE); KDC_5060R_send(); DWT_Delay(500000); demo1(0,TRUE,FALSE); KDC_5060R_send(); DWT_Delay(500000); KDC_5060R_clear_text(TRUE); DWT_Delay(500000); KDC_5060R_text("HI WORLD",0,TRUE,TRUE); DWT_Delay(500000); KDC_5060R_clear_text(TRUE); DWT_Delay(500000); KDC_5060R_text("HI WORLD",0,TRUE,TRUE); DWT_Delay(500000); KDC_5060R_clear_text(TRUE); DWT_Delay(500000); KDC_5060R_text("HI WORLD",0,TRUE,TRUE); DWT_Delay(500000); KDC_5060R_symbol(SYMBOL_DOUBLE_COLON_1,FALSE,FALSE); KDC_5060R_symbol(SYMBOL_DOUBLE_COLON_2,FALSE,FALSE); KDC_5060R_symbol(SYMBOL_MINUS,FALSE,TRUE); KDC_5060R_text("kbiva.wordpress.com",0,TRUE,TRUE); DWT_Delay(2000000); for(i=0;i>=-11;i--) { KDC_5060R_text("kbiva.wordpress.com",i,TRUE,TRUE); DWT_Delay(200000); } DWT_Delay(1000000); for(i=-11;i<=0;i++) { KDC_5060R_text("kbiva.wordpress.com",i,TRUE,TRUE); DWT_Delay(200000); } DWT_Delay(2000000); demo1(0,FALSE,FALSE); KDC_5060R_clear_text(TRUE); while(1){ KDC_5060R_receive(); if(key_data[0]&KEY_3) {KDC_5060R_text("red",0,TRUE,TRUE);KDC_5060R_leds_red();} if(key_data[0]&KEY_2) KDC_5060R_text("Button 2",0,TRUE,TRUE); if(key_data[1]&KEY_1) KDC_5060R_text("Button 1",0,TRUE,TRUE); if(key_data[1]&KEY_4) {KDC_5060R_text("green",0,TRUE,TRUE);KDC_5060R_leds_green();} if(key_data[1]&KEY_VOL_UP) KDC_5060R_text("Vol Up",0,TRUE,TRUE); if(key_data[1]&KEY_VOL_DOWN) KDC_5060R_text("Vol Down",0,TRUE,TRUE); if(key_data[1]&KEY_ATT) KDC_5060R_text("Att",0,TRUE,TRUE); if(key_data[1]&KEY_5) {KDC_5060R_text("yellow",0,TRUE,TRUE);KDC_5060R_leds_yellow();} if(key_data[1]&KEY_6) {KDC_5060R_text("leds off",0,TRUE,TRUE);KDC_5060R_leds_off();} if(key_data[2]&KEY_PLAY) KDC_5060R_text("Play",0,TRUE,TRUE); if(key_data[2]&KEY_SRC) KDC_5060R_text("SRC",0,TRUE,TRUE); if(key_data[2]&KEY_SEEK_RIGHT) KDC_5060R_text("Seek >>",0,TRUE,TRUE); if(key_data[2]&KEY_DISP) KDC_5060R_text("DISP",0,TRUE,TRUE); if(key_data[2]&KEY_SEEK_LEFT) KDC_5060R_text("Seek <<",0,TRUE,TRUE); if(key_data[2]&KEY_FM) KDC_5060R_text("FM",0,TRUE,TRUE); if(key_data[2]&KEY_AM) KDC_5060R_text("AM",0,TRUE,TRUE); if(key_data[3]&KEY_TI) KDC_5060R_text("TI",0,TRUE,TRUE); if(key_data[3]&KEY_AUDIO) KDC_5060R_text("AUDIO",0,TRUE,TRUE); if(ADCConvertedValue[0]<2000) KDC_5060R_text("RESET",0,TRUE,TRUE); DWT_Delay(100000); KDC_5060R_clear_text(TRUE); } }
void usleep(uint32_t us){ DWT_Delay(us * (SystemCoreClock/1000000)); }
void DWT_Delayms(uint32_t ms) // milliseconds { DWT_Delay(ms*1000); }
void SysTick_Handler(void){ static bool lowBat; // Set when battery voltage drops below VBAT_LOW static uint32_t sysTickCounter; sysTickCounter++; // Used to schedule less frequent tasks switch(system_state){ case STATE_IDLE: // Enable USB if VBUS is disconnected ;bool vBus = Chip_GPIO_GetPinState(LPC_GPIO, 0, VBUS); if(!vBus){ msc_state = MSC_ENABLED; } // If MSC enabled, VBUS is connected, and SD card is ready, try to connect as MSC if (msc_state == MSC_ENABLED && vBus && sd_state == SD_READY){ f_mount(NULL,"",0); // unmount file system if (msc_init() == MSC_OK){ Board_LED_Color(LED_YELLOW); system_state = STATE_MSC; break; }else{ // Error on MSC initialization error(ERROR_MSC_INIT); } } // If user has short pressed PB and SD card is ready, initiate acquisition if (pb_shortPress() && sd_state == SD_READY){ daq_init(); system_state = STATE_DAQ; break; } // Blink LED if in low battery state, otherwise solid green if (lowBat && sysTickCounter % TICKRATE_HZ1 < TICKRATE_HZ1/2){ Board_LED_Color(LED_OFF); } else { Board_LED_Color(LED_GREEN); } break; case STATE_MSC: // If VBUS is disconnected or button is short pressed ;bool pb; if (Chip_GPIO_GetPinState(LPC_GPIO, 0, VBUS) == 0 || (pb = pb_shortPress())){ if(pb){ msc_state = MSC_DISABLED; } msc_stop(); f_mount(fatfs,"",0); // mount file system Board_LED_Color(LED_GREEN); system_state = STATE_IDLE; enterIdleTime = Chip_RTC_GetCount(LPC_RTC); } break; case STATE_DAQ: // Perform the current asynchronous daq action daq_loop(); // If user has short pressed PB to stop acquisition if (pb_shortPress()){ Board_LED_Color(LED_PURPLE); daq_stop(); Board_LED_Color(LED_GREEN); system_state = STATE_IDLE; enterIdleTime = Chip_RTC_GetCount(LPC_RTC); msc_state = MSC_DISABLED; } break; } // Initialize SD card after every insertion if (Chip_GPIO_GetPinState(LPC_GPIO, 0, CARD_DETECT)){ // Card out Board_LED_Color(LED_CYAN); sd_state = SD_OUT; }else{ // Card in if (sd_state == SD_OUT){ // Delay 100ms to let connections and power stabilize DWT_Delay(100000); if(init_sd_spi(&cardinfo) != SD_OK) { error(ERROR_SD_INIT); } switch(system_state){ case STATE_IDLE: Board_LED_Color(LED_GREEN); break; case STATE_MSC: Board_LED_Color(LED_YELLOW); break; case STATE_DAQ: Board_LED_Color(LED_RED); break; } sd_state = SD_READY; } } /* Run once per second */ if(sysTickCounter % TICKRATE_HZ1 == 0){ float vBat = read_vBat(10); lowBat = vBat < VBAT_LOW ? true : false; // Set low battery state if (vBat < VBAT_SHUTDOWN){ shutdown_message("Low Battery"); } if ((Chip_RTC_GetCount(LPC_RTC) - enterIdleTime > TIMEOUT_SECS && system_state == STATE_IDLE) ){ shutdown_message("Idle Time Out"); } } /* Shut down conditions */ if (pb_longPress()){ shutdown_message("Power Button Pressed"); } /* Handle errors */ error_handler(); }
int main (void) { uint32_t TempColor[9] = { RED,GREEN,BLUE,CYAN,MAGENTA,YELLOW,BROWN,ORANGE,PINK }; uint32_t i; DWT_Init(); DWT_Delay(10000); BSP_Buttons_Init(BUTTON_MODE_EXTI); BSP_LEDs_Init(); ADC_DMA_Configuration(); ADC_SoftwareStartConvCmd(ADC1, ENABLE); if(S6B33BG_Init(0,1)==S6B33BG_ERROR) { BSP_LED_On(LED1); while(1); } S6B33BG_ColorMode(COLOR_16BIT); S6B33BG_OrientationMode(ORIENTATION_PORTRAIT); S6B33BG_ClearScreen(BLACK); S6B33BG_SetFont(FONT_8x14); S6B33BG_PutStr("Mobile phone LCD",2,2); S6B33BG_PutStr("Samsung GT-E1050",2,14); S6B33BG_SetFont(FONT_6x8); S6B33BG_PutStr("Resolution:128x128 px",2,30); S6B33BG_PutStr("Type:16bit color CSTN",2,40); S6B33BG_PutStr("Controller: S6B33BG",2,50); S6B33BG_PutStr("Marking on the LCD:",2,60); S6B33BG_PutStr(" 2P0427-E(Rev 1.0)",2,70); S6B33BG_PutStr(" Y120618-B1F",2,80); S6B33BG_PutStr("Marking on the cable:",2,90); S6B33BG_PutStr(" TSF8H0784FPC-A1-E G",2,100); S6B33BG_PutStr("MPU Interface:",2,110); S6B33BG_PutStr(" 8bit 8080 parallel",2,120); DWT_Delay(5000000); S6B33BG_ClearScreen(BLACK); S6B33BG_Fill(0,0,S6B33BG_GetWidth()-1,16,BLACK); S6B33BG_Fill(0,17,S6B33BG_GetWidth()-1,32,RED); S6B33BG_Fill(0,33,S6B33BG_GetWidth()-1,48,GREEN); S6B33BG_Fill(0,49,S6B33BG_GetWidth()-1,64,BLUE); S6B33BG_Fill(0,65,S6B33BG_GetWidth()-1,80,CYAN); S6B33BG_Fill(0,81,S6B33BG_GetWidth()-1,96,MAGENTA); S6B33BG_Fill(0,97,S6B33BG_GetWidth()-1,112,YELLOW); S6B33BG_Fill(0,113,S6B33BG_GetWidth()-1,128,WHITE); S6B33BG_PutStr("Color Bars",30,6); DWT_Delay(5000000); S6B33BG_ClearScreen(BLACK); S6B33BG_SetFont(FONT_8x8); S6B33BG_PutStr("3D rotating",20,12); S6B33BG_PutStr("cube and moving",4,24); S6B33BG_PutStr("checkerboard",18,36); S6B33BG_PutStr("demo",50,48); S6B33BG_SetFont(FONT_6x8); S6B33BG_PutStr("Delay (0 - 80 ms)",4,62); S6B33BG_PutStr("between frames is",4,72); S6B33BG_PutStr("controlled by onboard",4,82); S6B33BG_PutStr("potentiometer",4,92); S6B33BG_PutStr("more at:",8,108); S6B33BG_PutStr("kbiva.wordpress.com",8,118); for(i=0;i<100;i++) { S6B33BG_SetTextColours(TempColor[i%9],BLACK); S6B33BG_PutStr("kbiva.wordpress.com",8,118); DWT_Delay(100000); } S6B33BG_ClearScreen(BLACK); show_3d_cube(); while(1){}; }
void show_3d_cube(void){ int16_t ys=0,xs=0; float tp[24]; int pp[16]; float camz = 2.0; int x,y,xx,yy,j,i=0; float cosT; float sinT; float cosP; float sinP; float cosTcosP; float cosTsinP; float sinTcosP; float sinTsinP; int scaleFactor = MAX_Y_3D/4; float near = 3; float nearToObj; float x0,y0,z0; float fac; int xo; int yo; float rotation[3] = { 0.0, 0.0, 0.0 }; float rot_speed[3] = { 0.04, -0.08, 0.033 }; while(1) { i++; for(j=0;j<MAX_X_3D*MAX_Y_3D;j++) frame[j]=0; // Checkerboard background xo = 25.0*sin(10*i/100.0)*cos(6*i/100.0); yo = 25.0*sin(5*i/100.0)*cos(7.5*i/100.0); for (x=0;x<MAX_Y_3D;x++) { xx = (50+x+xo)% 32; for (y=0;y<MAX_X_3D;++y) { yy = (50+y+yo)% 32; if ((xx<16 && yy<16) || (xx>16 && yy>16)) { frame[x*MAX_Y_3D+y]=WHITE; } } } cosT = cos(rotation[0]); sinT = sin(rotation[0]); cosP = cos(rotation[1]); sinP = sin(rotation[1]); cosTcosP = cosT*cosP; cosTsinP = cosT*sinP; sinTcosP = sinT*cosP; sinTsinP = sinT*sinP; nearToObj = 1.5 + 3.0*sin(5*i/100.0); for (j=0;j<nbPts;++j) { x0 = cube[3*j+0]; y0 = cube[3*j+1]; z0 = cube[3*j+2]; tp[3*j+0] = cosT*x0 + sinT*z0; tp[3*j+1] = -sinTsinP*x0 + cosP*y0 + cosTsinP*z0; tp[3*j+2] = camz + cosTcosP*z0 - sinTcosP*x0 - sinP*y0; fac = scaleFactor * near * 1.0f / (tp[3*j+2]+near+nearToObj); pp[2*j+0] = (int)(MAX_Y_3D/2.0f + fac*tp[3*j+0] + 0.5 ); pp[2*j+1] = (int)(MAX_Y_3D/2.0f + fac*tp[3*j+1] + 0.5 ); } drawPolygons( tp, pp ); S6B33BG_FillPixel(xs,ys,xs+MAX_X_3D-1,ys+MAX_Y_3D-1,frame); for (j=0;j<3;++j) rotation[j] += rot_speed[j]; DWT_Delay(ADCConvertedValue[1]*20); } }
int main(void) { int8_t i; uint8_t val; DWT_Init(); GPIO_Configuration(); ADC_DMA_Configuration(); ADC_SoftwareStartConvCmd(ADC1, ENABLE); MDX7900R_init(); MDX7900R_backlight(LEDS_AMBER); MDX7900R_clear_text(0); MDX7900R_clear_symbols(); MDX7900R_create_char(0,char1); MDX7900R_create_char(1,char2); MDX7900R_create_char(2,char3); MDX7900R_create_char(3,char4); MDX7900R_create_char(4,char5); MDX7900R_create_char(5,char6); MDX7900R_create_char(6,char7); //MDX7900R_fill_symbols(); //MDX7900R_text(0,"\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06",1); //while(1){}; MDX7900R_text(0,"Hello World!!",1); DWT_Delay(2000000); for(i=0;i<13;i++) { MDX7900R_text(i,"Hello World!!",1); DWT_Delay(300000); MDX7900R_clear_text(0); } for(i=12;i>=0;i--) { MDX7900R_text(i,"Hello World!!",0); DWT_Delay(300000); } MDX7900R_text(0,"Hello World!!",1); DWT_Delay(2000000); MDX7900R_clear_text(0); for(i=12;i>=0;i--) { MDX7900R_text(i,"Sony MDX-C790",0); DWT_Delay(300000); } MDX7900R_text(0,"ony MDX-C7900R",0); DWT_Delay(300000); MDX7900R_text(0,"ny MDX-C7900R",0); DWT_Delay(3000000); MDX7900R_text(0," kbiva.word",0);DWT_Delay(1000000); MDX7900R_text(0," kbiva.wordp",0);DWT_Delay(300000); MDX7900R_text(0," kbiva.wordpr",0);DWT_Delay(300000); MDX7900R_text(0,"kbiva.wordpre",0);DWT_Delay(300000); MDX7900R_text(0,"biva.wordpres",0);DWT_Delay(300000); MDX7900R_text(0,"iva.wordpress",0);DWT_Delay(300000); MDX7900R_text(0,"va.wordpress.",0);DWT_Delay(300000); MDX7900R_text(0,"a.wordpress.c",0);DWT_Delay(300000); MDX7900R_text(0,".wordpress.co",0);DWT_Delay(300000); MDX7900R_text(0,"wordpress.com",0);DWT_Delay(1000000); MDX7900R_text(0,".wordpress.co",0);DWT_Delay(300000); MDX7900R_text(0,"a.wordpress.c",0);DWT_Delay(300000); MDX7900R_text(0,"va.wordpress.",0);DWT_Delay(300000); MDX7900R_text(0,"iva.wordpress",0);DWT_Delay(300000); MDX7900R_text(0,"biva.wordpres",0);DWT_Delay(300000); MDX7900R_text(0,"kbiva.wordpre",0);DWT_Delay(300000); MDX7900R_text(0," kbiva.wordpr",0);DWT_Delay(300000); MDX7900R_text(0," kbiva.wordp",0);DWT_Delay(300000); MDX7900R_text(0," kbiva.word",0); DWT_Delay(2000000); MDX7900R_clear_text(0); MDX7900R_text(0,"\x04\x05\x04\x05Hi World\x04",0); DWT_Delay(2000000); for(i=0;i<29;i++) { MDX7900R_symbol(symbols1[i],1); if(flip) { MDX7900R_text(0,"\x04\x05\x04\x05Hi World\x04",0); } else { MDX7900R_text(0,"\x05\x04\x05\x04Hi World\x05",0); } flip=!flip; DWT_Delay(200000); } DWT_Delay(2000000); for(i=28;i>=0;i--) { MDX7900R_symbol(symbols1[i],0); if(flip) { MDX7900R_text(0,"\x04\x05\x04\x05Hi World\x04",0); } else { MDX7900R_text(0,"\x05\x04\x05\x04Hi World\x05",0); } flip=!flip; DWT_Delay(200000); } DWT_Delay(2000000); MDX7900R_fill_symbols(); DWT_Delay(1000000); MDX7900R_clear_symbols(); DWT_Delay(1000000); MDX7900R_fill_symbols(); DWT_Delay(1000000); MDX7900R_clear_symbols(); DWT_Delay(1000000); MDX7900R_fill_symbols(); DWT_Delay(1000000); MDX7900R_clear_text(0); DWT_Delay(1000000); MDX7900R_text(0,"\x04\x05\x04\x05Hi World\x04",0); DWT_Delay(1000000); MDX7900R_clear_text(0); DWT_Delay(1000000); MDX7900R_text(0,"\x04\x05\x04\x05Hi World\x04",0); DWT_Delay(1000000); MDX7900R_clear_symbols(); DWT_Delay(2000000); i=0; dbass=4; val=128; while(1) { i++; if(flip) { if(i>20) { MDX7900R_symbol_1(); i=0; flip=!flip; } } else { if(i>20) { MDX7900R_symbol_2(); i=0; flip=!flip; } } val0=ADCConvertedValue[0]; if(val0<702) { if(dbass!=0) { MDX7900R_text(0,"DB0LED off",1); MDX7900R_backlight(LEDS_OFF); dbass=0; } } else if(val0<1643) { if(dbass!=1) { MDX7900R_text(0,"DB1LED green",1); MDX7900R_backlight(LEDS_GREEN); dbass=1; } } else if(val0<2638) { if(dbass!=2) { MDX7900R_text(0,"DB2LED amber",1); MDX7900R_backlight(LEDS_AMBER); dbass=2; } } else { if(dbass!=3) { MDX7900R_text(0,"DB3LED yellow",1); MDX7900R_backlight(LEDS_YELLOW); dbass=3; } } val1=ADCConvertedValue[1]; val2=ADCConvertedValue[2]; if((val1<3485)||(val2<3325)) { if(val1<180)MDX7900R_text(3,"OFF",1); else if(val1<423)MDX7900R_text(3,"SOURCE",1); else if(val1<636)MDX7900R_text(3,"-",1); else if(val1<866)MDX7900R_text(3,"MODE",1); else if(val1<1155)MDX7900R_text(3,"+",1); else if(val1<1445)MDX7900R_text(3,"SOUND",1); else if(val1<1728)MDX7900R_text(3,"SHIFT",1); else if(val1<2050)MDX7900R_text(3,"1",1); else if(val1<2388)MDX7900R_text(3,"2",1); else if(val1<2715)MDX7900R_text(3,"3",1); else if(val1<3485)MDX7900R_text(3,"4",1); if(val2<180)MDX7900R_text(3,"EJECT",1); else if(val2<423)MDX7900R_text(3,"DSPL",1); else if(val2<636)MDX7900R_text(3,"PTY",1); else if(val2<866)MDX7900R_text(3,"AF/TA",1); else if(val2<1155)MDX7900R_text(3,"10",1); else if(val2<1445)MDX7900R_text(3,"9",1); else if(val2<1728)MDX7900R_text(3,"8",1); else if(val2<2050)MDX7900R_text(3,"7",1); else if(val2<2388)MDX7900R_text(3,"6",1); else if(val2<3325)MDX7900R_text(3,"5",1); cleared=0; } else { if(!cleared) { MDX7900R_clear_text(3); cleared=1; } } if (capture_is_ready) { Volume_Direction direction; NVIC_DisableIRQ(TIM4_IRQn); capture_is_ready = 0; direction = captured_direction; NVIC_EnableIRQ(TIM4_IRQn); if(direction==FORWARD) { val++; sprintf(bufa,"----> %d",val); } else { val--; sprintf(bufa,"<---- %d",val); } MDX7900R_text(3,bufa,1); } DWT_Delay(50000); } }
void NokiaN70_Sleep(void) { wr_cmd(DISPLAY_OFF); wr_cmd(SLEEP_IN); DWT_Delay(5000); }
int main(void) { DWT_Init(); //DWT_Delay(120000); BSP_Buttons_Init(BUTTON_MODE_EXTI); BSP_LEDs_Init(); if(HD66773R_Init()==HD66773R_ERROR){ BSP_LED_On(LED4); while(1); } //HD66773R_OrientationMode(ORIENTATION_LANDSCAPE); //HD66773R_OrientationMode(ORIENTATION_PORTRAIT); //HD66773R_OrientationMode(ORIENTATION_LANDSCAPE_REV); HD66773R_OrientationMode(ORIENTATION_PORTRAIT_REV); HD66773R_ClearScreen(BLACK); HD66773R_SetFont(FONT_8x14); HD66773R_PutStr("Mobile phone LCD",0,2); HD66773R_PutStr("Samsung E700",12,14); HD66773R_SetFont(FONT_6x8); HD66773R_PutStr("Type: 1.8\" a-Si TFT",0,30); HD66773R_PutStr("active matrix",0,40); HD66773R_PutStr("Resolution:128x160 px",0,50); HD66773R_PutStr("Colors: 65K (16bit)",0,60); HD66773R_PutStr("Controller:",0,70); HD66773R_PutStr("Renesas HD66773R",0,80); HD66773R_PutStr("LCD:",0,90); HD66773R_PutStr("Samsung LTS180S3-HF1",0,100); HD66773R_PutStr("Connector: 27pin FPC",0,110); HD66773R_PutStr("with 0.6mm pitch",0,120); HD66773R_PutStr("Backlight: 3 LEDs",0,130); HD66773R_PutStr("MPU Interface:",0,140); HD66773R_PutStr("16bit 8080 parallel",0,150); DWT_Delay(10000000); HD66773R_ClearScreen(BLACK); HD66773R_PutStr("Accidentally spilled",0,0); HD66773R_PutStr("liquid soldering flux",0,10); HD66773R_PutStr("on the back of LCD :(",0,20); HD66773R_PutStr("The metal plate that",0,30); HD66773R_PutStr("reflects light from",0,40); HD66773R_PutStr("the LEDs isn't clean",0,50); HD66773R_PutStr("anymore. LCD works",0,60); HD66773R_PutStr("but backlight is not",0,70); HD66773R_PutStr("nice and not uniform",0,80); HD66773R_SetFont(FONT_8x14); HD66773R_PutStr("Demonstation of",0,88); HD66773R_PutStr("soldering flux",0,102); HD66773R_PutStr("beneath the LCD:",0,116); HD66773R_PutStr("best visible on",0,130); HD66773R_PutStr("white background",0,144); HD66773R_SetFont(FONT_6x8); DWT_Delay(10000000); HD66773R_ClearScreen(WHITE); DWT_Delay(5000000); HD66773R_ClearScreen(BLACK); HD66773R_Fill(0,0,HD66773R_GetWidth()-1,9,BLACK); HD66773R_Fill(0,10,HD66773R_GetWidth()-1,19,0xc0c0c0); HD66773R_Fill(0,20,HD66773R_GetWidth()-1,29,0x808080); HD66773R_Fill(0,30,HD66773R_GetWidth()-1,39,WHITE); HD66773R_Fill(0,40,HD66773R_GetWidth()-1,49,MAROON); HD66773R_Fill(0,50,HD66773R_GetWidth()-1,59,RED); HD66773R_Fill(0,60,HD66773R_GetWidth()-1,69,PURPLE); HD66773R_Fill(0,70,HD66773R_GetWidth()-1,79,MAGENTA); HD66773R_Fill(0,80,HD66773R_GetWidth()-1,89,0x008000); HD66773R_Fill(0,90,HD66773R_GetWidth()-1,99,GREEN); HD66773R_Fill(0,100,HD66773R_GetWidth()-1,109,0x808000); HD66773R_Fill(0,110,HD66773R_GetWidth()-1,119,YELLOW); HD66773R_Fill(0,120,HD66773R_GetWidth()-1,129,NAVY); HD66773R_Fill(0,130,HD66773R_GetWidth()-1,139,BLUE); HD66773R_Fill(0,140,HD66773R_GetWidth()-1,149,0x008080); HD66773R_Fill(0,150,HD66773R_GetWidth()-1,159,CYAN); HD66773R_PutStr("Color Bars",30,0); DWT_Delay(5000000); HD66773R_ClearScreen(BLACK); HD66773R_SetFont(FONT_8x14); HD66773R_PutStr("Blue gradient",10,8); HD66773R_Fill(0,31,HD66773R_GetWidth()-1,31,WHITE); Gradient(0x08,32,4,2000000); HD66773R_ClearScreen(BLACK); HD66773R_PutStr("Green gradient",8,8); HD66773R_Fill(0,31,HD66773R_GetWidth()-1,31,WHITE); Gradient(0x0400,64,2,2000000); HD66773R_ClearScreen(BLACK); HD66773R_PutStr("Red gradient",16,8); HD66773R_Fill(0,31,HD66773R_GetWidth()-1,31,WHITE); Gradient(0x080000,32,4,2000000); HD66773R_ClearScreen(BLACK); HD66773R_SetFont(FONT_6x8); HD66773R_PutStr("3D rotating cube and",4,0); HD66773R_PutStr("moving checkerboard",8,10); HD66773R_PutStr("kbiva.wordpress.com",8,150); show_3d_cube(); while(1){}; }
void NokiaN70_Wakeup(void) { wr_cmd(SLEEP_OUT); DWT_Delay(120000); wr_cmd(DISPLAY_ON); DWT_Delay(5000); }
void HP1600_clear(void) { HP1600_command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero DWT_Delay(1000); }
void HP1600_home(void) { HP1600_command(LCD_RETURNHOME); // set cursor position to zero DWT_Delay(1000); }