视频演示:
http://player.youku.com/player.php/sid/XNDcyMDgwMTE2/v.swf
源码下载:程序部分源码:
/**
* @brief LCD显示红色和绿色柱
* @param RedNewHeight 红色柱子高度列表
* @param GreenNewHeight 绿色柱子高度列表
* @retval None
*/
void music_fft_main(uint8_t *RedNewHeight,uint8_t *GreenNewHeight)
{
int BarWidth = 8;
int i=0;
static uint8_t RedOldHeight[32] = {0};
static uint8_t GreenOldHeight[32] = {0};
for(i=0;i<32;i++){
//清除之前的绿色方块
//LCD_COLOR = LCD_COLOR_BLACK;
ARC_LCD_FillRect(GreenOldHeight[i],(BarWidth+2)*i,GreenOldHeight[i]+3,(BarWidth+2)*i+BarWidth,LCD_COLOR_BLACK);
//显示当前的绿色方块
ARC_LCD_FillRect(GreenNewHeight[i],(BarWidth+2)*i,GreenNewHeight[i]+3,(BarWidth+2)*i+BarWidth,LCD_COLOR_GREEN);
//显示红色柱
if(RedNewHeight[i]>RedOldHeight[i]){//如果当前的绿色柱子高度比之前的大则补齐绿色柱子
ARC_LCD_FillRect(RedOldHeight[i],(BarWidth+2)*i,RedNewHeight[i],(BarWidth+2)*i+BarWidth,LCD_COLOR_RED);
}else{//如果当前显示的绿色柱子高度小于之前的柱子则需要将多余的绿色柱子用背景色填充
ARC_LCD_FillRect(RedNewHeight[i],(BarWidth+2)*i,RedOldHeight[i],(BarWidth+2)*i+BarWidth,LCD_COLOR_BLACK);
}
//将新数据保存
RedOldHeight[i] = RedNewHeight[i];
GreenOldHeight[i] = GreenNewHeight[i];
}
}