示例#1
0
/** 
 * @brief After you are done using the LCD you should terminate it properly. 
 * Failure to do so will guarantee that next time you use LCD it will be on 8 bit
 * mode... and you will must turn ON/OFF the screen.
 * @param selected_GPIOs[] initialized array of gpioID. 
 **/
void terminate_Screen(struct gpioID enabled_gpio[],int selectedPins[])
{
	int nbr_selectedPins=6;
	unsigned int data_to_write;

	//put the display back in 8 bit mode to allow to re-run program
	//E RS DB4 DB5 DB6 DB7 = 001100 (2) == 12 (10)
	data_to_write=12; 
	turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins);
	pulsePin(enabled_gpio,data_to_write,nbr_selectedPins, 5, CMD_DELAY);
  	usleep(CMD_DELAY);
	
 	//we should now tell the OS that we are done with the GPIOs
	cleanup_GPIO(enabled_gpio,selectedPins,nbr_selectedPins);
}
/** 
 * @brief After you are done using the LCD you should terminate it properly. 
 * Failure to do so will guarantee that next time you use LCD it will be on 8 bit
 * mode... and you will must turn ON/OFF the screen.
 * @param selected_GPIOs[] initialized array of gpioID. 
 **/
void terminate_Screen(struct gpioID enabled_gpio[],int selectedPins[])
{
	int nbr_selectedPins=6;
	const char *pinDescription[] = {"","","","","",""};
	unsigned int data_to_write;

	//put the display back in 8 bit mode to allow to re-run program
	//E RS DB4 DB5 DB6 DB7 = 001100 (2) == 12 (10)
	data_to_write=12; 
	turn_ON_OFF_pins(enabled_gpio,data_to_write,nbr_selectedPins,MAX_DELAY,pinDescription);
	pulsePin(enabled_gpio,data_to_write,nbr_selectedPins,DISPLAY_DATA_ON_SCREEN, pinDescription, 5, MAX_DELAY);
  	sleep(MAX_DELAY);
	
 	//we should now tell the OS that we are done with the GPIOs
	cleanup_GPIO(enabled_gpio,selectedPins,nbr_selectedPins);
}