/**
 * First init
 */
static void firstInit(void) {

	//Hardware init
	GPIO_init();
	USART1_init();//midi
	USART6_init();//debug
	usb_midi_init(); //Init everything for midiUSB

	ADC_init_all(); //ADC init
	SD_DMA_activate();
	//Display
	delayms(400);
#ifdef WS0010_GRAPHICS
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	ws0010_Graphics_mode();
	ws0010_Draw_buffer(pictureVMK188);
    delayms(20000);
	ws0010_Character_mode();
	hd44780_init();
#else
	hd44780_init();
	hd44780_display( HD44780_DISP_ON, HD44780_DISP_CURS_OFF, HD44780_DISP_BLINK_OFF);
	hd44780_message_center(APP_NAME, 1);
	hd44780_message_center(APP_VERSION, 2);
    delayms(3000);
#endif

}
Exemple #2
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);
}
Exemple #3
0
/*********************************************************************************************
Function name   : HD44780_Init
Author 					: Grant Phillips
Date Modified   : 16/10/2013
Compiler        : Keil ARM-MDK (uVision V4.70.0.0)

Description			: Initializes the HD44780 lcd module

Special Note(s) : NONE

Parameters			: NONE
Return value		: NONE
*********************************************************************************************/
void HD44780_Init(void)
{
    //GPIO Initialization
    GPIO_InitTypeDef GPIO_InitStruct;

    /* Configure the peripheral clocks for the HD44780 data and control lines */
    //RCC_AHBPeriphClockCmd(HD44780_RCC_AHBPeriph, ENABLE);
    __GPIOC_CLK_ENABLE();
    /* Configure the HD44780 Data lines (DB7 - DB4) as outputs*/
    GPIO_InitStruct.Pin = HD44780_DATABIT7 | HD44780_DATABIT6 | HD44780_DATABIT5 | HD44780_DATABIT4;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    GPIO_InitStruct.Alternate = 0;
    HAL_GPIO_Init(HD44780_DATAPORT, &GPIO_InitStruct);


    /* Configure the HD44780 Control lines (RS, RW, EN) as outputs*/
    GPIO_InitStruct.Pin = HD44780_RS_BIT | HD44780_RW_BIT | HD44780_EN_BIT;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    GPIO_InitStruct.Alternate = 0;
    HAL_GPIO_Init(HD44780_DATAPORT, &GPIO_InitStruct);

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

    /* wait initial delay for LCD to settle */
    /* reset procedure - 3 function calls resets the device */
    hd44780_init_delay();
    hd44780_wr_hi_nibble( HD44780_CMD_RESET );
    hd44780_init_delay2();
    hd44780_wr_hi_nibble( HD44780_CMD_RESET );
    hd44780_init_delay3();
    hd44780_wr_hi_nibble( HD44780_CMD_RESET );

#if HD44780_CONF_BUS == HD44780_FUNC_BUS_4BIT
    /* 4bit interface */
    hd44780_wr_hi_nibble( HD44780_CMD_FUNCTION );
#endif /* HD44780_CONF_BUS == HD44780_FUNC_BUS_4BIT */

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

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

    /* clear the display */
    hd44780_clear();

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

}