test
This commit is contained in:
@@ -20,7 +20,7 @@ void lcd_hd44780_printf(lcd_hd44780_t *inst, char *string){
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
static void lcd_writeCmd_disp(lcd_hd44780_t *inst, hd44780_cmd_t cmd, hd44780_setGet_t getSet){
|
static void lcd_writeCmd_disp(cm_lcd_hd44780_t *inst, hd44780_cmd_t cmd, hd44780_setGet_t getSet){
|
||||||
|
|
||||||
inst->gpio_data.data_bus = cmd;
|
inst->gpio_data.data_bus = cmd;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ static void lcd_writeCmd_disp(lcd_hd44780_t *inst, hd44780_cmd_t cmd, hd44780_se
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_hd44780_initDisp(lcd_hd44780_t *inst){
|
void lcd_hd44780_initDisp_8bit(cm_lcd_hd44780_t *inst){
|
||||||
|
|
||||||
// Wait for more than 15ms after VCC rise..
|
// Wait for more than 15ms after VCC rise..
|
||||||
// Delay(15)
|
// Delay(15)
|
||||||
@@ -67,14 +67,29 @@ void lcd_hd44780_initDisp(lcd_hd44780_t *inst){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_hd44780_regGpioEvt(lcd_hd44780_t *inst, setGet_Gpio_Event_fpt getGpioEvt_fpt){
|
void lcd_hd44780_initDisp_4bit(cm_lcd_hd44780_t *inst){
|
||||||
|
|
||||||
|
// Wait for more than 15ms after VCC rise..
|
||||||
|
// Delay(15)
|
||||||
|
lcd_writeCmd_disp(inst, LCD_HD44780_FUNCTION_SET >> 4,LCD_HD44780_SET);
|
||||||
|
|
||||||
|
// Delay(4)
|
||||||
|
|
||||||
|
lcd_writeCmd_disp(inst, LCD_HD44780_FUNCTION_SET >> 4,LCD_HD44780_SET);
|
||||||
|
|
||||||
|
// Delay(4)
|
||||||
|
|
||||||
|
lcd_writeCmd_disp(inst, LCD_HD44780_FUNCTION_SET >> 4,LCD_HD44780_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_hd44780_regGpioEvt(cm_lcd_hd44780_t *inst, setGet_Gpio_Event_fpt getGpioEvt_fpt){
|
||||||
|
|
||||||
//if(inst == NULL)return;
|
//if(inst == NULL)return;
|
||||||
|
|
||||||
inst->setGetGpio_event = getGpioEvt_fpt;
|
inst->setGetGpio_event = getGpioEvt_fpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_hd44780_regWaitEvt(lcd_hd44780_t *inst, wait_ms_Event_fpt waitEvt_fpt){
|
void lcd_hd44780_regWaitEvt(cm_lcd_hd44780_t *inst, wait_ms_Event_fpt waitEvt_fpt){
|
||||||
|
|
||||||
//if(inst == NULL)return;
|
//if(inst == NULL)return;
|
||||||
|
|
||||||
@@ -82,7 +97,7 @@ void lcd_hd44780_regWaitEvt(lcd_hd44780_t *inst, wait_ms_Event_fpt waitEvt_fpt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lcd_hd44780_init(lcd_hd44780_t *inst, lcd_hd44780_bitmode bit_mode){
|
void lcd_hd44780_init(cm_lcd_hd44780_t *inst, lcd_hd44780_bitmode bit_mode){
|
||||||
|
|
||||||
//inst->gpio_data = 0x00;
|
//inst->gpio_data = 0x00;
|
||||||
inst->bit_mode = bit_mode;
|
inst->bit_mode = bit_mode;
|
||||||
@@ -94,10 +109,23 @@ void lcd_hd44780_init(lcd_hd44780_t *inst, lcd_hd44780_bitmode bit_mode){
|
|||||||
|
|
||||||
inst->setGetGpio_event(&(inst->gpio_data), 1);*/
|
inst->setGetGpio_event(&(inst->gpio_data), 1);*/
|
||||||
|
|
||||||
lcd_hd44780_initDisp(inst);
|
//lcd_hd44780_initDisp(inst);
|
||||||
//lcd_writeCmd_disp(inst,LCD_HD44780_CLEAR_DISP,LCD_HD44780_SET);
|
//lcd_writeCmd_disp(inst,LCD_HD44780_CLEAR_DISP,LCD_HD44780_SET);
|
||||||
//lcd_writeCmd_disp(inst,LCD_HD44780_DISP_ONOFF_CTL,LCD_HD44780_SET);
|
//lcd_writeCmd_disp(inst,LCD_HD44780_DISP_ONOFF_CTL,LCD_HD44780_SET);
|
||||||
|
|
||||||
|
switch (inst->bit_mode) {
|
||||||
|
case LCD_BITMODE_8BIT:
|
||||||
|
lcd_hd44780_initDisp_8bit(inst);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LCD_BITMODE_4BIT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ typedef struct{
|
|||||||
hd44780_gpioset_t gpio_data;
|
hd44780_gpioset_t gpio_data;
|
||||||
|
|
||||||
|
|
||||||
}lcd_hd44780_t;
|
}cm_lcd_hd44780_t;
|
||||||
|
|
||||||
|
|
||||||
void lcd_hd44780_init(lcd_hd44780_t *inst,lcd_hd44780_bitmode bit_mode);
|
void lcd_hd44780_init(cm_lcd_hd44780_t *inst,lcd_hd44780_bitmode bit_mode);
|
||||||
void lcd_hd44780_regGpioEvt(lcd_hd44780_t *inst, setGet_Gpio_Event_fpt getGpioEvt_fpt);
|
void lcd_hd44780_regGpioEvt(cm_lcd_hd44780_t *inst, setGet_Gpio_Event_fpt getGpioEvt_fpt);
|
||||||
void lcd_hd44780_regWaitEvt(lcd_hd44780_t *inst, wait_ms_Event_fpt waitEvt_fpt);
|
void lcd_hd44780_regWaitEvt(cm_lcd_hd44780_t *inst, wait_ms_Event_fpt waitEvt_fpt);
|
||||||
|
|
||||||
#endif /*LCD_HD44780_H_*/
|
#endif /*LCD_HD44780_H_*/
|
||||||
|
|||||||
Reference in New Issue
Block a user