/************************************************************************************************** * @fn HalLcdWriteString * * @brief Write a string to the LCD * * @param str - pointer to the string that will be displayed * option - display options * * @return None **************************************************************************************************/ void HalLcdWriteString ( char *str, uint8 option) { #if (HAL_LCD == TRUE) uint8 strLen = 0; uint8 totalLen = 0; uint8 *buf; uint8 tmpLen; if ( Lcd_Line1 == NULL ) { Lcd_Line1 = osal_mem_alloc( HAL_LCD_MAX_CHARS+1 ); HalLcdWriteString( "TexasInstruments", 1 ); } strLen = (uint8)osal_strlen( (char*)str ); /* Check boundries */ if ( strLen > HAL_LCD_MAX_CHARS ) strLen = HAL_LCD_MAX_CHARS; if ( option == HAL_LCD_LINE_1 ) { /* Line 1 gets saved for later */ osal_memcpy( Lcd_Line1, str, strLen ); Lcd_Line1[strLen] = '\0'; } else { /* Line 2 triggers action */ tmpLen = (uint8)osal_strlen( (char*)Lcd_Line1 ); totalLen = tmpLen + 1 + strLen + 1; buf = osal_mem_alloc( totalLen ); if ( buf != NULL ) { /* Concatenate strings */ osal_memcpy( buf, Lcd_Line1, tmpLen ); buf[tmpLen++] = ' '; osal_memcpy( &buf[tmpLen], str, strLen ); buf[tmpLen+strLen] = '\0'; /* Send it out */ #if defined (ZTOOL_P1) || defined (ZTOOL_P2) debug_str( (uint8*)buf ); #endif //ZTOOL_P1 /* Free mem */ osal_mem_free( buf ); } } /* Display the string */ HalLcd_HW_WriteLine (option, str); #endif //HAL_LCD }
/************************************************************************************************** * @fn HalLcdWriteString * * @brief Write a string to the LCD * * @param str - pointer to the string that will be displayed * line - line number to display * * @return None **************************************************************************************************/ void HalLcdWriteString ( char *str, uint8 line) { #if (HAL_LCD == TRUE) #if (defined HAL_IMG_AREA && (HAL_IMG_AREA == 3)) line += 4; #endif #if defined (ZTOOL_P1) || defined (ZTOOL_P2) #if defined (SERIAL_DEBUG_SUPPORTED) debug_str( (uint8*)str ); #endif #endif HalLcd_HW_WriteLine (str, line - 1); #endif }
/********************************************************************* * 函数名称:HalLcdWriteString * 功 能:写一串字符到LCD * 入口参数:str 被写入的字符串 * option 写入选项,这里指写入的行 * 出口参数:无 * 返 回 值:无 ********************************************************************/ void HalLcdWriteString(char *str, unsigned char option) { HalLcd_HW_WriteLine (option, str); }