// ***************************************************************************** // Function Name : main // Description : Main program. // Input : None // Output : None // Return : None // ***************************************************************************** int main(void) { #ifdef DEBUG debug(); #endif int i,j; WINDOW * wnd; BUTTON * btn; GOL_SCHEME *pScheme; // System clock configuration RCC_Configuration(); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); // Nested Vector Interrupt Controller configuration NVIC_Configuration(); LCD_GPIO_Configuration(); FSMC_LCD_Init(); USART1_Init(); ILI9325_Init(); ILI9325_VerticalScreen(); ILI9325_GRAMOperation(); //Tell ILI9325 that I'm now starting to write GRAM. for(i=0;i<240;i++) { for(j=0;j<320;j++) { unsigned int n=i*320+j; if(n<25600) { ILI9325_WriteWDR(n); } else if(n<51200) { ILI9325_WriteWDR(n); } else if(n<76800) { ILI9325_WriteWDR(0xf800); } } } ILI9325_FillWindowArea(10,10,100,100,0x001f); pScheme = GOLCreateScheme(); wnd=WndCreate(0, // ID 0,0,GetMaxX(),GetMaxY(), // whole screen dimension WND_DRAW, // set state to draw all NULL, // icon "Place Title Here.", // text pScheme); // use default GOL scheme WndDraw(wnd); btn=BtnCreate(1,20,64,50,118,0, BTN_DRAW, NULL, "ON", pScheme); BtnDraw(btn); while(1) { } }
/********************************************************************* * Function: WORD GOLDraw() * * PreCondition: none * * Input: none * * Output: non-zero if drawing is complete * * Side Effects: none * * Overview: redraws objects in the current linked list * * Note: none * ********************************************************************/ WORD GOLDraw(){ static OBJ_HEADER *pCurrentObj = NULL; SHORT done; if(pCurrentObj == NULL){ if(GOLDrawCallback()){ // It's last object jump to head pCurrentObj = _pGolObjects; }else{ return 0; // drawing is not done } } done = 0; while(pCurrentObj != NULL){ if(IsObjUpdated(pCurrentObj)){ switch(pCurrentObj->type){ #ifdef USE_BUTTON case OBJ_BUTTON: done = BtnDraw((BUTTON*)pCurrentObj); //***********************************************// // TouchGetX(); // TouchGetY(); //**************************************************// break; #endif #ifdef USE_WINDOW case OBJ_WINDOW: done = WndDraw((WINDOW*)pCurrentObj); break; #endif #ifdef USE_CHECKBOX case OBJ_CHECKBOX: done = CbDraw((CHECKBOX*)pCurrentObj); break; #endif #ifdef USE_RADIOBUTTON case OBJ_RADIOBUTTON: done = RbDraw((RADIOBUTTON*)pCurrentObj); break; #endif #ifdef USE_EDITBOX case OBJ_EDITBOX: done = EbDraw((EDITBOX*)pCurrentObj); break; #endif #ifdef USE_LISTBOX case OBJ_LISTBOX: done = LbDraw((LISTBOX*)pCurrentObj); break; #endif #ifdef USE_SLIDER case OBJ_SLIDER: done = SldDraw((SLIDER*)pCurrentObj); break; #endif #ifdef USE_PROGRESSBAR case OBJ_PROGRESSBAR: done = PbDraw((PROGRESSBAR*)pCurrentObj); break; #endif #ifdef USE_STATICTEXT case OBJ_STATICTEXT: done = StDraw((STATICTEXT*)pCurrentObj); break; #endif #ifdef USE_PICTURE case OBJ_PICTURE: done = PictDraw((PICTURE*)pCurrentObj); break; #endif #ifdef USE_GROUPBOX case OBJ_GROUPBOX: done = GbDraw((GROUPBOX*)pCurrentObj); break; #endif #ifdef USE_ROUNDDIAL case OBJ_ROUNDDIAL: done = RdiaDraw((ROUNDDIAL*)pCurrentObj); break; #endif #ifdef USE_METER case OBJ_METER: done = MtrDraw((METER*)pCurrentObj); break; #endif #ifdef USE_CUSTOM case OBJ_CUSTOM: done = CcDraw((CUSTOM*)pCurrentObj); break; #endif #ifdef USE_GRID case OBJ_GRID: done = GridDraw( (GRID *)pCurrentObj ); break; #endif default: break; } if(done){ GOLDrawComplete(pCurrentObj); }else{ return 0; // drawing is not done } } pCurrentObj = pCurrentObj->pNxtObj; } return 1; // drawing is completed }