void LCDSample(void) { LCDClear(); gotoXY(7,1); LCDString("Nokia 5110"); gotoXY(4,2); LCDString("Scroll Demo"); }
void Task_LCDMAN(void *pdata){ char* src; INT8U err; while(1){ src = (char*)OSMboxPend(Mbox_LCDMAN,0,&err); LCDClear(); //LCDString(0,"ID:"); LCDString(0,src); OSTimeDlyHMSM(0,0,3,0); LCDClear(); LCDString(0," Bitman Lab\n Log System."); } }
void Main (void){ INT16U freq; S3C_SysInit(); OSInit(); LCDInit(); LCDString(0x00," Bitman\n Spartan 117"); delay(10); for(freq = 10;freq < 300;freq += 10){ S3C_SetPWMBuzzer(freq,freq/2); delay(1); } LCDClear(); delay(8); LCDString(0," Bitman Lab\n Log System."); S3C_SetPWMBuzzer(650,10); S3C_StartPWMBuzzer(); delay(3); S3C_StopPWMBuzzer(); delay(1); S3C_StartPWMBuzzer(); delay(3); S3C_StopPWMBuzzer(); delay(10); Sem_UART0Tx = OSSemCreate(1); Sem_UART1Tx = OSSemCreate(1); Mbox_UART0Rx = OSMboxCreate((void *)0); Mbox_UART0Tx = OSMboxCreate((void *)0); Mbox_LEDMAN = OSMboxCreate((void *)0); Mbox_BEEPMAN = OSMboxCreate((void *)0); Mbox_LCDMAN = OSMboxCreate((void *)0); iOPcode = TYPE_DEFAULT; OSTaskCreate(TaskStart,(void *)0,&Stk_TaskStart[99],10); OSStart(); }
void main(void) { /* Initialize I/O and Peripherals for application */ InitApp(); //at end of user.c led_counter=0; spk_bit=0; //what are the spk_bits ??? led_bit=0; LCDInit(); LCDClear(); gotoXY(1,11); //(1,11) is about halfway down LCDString("PIC 16LF1786"); while(1) { /* TODO <INSERT USER APPLICATION CODE HERE> */ if(spk_bit==1) { if((spk_enable==1)&&(spk_enable2==1)) LATBbits.LATB6=1; //B6 is the clk in for uploading program to PIC }else LATBbits.LATB6=0; } }
void loop() { gotoXY(0, 5); LCDString("Please wait."); LCDClear(); gotoXY(0, 0); LCDString("{BTC PRICES}"); gotoXY(0, 2); LCDString("$= "); gotoXY(0, 5); LCDString("Updated! "); delay(1000); gotoXY(0, 5); LCDString(" "); gotoXY(0, 5); for (int x=0; x <= 11; x++){ LCDString("."); delay(1000); } gotoXY(0, 5); for (int x=0; x <= 11; x++){ LCDString(" "); delay(1000); } }
void routine(void) { LCDClear(); LCDBitmap(bitcoin); // display Bitcoin Logo delay(3000); LCDClear(); gotoXY(0, 4); LCDString("kendricktabi.com"); delay(3000); LCDClear(); gotoXY(0, 0); LCDString(" {Bitcoin!} "); gotoXY(0, 2); LCDString("Connecting "); LCDString("to WiFi"); LCDClear(); gotoXY(0, 2); LCDString(" WiFi "); LCDString(" Connected! "); delay(1000); LCDClear(); for(;;) { loop(); } }
void LCDInit(void) { int i; LCDReset(); LCDSend(PSWRESET); // software reset SpinDelay(100); LCDSend(PSLEEPOUT); // exit sleep mode LCDSend(PBSTRON); // booster on LCDSend(PDISPON); // display on LCDSend(PNORON); // normal on LCDSend(PMADCTL); // rotate display 180 deg LCDSend(0xC0); LCDSend(PCOLMOD); // color mode LCDSend(0x02); // 8bpp color mode LCDSend(PSETCON); // set contrast LCDSend(0xDC); // clear display LCDSetXY(0,0); LCDSend(PRAMWR); // Write to display i=LCD_XRES*LCD_YRES; while(i--) LCDSend(WHITE); // test text on different colored backgrounds LCDString(" The quick brown fox ", (char *)&FONT6x8,1,1+8*0,WHITE ,BLACK ); LCDString(" jumped over the ", (char *)&FONT6x8,1,1+8*1,BLACK ,WHITE ); LCDString(" lazy dog. ", (char *)&FONT6x8,1,1+8*2,YELLOW ,RED ); LCDString(" AaBbCcDdEeFfGgHhIiJj ", (char *)&FONT6x8,1,1+8*3,RED ,GREEN ); LCDString(" KkLlMmNnOoPpQqRrSsTt ", (char *)&FONT6x8,1,1+8*4,MAGENTA,BLUE ); LCDString("UuVvWwXxYyZz0123456789", (char *)&FONT6x8,1,1+8*5,BLUE ,YELLOW); LCDString("`-=[]_;',./~!@#$%^&*()", (char *)&FONT6x8,1,1+8*6,BLACK ,CYAN ); LCDString(" _+{}|:\\\"<>? ",(char *)&FONT6x8,1,1+8*7,BLUE ,MAGENTA); // color bands LCDFill(0, 1+8* 8, 132, 8, BLACK); LCDFill(0, 1+8* 9, 132, 8, WHITE); LCDFill(0, 1+8*10, 132, 8, RED); LCDFill(0, 1+8*11, 132, 8, GREEN); LCDFill(0, 1+8*12, 132, 8, BLUE); LCDFill(0, 1+8*13, 132, 8, YELLOW); LCDFill(0, 1+8*14, 132, 8, CYAN); LCDFill(0, 1+8*15, 132, 8, MAGENTA); }
void loop(void) { LCDClear(); LCDBitmap(SFEFlame); delay(1000); LCDClear(); LCDBitmap(SFEFlameBubble); delay(1000); LCDClear(); LCDBitmap(awesome); delay(1000); LCDClear(); LCDString("Hello World!"); delay(1000); }
int main(void) { GPIO_InitTypeDef GPIO_InitStructure; //RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); //enable gpioB peripherial clock RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); //enable gpioA peripherial clock GPIO_InitStructure.GPIO_Pin = SCE|RES|DC|SCLK|SDIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOA, SCE|RES|DC|SCLK|SDIN); LCDinit(); //initialize LCD parameters while(count--) { LCDString("Hello worlds! "); } setXY(0,5); //while(count2--){ //writeCharInv('C'); // } newString("0.123457",0,2); floatToString(value-count2); newFont('V',55,5); /*To Do: */ return 0; }
void ProcessIO(void) { //Blink the LEDs according to the USB device status //BlinkUSBStatus(); //C short circuit makes this work if(PORTBbits.RB13 && button_pressed < 250) { button_pressed += 1; } else if (!PORTBbits.RB13) { button_cnt = 0; button_pressed = 0; } getTouchUL(); getTouchUR(); getTouchRU(); getTouchRL(); frontBack = PORTAbits.RA8 ; shake = PORTBbits.RB8 ; // User Application USB tasks if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) return; { unsigned char nread=0, i; nread = getsUSBUSART(USB_In_Buffer,64); //until the buffer is free. if(nread > 0) { /* speaker */ //LATAbits.LATA9 = !LATAbits.LATA9; if (USB_In_Buffer[0] == 92) play_count ^= 0x8000; play_count |= 0x0001; /* serial byte led */ //LATBbits.LATB15 = !LATBbits.LATB15; //LATBbits.LATB1 = 1;//!LATBbits.LATB1; /* contrast byte */ if (USB_In_Buffer[0] == '-') { char printme[8]; gContrast--; printme[0] = 48 + (unsigned char)gContrast / 100; printme[1] = 48 + ((unsigned char)gContrast % 100) / 10; printme[2] = 48 + ((unsigned char)gContrast % 100) % 10; printme[3] = 0; LCDString(printme); LCDInit(); //Init the LCD USB_In_Buffer[0] = 0; nread == 0; } if ((USB_In_Buffer[0] == '=') || (USB_In_Buffer[0] == '+')) { char printme[8]; gContrast++; printme[0] = 48 + (unsigned char)gContrast / 100; printme[1] = 48 + ((unsigned char)gContrast % 100) / 10; printme[2] = 48 + ((unsigned char)gContrast % 100) % 10; printme[3] = 0; LCDString(printme); LCDInit(); //Init the LCD USB_In_Buffer[0] = 0; nread == 0; } // special character that are not echoed to LCD if ((USB_In_Buffer[0] == 127) | (USB_In_Buffer[0] == 27) | (USB_In_Buffer[0] == '[')) { void LCDLogo(); /* backspace == clear screen */ if (USB_In_Buffer[0] == 127) LCDClear(); /* backlight byte */ if (USB_In_Buffer[0] == 27) LATBbits.LATB7 = !LATBbits.LATB7; /* hackrva logo */ if (USB_In_Buffer[0] == '[') LCDLogo(); USB_In_Buffer[0] = 0; nread == 0; } if (USB_In_Buffer[0] == ',') { unsigned char printme[8]; void gotoXY(int x, int y); char left = G_side_slider_left; char right = G_side_slider_right; gotoXY(0, 40); printme[0] = 'L'; printme[1] = 48 + (unsigned char)left / 100; printme[2] = 48 + ((unsigned char)left % 100) / 10; printme[3] = 48 + ((unsigned char)left % 100) % 10; printme[4] = 32; printme[5] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; USB_Out_Buffer[NextUSBOut++] = ' '; gotoXY(42, 40); printme[0] = 'R'; printme[1] = 48 + (unsigned char)right / 100; printme[2] = 48 + ((unsigned char)right % 100) / 10; printme[3] = 48 + ((unsigned char)right % 100) % 10; printme[4] = 32; printme[5] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; USB_Out_Buffer[NextUSBOut++] = '\r'; USB_Out_Buffer[NextUSBOut++] = '\n'; USB_In_Buffer[0] = 0; nread == 0; } if (USB_In_Buffer[0] == '.') { USB_In_Buffer[0] = 0; nread == 0; } if (USB_In_Buffer[0] == '/') { unsigned char printme[16]; void gotoXY(int x, int y); int setupRTCC(void); // shake sensor gotoXY(0, 41); printme[0] = 'S'; printme[1] = 48 + (unsigned char)shake / 100; printme[2] = 48 + ((unsigned char)shake % 100) / 10; printme[3] = 48 + ((unsigned char)shake % 100) % 10; printme[4] = 32; printme[5] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; USB_Out_Buffer[NextUSBOut++] = ' '; // front sensor gotoXY(42, 41); printme[0] = 'F'; printme[1] = 48 + (unsigned char)frontBack / 100; printme[2] = 48 + ((unsigned char)frontBack % 100) / 10; printme[3] = 48 + ((unsigned char)frontBack % 100) % 10; printme[4] = 32; printme[5] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; // secondary clock running status printme[0] = hextab[(OSCCON >> 28) & 0xF]; printme[1] = hextab[(OSCCON >> 24) & 0xF]; printme[2] = hextab[(OSCCON >> 20) & 0xF]; printme[3] = hextab[(OSCCON >> 16) & 0xF]; printme[4] = hextab[(OSCCON >> 12) & 0xF]; printme[5] = hextab[(OSCCON >> 8) & 0xF]; printme[6] = hextab[(OSCCON >> 4) & 0xF]; printme[7] = hextab[(OSCCON ) & 0xF]; printme[7] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; printme[0] = 'R'; printme[1] = 'T'; printme[2] = 'C'; printme[3] = 'C'; printme[4] = ':'; printme[5] = setupRTCC(); printme[6] = 0; LCDString(printme); for (i=0; printme[i] !=0 ; i++) USB_Out_Buffer[NextUSBOut++] = printme[i]; USB_Out_Buffer[NextUSBOut++] = '\r'; USB_Out_Buffer[NextUSBOut++] = '\n'; USB_In_Buffer[0] = 0; nread == 0; } // IR xmit if (USB_In_Buffer[0] == '>') { LATCbits.LATC1 = !LATCbits.LATC1; USB_In_Buffer[0] = 0; nread == 0; } // IR recv #define IR_RECV PORTCbits.RC1 // print anything not handled above if (USB_In_Buffer[0] != 0) { char printme[32]; for (i=0; i<nread; i++) printme[i] = USB_In_Buffer[i]; printme[i] = 0; LCDString(printme); LCDInit(); //Init the LCD } for (i=0; i<nread; i++,NextUSBOut++) { USB_Out_Buffer[NextUSBOut] = USB_In_Buffer[i]; } } // echo back to USB if ((USBUSARTIsTxTrfReady()) && (NextUSBOut > 0)) { putUSBUSART(&USB_Out_Buffer[0], NextUSBOut); NextUSBOut = 0; } }
void LCDStringPos (const char *aStr, uint8_t aPos, uint8_t aY) { uint8_t x = aPos * G_CharWidth; LCDString(aStr, x, aY); }
void LCDStringLine (const char *aStr, uint8_t aX, uint8_t aLine) { uint8_t y = aLine * G_CharHeight; LCDString(aStr, aX, y); }