//------------HotPotato_DrawStatus------------ // Draws p1 status elements on the top of the screen // Input: none // Output: none void HotPotato_DrawStatus(void){ ST7735_SetCursor(16, 1); LCD_OutDec(Characters[0].hp/hpDivisor); // Write hp status if(Characters[0].hp == 0){ // Write death status ST7735_SetCursor(6, 5); ST7735_OutString("You Dead."); Music_Stop(); } int temp=0; for(int i = 0; i<characterCount; i++) // get count on players alive @@@ TEMP ADD FOR CHECK OUT if(Characters[i].active){ temp++; } if(Characters[0].potato){ // Write "it" status ST7735_SetCursor(16, 2); ST7735_OutString("It!"); ST7735_DrawBitmap(110, 17, Sprite[smallPotato].array, 8,8); if(temp==1) { ST7735_SetCursor(6, 5); ST7735_OutString("You Win!"); // write win status Music_Stop(); Characters[0].hp++; } } else{ // Write "not-it" status ST7735_SetCursor(14, 2); ST7735_OutString("Not it"); } }
int main(void){ TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz Random_Init(1); Output_Init(); ST7735_FillScreen(0x0000); // set screen to black ST7735_DrawBitmap(52, 159, PlayerShip0, 18,8); // player ship middle bottom ST7735_DrawBitmap(53, 151, Bunker0, 18,5); ST7735_DrawBitmap(0, 9, SmallEnemy10pointA, 16,10); ST7735_DrawBitmap(20,9, SmallEnemy10pointB, 16,10); ST7735_DrawBitmap(40, 9, SmallEnemy20pointA, 16,10); ST7735_DrawBitmap(60, 9, SmallEnemy20pointB, 16,10); ST7735_DrawBitmap(80, 9, SmallEnemy30pointA, 16,10); ST7735_DrawBitmap(100, 9, SmallEnemy30pointB, 16,10); Delay100ms(50); // delay 5 sec at 80 MHz ST7735_FillScreen(0x0000); // set screen to black ST7735_SetCursor(1, 1); ST7735_OutString("GAME OVER"); ST7735_SetCursor(1, 2); ST7735_OutString("Nice try,"); ST7735_SetCursor(1, 3); ST7735_OutString("Earthling!"); ST7735_SetCursor(2, 4); LCD_OutDec(1234); while(1){ } }
int main2(void){ TExaS_Init(); // Bus clock is 80 MHz ADC_Init(); // turn on ADC, set channel to 1 PortF_Init(); ST7735_InitR(INITR_REDTAB); while(1){ // use scope to measure execution time for ADC_In and LCD_OutDec PF2 = 0x04; // Profile ADC Data = ADC_In(); // sample 12-bit channel 1 PF2 = 0x00; // end of ADC Profile ST7735_SetCursor(0,0); PF1 = 0x02; // Profile LCD LCD_OutDec(Data); ST7735_OutString(" "); // these spaces are used to coverup characters from last output PF1 = 0; // end of LCD Profile } }
//------------HotPotato_DrawStatus------------ // Draws p1 status elements on the top of the screen // Input: none // Output: none void HotPotato_DrawStatus(void){ ST7735_SetCursor(16, 1); LCD_OutDec(Characters[0].hp/2); // Write hp status if(Characters[0].hp == 0){ // Write death status ST7735_SetCursor(6, 5); ST7735_OutString("You Dead."); } if(Characters[0].potato){ // Write "it" status ST7735_SetCursor(16, 2); ST7735_OutString("It!"); ST7735_DrawBitmap(110, 16, Sprite[smallPotato].array, 8,8); } else{ // Write "not-it" status ST7735_SetCursor(14, 2); ST7735_OutString("Not it"); } }
int main(void){ TExaS_Init(); ST7735_InitR(INITR_REDTAB); PortF_Init(); ADC_Init(); // turn on ADC, set channel to 1 SysTick_Init(); // This makes things work // your Lab 8 while(1){ while(ADCStatus == 0){} Data = ADCMail; Position = Convert(Data); ST7735_SetCursor(0,0); LCD_OutDec(Data); ST7735_OutString(" "); ST7735_SetCursor(6,0); LCD_OutFix(Position); ADCStatus = 0; } }
int main3(void){ TExaS_Init(); // Bus clock is 80 MHz PortF_Init(); ADC_Init(); // turn on ADC, set channel to 1 ST7735_InitR(INITR_REDTAB); while(1){ PF2 ^= 0x04; // Heartbeat Data = ADC_In(); // sample 12-bit channel 1 PF3 = 0x08; // Profile Convert Position = Convert(Data); PF3 = 0; // end of Convert Profile PF1 = 0x02; // Profile LCD ST7735_SetCursor(0,0); LCD_OutDec(Data); ST7735_OutString(" "); ST7735_SetCursor(6,0); LCD_OutFix(Position); PF1 = 0; // end of LCD Profile } }
int main(void){ uint32_t DataTaken; uint32_t ConvData; TExaS_Init(); // Bus clock is 80 MHz PortF_Init(); ADC_Init(); // turn on ADC, set channel to 1 ST7735_InitR(INITR_REDTAB); SysTick_Init(); while(1){ if (ADCStatus == 1){ DataTaken = ADCMail; ADCStatus = 0; ConvData = Convert(DataTaken); ST7735_SetCursor(0,0); LCD_OutDec(DataTaken); ST7735_OutString(" "); ST7735_SetCursor(6,0); LCD_OutFix(ConvData); ST7735_OutString(" cm"); } } }