Пример #1
0
void hd44780_init(void) {
	while (buttons_active) {}

	hd44780_active=1;
	controlLEDs_enable(0);

	/* clear control bits */
	hd44780_EN_Off();
	hd44780_RS_Off();
//	hd44780_RW_Off();


	/* sets the configured values - can be set again only after reset */
	hd44780_function( HD44780_CONF_BUS, HD44780_CONF_LINES, HD44780_CONF_FONT, HD44780_FONT_TABLE);

	/* turn the display off with no cursor or blinking */
	hd44780_display( HD44780_DISP_OFF, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);

	/* clear the display */
	hd44780_clear();

	/* addr increment, shift cursor */
	hd44780_entry( HD44780_ENTRY_SHIFT_CURS, HD44780_ENTRY_ADDR_INC);

	hd44780_load_symbol(0x0, symbol_menu_pointer);
	hd44780_load_symbol(0x8, symbol_check);

	/*cursor to zero position*/
	hd44780_ddram_addr(0);

	hd44780_active=0;
	controlLEDs_enable(1);
}
Пример #2
0
void hd44780_goto_noblock(uint8_t line, uint8_t position) {
	while (buttons_active) {}

	hd44780_active = 1;
	controlLEDs_enable(0);
	hd44780_ddram_addr((0x40 * (line - 1)) + (position - 1));
	hd44780_active = 0;
	controlLEDs_enable(1);
}
Пример #3
0
void hd44780_write(uint8_t data) {
	while (buttons_active){
	}
	hd44780_active=1;
	controlLEDs_enable(0);

	/* set the data bits */
	uint16_t dataportValue = HD44780_DATAPORT->IDR;
	HD44780_DATAPORT->ODR = (dataportValue & 0xFF00) + data; //In the current project the display uses PE0-PE7 GPIO, so it is possible to switch them by one command

/*
	if (data & 0x01) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT0);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT0);
	}
	if (data & 0x02) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT1);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT1);
	}
	if (data & 0x04) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT2);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT2);
	}
	if (data & 0x08) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT3);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT3);
	}
	if (data & 0x10) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT4);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT4);
	}
	if (data & 0x20) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT5);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT5);
	}
	if (data & 0x40) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT6);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT6);
	}
	if (data & 0x80) {
		GPIO_SetBits(HD44780_DATAPORT, HD44780_DATABIT7);
	} else {
		GPIO_ResetBits(HD44780_DATAPORT, HD44780_DATABIT7);
	}
*/
	/* tell the lcd that we have a command to read in */hd44780_EN_On();

	/* wait long enough so that the lcd can see the command */hd44780_EN_high_delay();

	/* reset the ce line */hd44780_EN_Off();
	hd44780_init_end_delay();
	hd44780_active=0;
	controlLEDs_enable(1);
}
Пример #4
0
void controlLED2on(uint8_t on){
	controlLED2_state=on;
	controlLEDs_enable(controlLED1_state || controlLED2_state);
}