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x1f, 0x00, 0x09, 0x1b, 0x1b,
0x1b, 0x1b, 0x1f, 0x0e, 0x00, 0x1c, 0x1e, 0x1b, 0x19, 0x18, 0x18, 0x18,
0x00, 0x0f, 0x1f, 0x19, 0x18, 0x18, 0x1f, 0x0f, 0x00, 0x0f, 0x1f, 0x19,
0x18, 0x18, 0x1f, 0x0f, 0x00, 0x0f, 0x1f, 0x18, 0x18, 0x18, 0x1f, 0x0f
};
//*****************************************************************************
//
// A set of flags used to track the state of the application.
//
//*****************************************************************************
unsigned long g_ulFlags;
//*****************************************************************************
//
// The current filtered value of the potentiometer.
//
//*****************************************************************************
unsigned long g_ulWheel;
//*****************************************************************************
//
// Storage for a local frame buffer.
//
//*****************************************************************************
unsigned char g_pucFrame[192];
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif
//*****************************************************************************
//
// The interrupt handler for the ADC interrupt.
//
//*****************************************************************************
void
ADCIntHandler(void)
{
unsigned long ulData;
//
// Clear the ADC interrupt.
//
ADCIntClear(ADC_BASE, 0);
//
// Read the data from the ADC.
//
ADCSequenceDataGet(ADC_BASE, 0, &ulData);
//
// Add the ADC data to the random number entropy pool.
//
RandomAddEntropy(ulData);
//
// Pass the ADC data through the low pass filter (with a coefficient of
// 0.9) to update the position of the potentiometer.
//
g_ulWheel = ((g_ulWheel * 58982) + (ulData * 6554)) / 65536;
//
// Read the push button.
//
ulData = GPIOPinRead(GPIO_PORTC_BASE, PUSH_BUTTON) ? 1 : 0;
//
// See if the push button state doesn't match the debounced push button
// state.
//
if(ulData != HWREGBITW(&g_ulFlags, FLAG_BUTTON))
{
//
// Increment the debounce counter.
//
HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_LOW) ^= 1;
if(!HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_LOW))
{
HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_HIGH) = 1;
}
//
// See if the debounce counter has reached three.
//
if(HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_LOW) &&
HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_HIGH))
{
//
// The button has been in the new state for three consecutive
// samples, so it has been debounced. Toggle the debounced state
// of the button.
//
HWREGBITW(&g_ulFlags, FLAG_BUTTON) ^= 1;
//
// If the button was just pressed, set the flag to indicate that
// fact.
//
if(HWREGBITW(&g_ulFlags, FLAG_BUTTON) == 0)
{
HWREGBITW(&g_ulFlags, FLAG_BUTTON_PRESS) = 1;
}
}
}
else
{
//
// Since the button state matches the debounced state, reset the
// debounce counter.
//
HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_LOW) = 0;
HWREGBITW(&g_ulFlags, FLAG_DEBOUNCE_HIGH) = 0;
}
//
// Increment the clock count.
//
HWREGBITW(&g_ulFlags, FLAG_CLOCK_COUNT_LOW) ^= 1;
if(!HWREGBITW(&g_ulFlags, FLAG_CLOCK_COUNT_LOW))
{
HWREGBITW(&g_ulFlags, FLAG_CLOCK_COUNT_HIGH) ^= 1;
}
//
// If the clock count has wrapped around to zero, then set a flag to
// indicate that the display needs to be updated.
//
if((HWREGBITW(&g_ulFlags, FLAG_CLOCK_COUNT_LOW) == 0) &&
(HWREGBITW(&g_ulFlags, FLAG_CLOCK_COUNT_HIGH) == 0))
{
HWREGBITW(&g_ulFlags, FLAG_UPDATE) = 1;
}
//
// Indicate that a timer interrupt has occurred.
//
HWREGBITW(&g_ulFlags, FLAG_CLOCK_TICK) = 1;
}
//*****************************************************************************
//
// Displays a logo for a specified amount of time.
//
//*****************************************************************************
static void
DisplayLogo(const unsigned char *pucLogo, unsigned long ulX,
unsigned long ulWidth, unsigned long ulDelay)
{
unsigned long ulLoop, ulBit;
//
// Loop over the sixteen scan lines of the display, scrolling the logo onto
// the display from the bottom by one scan line at a time.
//
for(ulBit = 1; ulBit <= 16; ulBit++)
{
//
// Clear the local frame buffer.
//
for(ulLoop = 0; ulLoop < 192; ulLoop += 4)
{
*(unsigned long *)(g_pucFrame + ulLoop) = 0;
}
//
// See if eight scan lines or less should be displayed.
//
if(ulBit <= 8)
{
//
// Loop over the columns of the logo.
//
for(ulLoop = 0; ulLoop < ulWidth; ulLoop++)
{
//
// Copy the specified number of scan lines from the first row
// of the logo to the second row of the local frame buffer.
//
g_pucFrame[ulX + ulLoop + 96] = pucLogo[ulLoop] << (8 - ulBit);
}
}
else
{
//
// Loop over the columns of the logo.
//
for(ulLoop = 0; ulLoop < ulWidth; ulLoop++)
{
//
// Copy N - 8 of the scan lines from the first row of the logo
// to the first row of the local frame buffer.
//
g_pucFrame[ulX + ulLoop] = pucLogo[ulLoop] << (16 - ulBit);
//
// Copy the remaining scan lines from the first row of the logo
// and N - 8 scan lines from the second row of the logo to the
// second row of the local frame buffer.
//
g_pucFrame[ulX + ulLoop + 96] =
((pucLogo[ulLoop] >> (ulBit - 8)) |
(pucLogo[ulLoop + ulWidth] << (16 - ulBit)));
}
}
//
// Display the local frame buffer on the display.
//
OSRAMImageDraw(g_pucFrame, 0, 0, 96, 2);
//
// Wait for a twentieth of a second.
//
for(ulLoop = 0; ulLoop < (CLOCK_RATE / 20); ulLoop++)
{
//
// Wait until a SysTick interrupt has occurred.
//
while(!HWREGBITW(&g_ulFlags, FLAG_CLOCK_TICK))
{
}
//
// Clear the SysTick interrupt flag.
//
HWREGBITW(&g_ulFlags, FLAG_CLOCK_TICK) = 0;
}
}
//
// Delay for the specified time while the logo is displayed.
//
for(ulLoop = 0; ulLoop < ulDelay; ulLoop++)
{
//
// Wait until a SysTick interrupt has occurred.
//
while(!HWREGBITW(&g_ulFlags, FLAG_CLOCK_TICK))
{
}
//
// Clear the SysTick interrupt flag.
//
HWREGBITW(&g_ulFlags, FLAG_CLOCK_TICK) = 0;
}
//
// Loop over the sixteen scan lines of the display, scrolling the logo off
// the display to the top by one scan line at a time.
//
for(ulBit = 1; ulBit <= 16; ulBit++)
{
//
// Clear the local frame buffer.
//
for(ulLoop = 0; ulLoop < 192; ulLoop += 4)
{
*(unsigned long *)(g_pucFrame + ulLoop) = 0;
}
//
// See if more than eight scan lines should be displayed.
//
if(ulBit <= 8)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -