Esempio n. 1
0
/*********************************************************************************************
Function name   : HD44780_GotoXY
Author 					: Grant Phillips
Date Modified   : 16/10/2013
Compiler        : Keil ARM-MDK (uVision V4.70.0.0)

Description			: Changes the position of the current character cursor from where the next
									characters will be printed.

Special Note(s) : NONE

Parameters			: x				-	column position (0 - HD44780_DISP_LENGTH-1)
									y				-	row position (0 - HD44780_DISP_ROWS-1)

Return value		: NONE
*********************************************************************************************/
void HD44780_GotoXY(unsigned char x, unsigned char y)
{
    unsigned char copy_y=0;

    if(x > (HD44780_DISP_LENGTH-1))
        x = 0;

    if(y > (HD44780_DISP_ROWS-1))
        y = 0;

    switch(y)
    {
    case 0:
        copy_y = 0x80;
        break;
    case 1:
        copy_y = 0xc0;
        break;
    case 2:
        copy_y = 0x94;
        break;
    case 3:
        copy_y = 0xd4;
        break;
    }
    hd44780_wr_cmd(x + copy_y);
}
Esempio n. 2
0
void hd44780_clear() {
//	for (int i = 0; i < HD44780_DISP_VOLUME; i++)
//		buffer[i] = ' ';

	memset(buffer, ' ', HD44780_DISP_VOLUME);

	if (!showingTemp)
		hd44780_wr_cmd(HD44780_CMD_CLEAR);
}
Esempio n. 3
0
void hd44780_show_temp_msg(const char *line1, const char *line2) {
	if (showingTemp)
		return;
	showingTemp = 1;

	hd44780_wr_cmd(HD44780_CMD_CLEAR);

	hd44780_goto_noblock(1, (HD44780_DISP_LENGTH - strlen(line1)) / 2 + 1);
	for (uint8_t i = 0; line1[i] != '\0'; ++i)
		hd44780_wr_data_noblock(line1[i]);

	hd44780_goto_noblock(2, (HD44780_DISP_LENGTH - strlen(line2)) / 2 + 1);
	for (uint8_t i = 0; line2[i] != '\0'; ++i)
		hd44780_wr_data_noblock(line2[i]);
}
Esempio n. 4
0
int main(int argc, char **argv)
{

	uint32_t i;
	uint8_t accelRc, gyroRc;
	/* Configure the system clock */
	SystemClock_Config();

	HAL_Init();
	TerminalInit();  /* Initialize UART and USB */
	/* Configure the LEDs... */
	for(i=0; i<numLEDs; i++) {
		BSP_LED_Init(LEDs[i]);
	}

	/* Initialize the pushbutton */
	BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);

	/* Initialize the Accelerometer */
	accelRc = BSP_ACCELERO_Init();
	if(accelRc != ACCELERO_OK) {
		printf("Failed to initialize acceleromter\n");
		Error_Handler();
	}

	/* Initialize the Gyroscope */
	gyroRc = BSP_GYRO_Init();
	if(gyroRc != GYRO_OK) {
		printf("Failed to initialize Gyroscope\n");
		Error_Handler();
	}

	HD44780_Init();                       // lcd init 
	HD44780_PutStr("Hello World!");       
	hd44780_wr_cmd(0xC0); // to change curser to next line
	HD44780_PutStr("Hello Test !");       //print text


	while(1) {
		TaskInput();
	}

	return 0;
}
Esempio n. 5
0
void ws0010_Character_mode(){
	hd44780_wr_cmd (WS0010_GHARACTER_MODE_ON | WS0010_INTERNAL_POWER_ON);
}
Esempio n. 6
0
void ws0010_Graphics_mode(){
	hd44780_wr_cmd(WS0010_GRAPHICS_MODE_ON | WS0010_INTERNAL_POWER_ON);
}
Esempio n. 7
0
void hd44780_home() {
	currentPos = 0;
	if (!showingTemp)
		hd44780_wr_cmd(HD44780_CMD_RETURN_HOME);
}
Esempio n. 8
0
/*********************************************************************************************
Function name   : HD44780_ClrScr
Author 					: Grant Phillips
Date Modified   : 16/10/2013
Compiler        : Keil ARM-MDK (uVision V4.70.0.0)

Description			: Clears the display

Special Note(s) : NONE

Parameters			: NONE
Return value		: NONE
*********************************************************************************************/
void HD44780_ClrScr(void)
{
	hd44780_wr_cmd(HD44780_CMD_CLEAR);
}