⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uilcd.c

📁 基于EP7312的MP3播放器源代码,包括MCU和PC端代码.
💻 C
📖 第 1 页 / 共 5 页
字号:
    //    unsigned long ulSpatializerState;#endif} sUI;//****************************************************************************//// The list of items in the menu.////****************************************************************************static char * const pcMenu = "Repeat\0"#if defined(SUPPORT_SRS) || defined(SUPPORT_QSOUND) || \    defined(SUPPORT_SPATIALIZER)                             "Effects\0"#endif#if defined(SUPPORT_WOW_FULL) || defined(SUPPORT_WOW_MINIMAL)                             "\200 WOW\0"#endif#if defined(SUPPORT_WOW_FULL) || defined(SUPPORT_WOW_MINIMAL) || \    defined(SUPPORT_TRU_BASS)                             "\200 TruBass\0"#endif#ifdef SUPPORT_SRS_HEADPHONE                             "\200 SRS\0"#endif#ifdef SUPPORT_QSOUND                             "\201 Q2X\0"                             "\201 Q2X Mode\0"#endif#ifdef SUPPORT_SPATIALIZER                             "\202 Bass\0"                             "\202 Vi.B.E.\0"                             "\202 Gain\0"#endif                             "\177 Treble\0"                             "\177 Bass\0"                             "Backlight\0"                             "Sleep\0"                             "Visual\0"                             "Clock\0"                             "Version\0"                             "Codecs\0"                             "Geek Info\0";//****************************************************************************//// Prototypes for the functions used to display the various menu controls, as// well as to update the player settings based on the value of a menu item.////****************************************************************************static void DisplayStringRing(unsigned long ulIndex);static void DisplayDecibleSlider(unsigned long ulIndex);#if defined(SUPPORT_SRS) || defined(SUPPORT_QSOUND) || \    defined(SUPPORT_SPATIALIZER)static void DisplayValueSlider(unsigned long ulIndex);#endifstatic void DisplayClock(unsigned long ulIndex);static void DisplayCodecs(unsigned long ulIndex);static void DisplayGeekInfo(unsigned long ulIndex);static void UpdateRepeat(long lValue);#if defined(SUPPORT_SRS) || defined(SUPPORT_QSOUND) || \    defined(SUPPORT_SPATIALIZER)static void UpdateEffects(long lValue);#endifstatic void UpdateBacklight(long lValue);static void UpdateVisual(long lValue);//****************************************************************************//// Descriptions of the items in the menu.  The order of the items here must// match the order of the menu items in pcMenu.////****************************************************************************static const struct{    //    // The routine which draws the menu value on the LCD.    //    void (*pfnDisplay)(unsigned long ulIndex);    //    // The routine which updates the player state based on a change in the    // menu item value.    //    void (*pfnUpdate)(long lValue);    //    // The string of values for string rings.    //    char *pcValues;    //    // The number of values in the string ring, or the number of steps in the    // decible slider.    //    unsigned long ulNumValues;    //    // A pointer to the unsigned long which contains the flags for this menu    // item.    //    unsigned long *pulFlags;    //    // The bitmask of the bits in the flags which should be modified when this    // menu item is changed.    //    unsigned long ulFlagMask;    //    // The number of bits to shift to get to the bit field for this menu item.    //    unsigned long ulFlagShift;} sMenuItems[] ={    //    // The "Repeat" menu item.    //    { DisplayStringRing, UpdateRepeat,      "Repeat off\0Repeat one track\0Repeat all tracks", 3,      (unsigned long *)&ulSystemFlags, SYSFLAG_REPEAT_MASK,      SYSFLAG_REPEAT_SHIFT },#if defined(SUPPORT_SRS) || defined(SUPPORT_QSOUND) || \    defined(SUPPORT_SPATIALIZER)    //    // The "Effects" menu item.    //    { DisplayStringRing, UpdateEffects,#ifdef SUPPORT_SRS#ifdef SUPPORT_QSOUND#ifdef SUPPORT_SPATIALIZER      "None\0SRS\0QSound\0Spatializer", 4,#else      "None\0SRS\0QSound", 3,#endif#else#ifdef SUPPORT_SPATIALIZER      "None\0SRS\0Spatializer", 3,#else      "None\0SRS", 2,#endif#endif#else#ifdef SUPPORT_QSOUND#ifdef SUPPORT_SPATIALIZER      "None\0QSound\0Spatializer", 3,#else      "None\0QSound", 2,#endif#else      "None\0Spatializer", 2,#endif#endif      &sUI.ulFlags, FLAG_EFFECT_MASK, FLAG_EFFECT_SHIFT },#endif#if defined(SUPPORT_WOW_FULL) || defined(SUPPORT_WOW_MINIMAL)    //    // The "WOW" menu item.    //    { DisplayValueSlider, OutputSetSRSWidth, 0, 21, &sUI.ulSRSState,      FLAG_SRS_WIDTH_MASK, FLAG_SRS_WIDTH_SHIFT },#endif#if defined(SUPPORT_WOW_FULL) || defined(SUPPORT_WOW_MINIMAL) || \    defined(SUPPORT_TRU_BASS)    //    // The "TruBass" menu item.    //    { DisplayValueSlider, OutputSetSRSTruBass, 0, 21, &sUI.ulSRSState,      FLAG_SRS_TRU_BASS_MASK, FLAG_SRS_TRU_BASS_SHIFT },#endif#ifdef SUPPORT_SRS_HEADPHONE    //    // The "SRS" menu item.    //    { DisplayValueSlider, OutputSetSRSWidth, 0, 21, &sUI.ulSRSState,      FLAG_SRS_WIDTH_MASK, FLAG_SRS_WIDTH_SHIFT },#endif#ifdef SUPPORT_QSOUND    //    // The "Q2X" menu item.    //    { DisplayValueSlider, OutputSetQSoundWidth, 0, 21, &sUI.ulQSoundState,      FLAG_QSOUND_WIDTH_MASK, FLAG_QSOUND_WIDTH_SHIFT },    //    // The "Q2X Mode" menu item.    //    { DisplayStringRing, OutputSetQSoundMode, "Mode 0\0Mode 1", 2,      &sUI.ulQSoundState, FLAG_QSOUND_MODE_MASK, FLAG_QSOUND_MODE_SHIFT },#endif#ifdef SUPPORT_SPATIALIZER    //    // The "Bass" menu item.    //    { DisplayValueSlider, OutputSetSpatializerBass, 0, 21,      &sUI.ulSpatializerState, FLAG_SPATIALIZER_BASS_MASK,      FLAG_SPATIALIZER_BASS_SHIFT },    //    // The "Vi.B.E." menu item.    //    { DisplayValueSlider, OutputSetSpatializerVirtualBass, 0, 21,      &sUI.ulSpatializerState, FLAG_SPATIALIZER_VBASS_MASK,      FLAG_SPATIALIZER_VBASS_SHIFT },    //    // The "Gain" menu item.    //    { DisplayValueSlider, OutputSetSpatializerGain, 0, 21,      &sUI.ulSpatializerState, FLAG_SPATIALIZER_GAIN_MASK,      FLAG_SPATIALIZER_GAIN_SHIFT },#endif    //    // The "Treble" menu item.    //    { DisplayDecibleSlider, OutputSetTreble, 0, 13, &sUI.ulFlags,      FLAG_TREBLE_BOOST_MASK, FLAG_TREBLE_BOOST_SHIFT },    //    // The "Bass" menu item.    //    { DisplayDecibleSlider, OutputSetBass, 0, 13, &sUI.ulFlags,      FLAG_BASS_BOOST_MASK, FLAG_BASS_BOOST_SHIFT },    //    // The "Backlight" menu item.    //    { DisplayStringRing, UpdateBacklight,      "Always off\0On 5 seconds\0On 10 seconds\0Always on", 4, &sUI.ulFlags,      FLAG_BACKLIGHT_MASK, FLAG_BACKLIGHT_SHIFT },    //    // The "Sleep" menu item.    //    { DisplayStringRing, 0,      "After 1 minute\0After 2 minutes\0After 3 minutes\0After 4 minutes",      4, &sUI.ulFlags, FLAG_SLEEP_MASK, FLAG_SLEEP_SHIFT },    //    // The "Visual" menu item.    //    { DisplayStringRing, UpdateVisual,#ifdef SUPPORT_SPECTRUM_ANALYZER      "None\0Waveform\0Spectrum", 3,#else      "None\0Waveform", 2,#endif      &sUI.ulFlags, FLAG_VISUAL_MODE_MASK, FLAG_VISUAL_MODE_SHIFT },    //    // The "Clock" menu item.    //    { DisplayClock, 0, 0, 1, 0, 0 },    //    // The "Version" menu item.    //    { DisplayStringRing, 0, "Release 16", 1, 0, 0 },    //    // The "Codecs" menu item.    //    { DisplayCodecs, 0, 0, 1, 0, 0 },    //    // The "Geek Info" menu item.    //    { DisplayGeekInfo, 0, 0, 1, 0, 0 },    //    // The end of menu indicator.    //    { 0, 0, 0, 0, 0, 0 }};//****************************************************************************//// The number of clock ticks (which runs at 50Hz) that each button must be// pressed for the hold function to occur instead of the press function (i.e.// skipping forward within a song instead of advancing to the next song).////****************************************************************************static const unsigned char ucHoldTimesMain[8] = { POWER_DELAY,                                                  0,#ifdef REQUIRE_LOOPBACK                                                  RECORD_DELAY,#else                                                  0,#endif                                                  SEEK_DELAY,                                                  SEEK_DELAY,                                                  VOLUME_DELAY,                                                  RECORD_DELAY,                                                  VOLUME_DELAY };static const unsigned char ucHoldTimesMenu[8] = { POWER_DELAY,                                                  MENU_DELAY,                                                  MENU_DELAY,                                                  MENU_DELAY,                                                  MENU_DELAY,                                                  VOLUME_DELAY,                                                  0,                                                  VOLUME_DELAY };//****************************************************************************//// LCDWriteIndex writes the given register value to the index register of the// HD66410.////****************************************************************************static voidLCDWriteIndex(unsigned long ulIndex){    volatile unsigned long *pulPtr = (unsigned long *)HwLCDAddress;    //    // Assert nCS, set RS low, and write the index value.    //    sUI.usLCDValue &= ~(HwLCD_nCS | HwLCD_RS | HwLCD_Data);    sUI.usLCDValue |= ulIndex;    *pulPtr = sUI.usLCDValue;    //    // Assert nWR.    //    sUI.usLCDValue &= ~HwLCD_nWR;    *pulPtr = sUI.usLCDValue;    //    // De-assert nWR.    //    sUI.usLCDValue |= HwLCD_nWR;    *pulPtr = sUI.usLCDValue;    //    // De-assert nCS.    //    sUI.usLCDValue |= HwLCD_nCS;    *pulPtr = sUI.usLCDValue;}//****************************************************************************//// LCDWriteData writes the given value to the data register of the HD66410.////****************************************************************************static voidLCDWriteData(unsigned long ulValue){    volatile unsigned long *pulPtr = (unsigned long *)HwLCDAddress;    //    // Assert nCS, set RS high, and write the value.    //    sUI.usLCDValue &= ~(HwLCD_nCS | HwLCD_Data);    sUI.usLCDValue |= HwLCD_RS | ulValue;    *pulPtr = sUI.usLCDValue;    //    // Assert nWR.    //    sUI.usLCDValue &= ~HwLCD_nWR;    *pulPtr = sUI.usLCDValue;    //    // De-assert nWR.    //    sUI.usLCDValue |= HwLCD_nWR;    *pulPtr = sUI.usLCDValue;    //    // De-assert nCS.    //    sUI.usLCDValue |= HwLCD_nCS;    *pulPtr = sUI.usLCDValue;}//****************************************************************************//// LCDEnable resets the HD66410, brings it out of low power mode, and// configures it for operation.////****************************************************************************static voidLCDEnable(void){    volatile unsigned long *pulPtr = (unsigned long *)HwLCDAddress;    long lCount;    //    // Reset the HD66410.    //    sUI.usLCDValue = HwLCD_nCS | HwLCD_nWR | HwLCD_nRD;    *pulPtr = sUI.usLCDValue;    //    // Delay for 1ms.    //    for(lCount = 0; lCount < 49152; lCount++)    {    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -