Definition in file et024006dhu_example.c.
#include "board.h"
#include "gpio.h"
#include "power_clocks_lib.h"
#include "et024006dhu.h"
#include "delay.h"
#include "avr32_logo.h"
Go to the source code of this file.
Functions | |
int | main (void) |
int main | ( | void | ) |
Definition at line 96 of file et024006dhu_example.c.
References avr32_logo, BLACK, BLUE, et024006_DrawFilledRect(), et024006_DrawHorizLine(), et024006_DrawLine(), et024006_DrawVertLine(), ET024006_HEIGHT, et024006_Init(), et024006_PrintString(), et024006_PutPixmap(), ET024006_WIDTH, FONT6x8, and FONT8x8.
00097 { 00098 U32 i; 00099 00100 // Set CPU and PBA clock 00101 pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP); 00102 00103 gpio_enable_gpio_pin(LED0_GPIO); 00104 gpio_enable_gpio_pin(LED1_GPIO); 00105 gpio_enable_gpio_pin(LED2_GPIO); 00106 gpio_enable_gpio_pin(LED3_GPIO); 00107 00108 delay_init(FOSC0); 00109 et024006_Init( FOSC0, FOSC0 ); 00110 00111 #if BOARD == EVK1105 00112 /* PWM is fed by PBA bus clock which is by default the same 00113 * as the CPU speed. We set a 0 duty cycle and thus keep the 00114 * display black*/ 00115 tft_bl_init(); 00116 #elif BOARD == EVK1104 || BOARD == UC3C_EK 00117 gpio_set_gpio_pin(ET024006DHU_BL_PIN); 00118 #endif 00119 00120 // Clear the display i.e. make it black 00121 et024006_DrawFilledRect(0 , 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK ); 00122 00123 // Draw the background AVR32 logo. 00124 et024006_PutPixmap(avr32_logo, 320, 0, 0, 0, 0, 320, 240); 00125 00126 // Display lines of colored squares. 00127 for( i=0 ; i<16 ; i++ ) 00128 { 00129 // From black to white. 00130 et024006_DrawFilledRect(20*i, 0, 20, 20, (2*i)/*B:5*/ | ((4*i)<<5)/*G:6*/ | ((2*i)<<11)/*R:5*/ ); 00131 // From black to blue. 00132 et024006_DrawFilledRect(20*i, 20, 20, 20, (2*i) /*B:5*/); 00133 // From black to green 00134 et024006_DrawFilledRect(20*i, 200, 20, 20, ((4*i)<<5) /*G:6*/); 00135 // From black to red 00136 et024006_DrawFilledRect(20*i, 220, 20, 20, ((2*i)<<11) /*R:5*/); 00137 } 00138 00139 00140 #if BOARD == EVK1105 00141 /* Lets do a nice fade in by increasing the duty cycle */ 00142 while(pwm_channel6.cdty < pwm_channel6.cprd) 00143 { 00144 pwm_channel6.cdty++; 00145 pwm_channel6.cupd = pwm_channel6.cdty; 00146 //pwm_channel6.cdty--; 00147 pwm_async_update_channel(AVR32_PWM_ENA_CHID6, &pwm_channel6); 00148 delay_ms(10); 00149 } 00150 #endif 00151 00152 // Display words. 00153 et024006_PrintString("AVR32", (const unsigned char *)&FONT6x8, 80, 50, BLUE, -1); 00154 et024006_PrintString("AVR32", (const unsigned char *)&FONT8x8, 80, 60, BLACK, -1); 00155 00156 // Draw a crossed square. 00157 et024006_DrawHorizLine(10, 50, 20, BLACK); 00158 et024006_DrawVertLine(10, 50, 20, BLACK); 00159 et024006_DrawHorizLine(10, 70, 20, BLACK); 00160 et024006_DrawVertLine(30, 50, 20, BLACK); 00161 et024006_DrawLine(10, 50, 30, 70, BLACK); 00162 et024006_DrawLine(30, 50, 10, 70, BLACK); 00163 00164 while(TRUE); 00165 }