📄 uilcd.c
字号:
// // Bring the HD66410 out of reset. // sUI.usLCDValue |= HwLCD_nRES; *pulPtr = sUI.usLCDValue; // // Set the index register to control register one. // LCDWriteIndex(LCD_REG_CONTROL1); // // Power on the HD66410. // LCDWriteData(LCD_CONTROL1_PWR); // // Configure the HD66410. // LCDWriteData(LCD_CONTROL1_PWR | LCD_CONTROL1_CNF);}//****************************************************************************//// LCDDisable shuts down the HD66410 and puts it into low power mode.////****************************************************************************static voidLCDDisable(void){ // // Turn off the display bit in the first control register. // LCDWriteIndex(LCD_REG_CONTROL1); LCDWriteData(LCD_CONTROL1_PWR | LCD_CONTROL1_CNF); // // Turn off the power bit in the first control register. // LCDWriteData(LCD_CONTROL1_CNF);}//****************************************************************************//// LCDOn turns on the LCD display.////****************************************************************************static voidLCDOn(void){ // // Turn on the display bit in the first control regiser. // LCDWriteIndex(LCD_REG_CONTROL1); LCDWriteData(LCD_CONTROL1_DISP | LCD_CONTROL1_PWR | LCD_CONTROL1_CNF);}//****************************************************************************//// LCDOff turns off the LCD display.////****************************************************************************static voidLCDOff(void){ // // Turn off the display bit in the first control regiser. // LCDWriteIndex(LCD_REG_CONTROL1); LCDWriteData(LCD_CONTROL1_PWR | LCD_CONTROL1_CNF);}//****************************************************************************//// LCDBacklightOn turns on the LCD backlighting.////****************************************************************************static voidLCDBacklightOn(void){ volatile unsigned long *pulPtr = (unsigned long *)HwLCDAddress; // // Turn on the backlight. // sUI.usLCDValue |= HwLCD_BL_EN; *pulPtr = sUI.usLCDValue;}//****************************************************************************//// LCDBacklightOff turns off the LCD backlighting.////****************************************************************************static voidLCDBacklightOff(void){ volatile unsigned long *pulPtr = (unsigned long *)HwLCDAddress; // // Turn on the backlight. // sUI.usLCDValue &= ~HwLCD_BL_EN; *pulPtr = sUI.usLCDValue;}//****************************************************************************//// Turns on and off the appropriate annunciators on the LCD based on the// current settings of the player.////****************************************************************************static voidLCDUpdateAnnunciators(void){ volatile unsigned long *pulPtr = (unsigned long *)HwBaseAddress; unsigned long ulStatus, ulAnnunc3 = 0, ulAnnunc5 = 0, ulAnnunc6 = 0; // // Read the system configuration register of the EP7209. // ulStatus = pulPtr[HwStatus >> 2]; // // Determine the current battery level. // switch(ulStatus & (HwStatusCts | HwStatusDsr | HwStatusDcd | HwStatusDcPresent)) { // // The battery level is >= 1.3V. // case HwStatusDcPresent: { // // Turn on the battery annunciator, as well as all three fillers. // ulAnnunc5 = LCD_ANNUNC5_BATTERY | LCD_ANNUNC5_BATTERY_FILL3 | LCD_ANNUNC5_BATTERY_FILL2 | LCD_ANNUNC5_BATTERY_FILL1; // // We're done handling this battery level. // break; } // // The battery level is >= 1.2V. // case (HwStatusDsr | HwStatusDcPresent): { // // Turn on the battery annunciator, as well as the first two // fillers. // ulAnnunc5 = LCD_ANNUNC5_BATTERY | LCD_ANNUNC5_BATTERY_FILL2 | LCD_ANNUNC5_BATTERY_FILL1; // // We're done handling this battery level. // break; } // // The battery level is >= 1.1V. // case (HwStatusDcd | HwStatusDsr | HwStatusDcPresent): { // // Turn on the battery annunciator, as well as the first filler. // ulAnnunc5 = LCD_ANNUNC5_BATTERY | LCD_ANNUNC5_BATTERY_FILL1; // // We're done handling this battery level. // break; } // // The battery level is >= 1.0V. // case (HwStatusCts | HwStatusDcd | HwStatusDsr | HwStatusDcPresent): { // // Turn on the battery annunciator. // ulAnnunc5 = LCD_ANNUNC5_BATTERY; // // We're done handling this battery level. // break; } // // The battery level is < 1.0V. // case (HwStatusCts | HwStatusDcd | HwStatusDsr): { // // Do not turn on any of the battery annunciators. // ulAnnunc5 = 0; // // We're done handling this battery level. // break; } } // // See if the repeat mode is set to repeat a single track. // if((ulSystemFlags & SYSFLAG_REPEAT_MASK) == SYSFLAG_REPEAT_ONE) { // // The repeat mode is set to single track, so turn on the repeat arrow // circles, as well as the single track annunciator. // ulAnnunc3 |= LCD_ANNUNC3_SINGLE | LCD_ANNUNC3_RIGHT_ARROWCIRCLE | LCD_ANNUNC3_LEFT_ARROWCIRCLE; } // // See if the repeat mode is set to repeat all tracks. // else if((ulSystemFlags & SYSFLAG_REPEAT_MASK) == SYSFLAG_REPEAT_ALL) { // // The repeat mode is set to all tracks, so turn on the repeat arrow // circles. // ulAnnunc3 |= LCD_ANNUNC3_RIGHT_ARROWCIRCLE | LCD_ANNUNC3_LEFT_ARROWCIRCLE; } // // Write the annunciator values to the LCD. // LCDWriteIndex(LCD_REG_ANNUNCIATOR3); LCDWriteData(ulAnnunc3); LCDWriteIndex(LCD_REG_ANNUNCIATOR5); LCDWriteData(ulAnnunc5); LCDWriteIndex(LCD_REG_ANNUNCIATOR6); LCDWriteData(ulAnnunc6);}//****************************************************************************//// LCDClear clears the LCD frame buffer.////****************************************************************************static voidLCDClear(unsigned long ulX, unsigned long ulY, unsigned long ulWidth, unsigned long ulHeight){ unsigned long ulDX, ulDY; // // Loop through the columns. // for(ulDX = 0; ulDX < ulWidth; ulDX++) { // // Set the column address. // LCDWriteIndex(LCD_REG_X); LCDWriteData(ulX + ulDX); // // Set the row address. // LCDWriteIndex(LCD_REG_Y); LCDWriteData(ulY); // // Select the data register. // LCDWriteIndex(LCD_REG_DATA); // // Loop through the rows in the image. // for(ulDY = 0; ulDY < ulHeight; ulDY++) { // // Write the next value to the LCD. // LCDWriteData(0); } }}//****************************************************************************//// LCDDisplayImage draws an image on the LCD. The image is organized in// column major order.////****************************************************************************static voidLCDDisplayImage(const unsigned char *pucData, unsigned long ulX, unsigned long ulY, unsigned long ulWidth, unsigned long ulHeight){ unsigned long ulDX, ulDY; // // Loop through the columns in the image. // for(ulDX = 0; ulDX < ulWidth; ulDX++) { // // Set the column address. // LCDWriteIndex(LCD_REG_X); LCDWriteData(ulX + ulDX); // // Set the row address. // LCDWriteIndex(LCD_REG_Y); LCDWriteData(ulY); // // Select the data register. // LCDWriteIndex(LCD_REG_DATA); // // Loop through the rows in the image. // for(ulDY = 0; ulDY < ulHeight; ulDY++) { // // Write the next value to the LCD. // LCDWriteData(*pucData++); } }}//****************************************************************************//// LCDStringLength determines the length of a string when drawn on the LCD.////****************************************************************************static unsigned longLCDStringLength(char *pcString, unsigned long bIsUnicode){ unsigned long ulWidth = 0; char cChar; // // While there are more characters in the string. // while(*pcString) { // // See if we are dealing with a Unicode string. // if(bIsUnicode) { // // See if the second byte of the character is non-zero, or if the // first byte is not a valid ASCII character. // if((pcString[1] != 0x00) || (pcString[0] < 0x1f) || (pcString[0] > '~')) { // // This is an un-representable Unicode character, so simply // display an underbar. // cChar = '_' - 0x1f; } else { // // This is a valid ASCII character, so display it. // cChar = *pcString - 0x1f; } // // Skip past this Unicode character. // pcString += 2; } else { // // Get the next character to be drawn. // cChar = *pcString++ - 0x1f; if(cChar >= sizeof(ucCharWidth)) { cChar = '_' - 0x1f; } } // // Increment the width of the string by the width of this character. //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -