コード例 #1
0
ファイル: Interface.c プロジェクト: SamChenzx/sdp
/**********************************************************************
 * Function: Interface_showBoatErrorMessage
 * @param Error code for the error message to print.
 * @return None.
 * @remark Prints a boat error code to the LCD screen, and turns on the
 *  error LED, while clearing all other lights and messages.
 **********************************************************************/
void Interface_showBoatErrorMessage(error_t errorCode) {
    Interface_clearAll();
    Interface_errorLightOn();
    LCD_setPosition(0,0);
    LCD_writeString("Boat error:\n");
    LCD_writeString(getErrorMessage(errorCode));
    currentMsgCode = errorCode;
}
コード例 #2
0
ファイル: hd44780.c プロジェクト: stsrc/THD_gauge
void LCD_writeFLOAT(float value){
	char buf[10];
	if(value >= 1000000000.0) goto print_err;	
	if(sprintf(buf, "%.2f", value) <= 0) goto print_err;
	LCD_writeString(buf);
	return;
	print_err:
		LCD_writeString("ERR!\0");
		return;	
}
コード例 #3
0
ファイル: hd44780.c プロジェクト: stsrc/THD_gauge
void LCD_writeUINT32(uint32_t value){
	char buf[10];
	if(value >= 1000000000){
	       	LCD_writeString("ERR!\0");
		return;
	}
	if(sprintf(buf, "%lu", value) <= 0){
	       	LCD_writeString("ERR!\0");
		return;
	}
	LCD_writeString(buf);
}
コード例 #4
0
ファイル: fill.c プロジェクト: Zannys/stm-ILI9341-spi
void TEST_fill() {
    FPS_start();

    for (u8 i = 0; i < 30; i++) {
        LCD_setCursor(0, 0);
        LCD_fillScreen(RED);
        FPS_frame();
        LCD_writeString(FPS_getText());
        LCD_setCursor(0, 0);
        LCD_fillScreen(GREEN);
        FPS_frame();
        LCD_writeString(FPS_getText());
    }
}
コード例 #5
0
ファイル: hd44780.c プロジェクト: stsrc/THD_gauge
void LCD_writeFLOAT(float value){
	char buf[10];
	int32_t d1, d2;
	if(value >= 1000000000.0) goto print_err;	
	//if(sprintf(buf, "%.3f", value) <= 0) goto print_err;
	d1 = (int32_t)value;
	d2 = abs((int32_t)((value - d1)*100.0f));
	if(sprintf(buf, "%ld.%ld", d1, d2) <= 0) goto print_err;
	LCD_writeString(buf);
	return;
	print_err:
		LCD_writeString("ERR!\0");
		return;
}
コード例 #6
0
ファイル: hd44780.c プロジェクト: stsrc/THD_gauge
void LCD_test(){
	LCD_clear();
	for(uint8_t it = 0; it < LCD_x_cnt - 3; it++){
		LCD_goto(it, 0);
		LCD_writeString("te");
		LCD_goto(2 + it, 1);
		LCD_writeString("st");
		delay_ms(250);
		it++;
	}
	delay_ms(500);
	LCD_goto(LCD_x_cnt, 0);
	LCD_writeString("line_0\nline_1");
	while(1);
}
コード例 #7
0
ファイル: Lcd.c プロジェクト: SamChenzx/sdp
int main(void)
{
    Board_init();
    Serial_init();
    LCD_init();
    Timer_init();
    printf("Testing the LCD display.\nYou should see: Hello World!\n");

    LCD_writeString("Hello World!\nLine2\nLine3\nLine4\n");
    Timer_new(TIMER_TEST,WRITE_DELAY);
    while (!Timer_isExpired(TIMER_TEST)) {
        asm("nop");
    }
    printf("Overwriting line 1\n");
    LCD_writeString("Testing overtop line1.\n");

    Timer_new(TIMER_TEST,WRITE_DELAY);
    while (!Timer_isExpired(TIMER_TEST)) {
        asm("nop");
    }
    printf("Clearing Display\n");
    LCD_clearDisplay();

    Timer_new(TIMER_TEST,WRITE_DELAY);
    while (!Timer_isExpired(TIMER_TEST)) {
        asm("nop");
    }
    LCD_writeString("Here.we.go\n");
    LCD_writeString("CLEARED!\n");
    LCD_writeString("CLEARED2!\n");
    LCD_writeString("CLEARED3!\n");

    Timer_new(TIMER_TEST,WRITE_DELAY);
    while (!Timer_isExpired(TIMER_TEST)) {
        asm("nop");
    }

    LCD_clearDisplay();
    
    LCD_writeString("N:        E:        \n");
    char tmp[10];
    LCD_setPosition(0,3);
    sprintf(tmp,"%.2f",12.5f);
    LCD_writeString(tmp);
    
    LCD_setPosition(0,13);
    sprintf(tmp,"%.2f",-0.32f);
    LCD_writeString(tmp);

    return SUCCESS;
}
コード例 #8
0
ファイル: Board.c プロジェクト: SamChenzx/sdp
void dbprint(char *fmt, ...) {
    va_list args;
    va_start(args, fmt);
    char msg[255];
    vsprintf(msg, fmt, args);

#ifdef DEBUG
    if (option.useSerial)
        printf(msg);
    if (option.useLCD)
        LCD_writeString(msg);
    #ifdef USE_LOGGER
    Logger_writeString(msg);
    #endif
#endif
};
コード例 #9
0
ファイル: hd44780.c プロジェクト: stsrc/THD_gauge
void LCD_goto(uint8_t x, uint8_t y){
	uint8_t cmd = 0x80;
	uint8_t temp = 0;
	if((x > LCD_x_cnt - 1) || (y > LCD_y_cnt - 1)){
		LCD_clear();
		LCD_writeString("LCD_ERR!\nWRONG GOTO!");
		delay_ms(3000);
		LCD_clear();
	       	return;
	}
	LCD_x = x;
	LCD_y = y;
	temp = x/16;
	if(!y) cmd |= temp<<4;
	else cmd |= (temp<<4) + 0x40;	
	cmd |= (x-temp*16);
	LCD_send_command(cmd);
}
コード例 #10
0
ファイル: Interface.c プロジェクト: SamChenzx/sdp
int main(void) {
    //initializations
    Board_init();
    Serial_init();
    Timer_init();
    LCD_init();
    Interface_init();
    
    printf("INITIALIZATIONS COMPLETE\n");
    LCD_writeString("Interface online.\n");

    Timer_new(TIMER_TEST, 100);
    while (1) {
        if (Timer_isExpired(TIMER_TEST)) {
            printf("%X -- C:%X F:%X\n",Interface_isOkPressed(), buttonCount.okay, buttonPressed.flag.okay);
            Timer_new(TIMER_TEST, 100);
        }
        Interface_runSM();
    }
}
コード例 #11
0
ファイル: Interface.c プロジェクト: SamChenzx/sdp
static void showMessage(message_t msgCode){
    LCD_clearDisplay();
    LCD_setPosition(0,0);
    LCD_writeString(INTERFACE_MESSAGE[msgCode]);
    currentMsgCode = msgCode;
}