Beispiel #1
0
void ram(void) {
  board_t b;

  board_init(&b, 4, 4, 0);

  const int anim_N = 10;

  do {
    if (b.menu_active) {
      lcdFill(0x00);
      board_menu_draw(&b);
      lcdDisplay();
    }
    else {
      for (int anim_i = 1; anim_i <= anim_N; anim_i ++) {
        lcdFill(0x00);
        board_draw(&b, anim_i, anim_N);
        lcdDisplay();
      }

      board_drop_new_value(&b);

      lcdFill(0x00);
      board_draw(&b, anim_N, anim_N);
      lcdDisplay();
    }

  } while(board_handle_input(&b));

  setTextColor(0xFF,0x00);
  return;
}
Beispiel #2
0
void ram() {
  char *nick = "Pentagon V1LLAG3";
  char nickbuf[32];  // 16?

  do {
    lcdFill(0);
    DoString(0, 0, "Getting");
    lcdDisplay();
    uint32_t score = highscore_get(nickbuf);

    gpioSetValue (RB_LED2, 1);
    lcdFill(0);
    DoString(0, 0, "Highscore:");
    DoString(0, 16, nickbuf);
    DoInt(0, 32, score);
    lcdDisplay();

    if (strcmp(nick, nickbuf) != 0) {
      lcdFill(0);
      DoString(0, 48, "Setting");
      lcdDisplay();
      delayms_queue(500);
      highscore_set(score+1, nick);
    }

  } while(getInputWaitTimeout(500) != BTN_UP);

}
Beispiel #3
0
void ram(void) {
	while(1) {
		if (!screen_intro()){
      setTextColor(0xff,0x00);
      return;
    }
		game.rokets = 3;
		game.level = 1;
		game.score = 0;
		init_game();
		screen_level();
		while (game.rokets>=0) {
			////checkISP();
			lcdFill(0x00);
			check_end();
			move_ufo();
			move_shot();
			move_shots();
			move_player();
			move_enemy();
			draw_score();
			draw_ufo();
			draw_bunker();
			draw_player();
			draw_enemy();
			draw_shots();
			//        draw_status();
			lcdDisplay();
			delayms(12);
		}
		if (!screen_gameover())
      setTextColor(0xff,0x00);
      return;
	}
}
Beispiel #4
0
void ram(void) {

	splash_scene();

	long frame_count = 0;
	init_game();

	while(1) {
		frame_count++;

		lcdFill(0);
		update_platforms(frame_count);
		move_player(frame_count);
		draw_platforms();
		draw_player();
		draw_hud();
		blink_led();
		lcdDisplay();

		if(!game.running) {
			if(!gameover_scene()){
                delayms_queue_plus(10,1);
				return;
            }
			init_game();
		}
        delayms_queue_plus(24,0);
	}
}
Beispiel #5
0
int main(void) {
	cpuClockInit(); /* CPU Clock is now 104 MHz */
	ssp_clock_init();
	systickInit();

//	cpu_clock_set(204);

	SETUPgout(EN_VDD);
	SETUPgout(MIXER_EN);
	SETUPgout(MIC_AMP_DIS);

	SETUPgout(LED1);
	SETUPgout(LED2);
	SETUPgout(LED3);
	SETUPgout(LED4);

	inputInit();
	lcdInit();
	fsInit(); 
	lcdFill(0xff);
	readConfig();

	generated_init();

	while(1) {
        handleMenu(&menu_main);
        getInputWaitRelease();
	}
	return 0;
}
Beispiel #6
0
int main(void) {
    cpu_clock_init(); /* CPU Clock is now 104 MHz */
    ssp_clock_init();
    systickInit();

    SETUPgout(EN_VDD);
    SETUPgout(MIXER_EN);
    SETUPgout(MIC_AMP_DIS);

    SETUPgout(LED1);
    SETUPgout(LED2);
    SETUPgout(LED3);
    SETUPgout(LED4);

    inputInit();
    lcdInit();
    lcdFill(0xff);
    lcdPrintln("Flash-App");
    lcdNl();
    lcdDisplay();

    cpld_flash();
    cpu_clock_set(50);
    full_msc();

    return 0;
}
Beispiel #7
0
static bool screen_intro() {
	uint32_t highscore;
	char highnick[20];
	char key=0;
	bool step = false;
	//getInputWaitRelease();
	while(key==0) {
		getInputWaitRelease();
		lcdFill(0);
		font = &Font_Invaders;
        DoString(28,25,step?"ABC":"abc");
		font = &Font_7x8;
		DoString (28,40,"SPACE");
		DoString (18,50,"INVADERS");
		
		highscore = highscore_get(highnick);
		DoInt(0, 0, highscore);
		DoString (0, 9, highnick);
		lcdDisplay();
		step = !step;
		key=getInputWaitTimeout(1000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}
Beispiel #8
0
static bool screen_intro() {
	uint32_t highscore;
	char highnick[20];
	char key=0;
	bool step = false;
	//getInputWaitRelease();
	while(key==0) {
		getInputWaitRelease();
		lcdFill(0x00);
		setIntFont(&Font_Invaders);
    setTextColor(0x00,0b11100000);
    lcdSetCrsr(28+18,25+15);lcdPrint(step?"ABC":"abc");
		setIntFont(&Font_7x8);
    setTextColor(0x00,0b00011000);
		lcdSetCrsr(28+18,40+15);lcdPrint("SPACE");
    setTextColor(0x00,0b11111000);
		lcdSetCrsr(18+18,50+15);lcdPrint("INVADERS");

		highscore = highscore_get(highnick);
    setTextColor(0x00,0xff);
		lcdSetCrsr(0,0);lcdPrint(IntToStr(highscore,6,F_LONG));
//		lcdSetCrsr(0,9);lcdPrint(highnick);
		lcdDisplay();
		step = !step;
		key=getInputWaitTimeout(1000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}
Beispiel #9
0
Datei: anim.c Projekt: hwhw/r0ket
void ram(void) {
	FRESULT ret;
	FATFS FatFs[1];          /* File system object for logical drive */

	//gpioSetValue (RB_LED1, CFG_LED_OFF); 
	//backlightInit();
	//
	lcdFill(0);

	ret=f_mount(0, &FatFs[0]);
	
	if(ret) {
		return;
	}

//	lcdLoadLZOImage("TESTLZO.ILZ");
//	lcdDisplay();
	ret = lcdShowLZOAnim("LZOANIM.VLZ", 80);
#ifdef SIMULAT0R
	fprintf(stderr, "ret=%d\n", ret);
#endif
	while(!getInputRaw()){
		/* nothing Yet */
            getInputWaitTimeout(1000);
	}
	return;
}
Beispiel #10
0
static void splash_scene() {
	uint32_t highscore;
	char highnick[20];

	char key = 0;
	while(key == 0) {
		getInputWaitRelease();

		int dy = getFontHeight();
		int s1x = DoString(0, 0, "r0ket");
		s1x = (RESX-s1x)/2;
		int s2x = DoString(0, 0, "JUMP!");
		s2x = (RESX-s2x)/2;

		lcdFill(0);
		
		DoString(s1x, 3*dy, "r0ket");
		DoString(s2x, 4*dy, "JUMP!");
		DoString(0, 7*dy, "by webholics");

		highscore = highscore_get(highnick);

		int s3x = DoInt(0, 0, highscore);
		DoChar(s3x, 0, 'm');
		DoString (0, dy, highnick);

		lcdDisplay();

		key = getInputWaitTimeout(1000);
	}
}
Beispiel #11
0
static void screen_level() {
	lcdFill(0);
	draw_score();
	font = &Font_7x8;
	int dx = DoString(20,32, "Level ");
	DoInt(dx,32,game.level);
	lcdDisplay();
	delayms_queue(500);
}
Beispiel #12
0
void ram() {
  char key;
  int x = 0;
  for(key = 0; key = getInputRaw(), key != BTN_DOWN; ) {
    x = (x + 1) % 64;
    lcdFill(0);
    DoString(x, 0, "scr0llr");
    lcdDisplay();
    delayms_queue(20);
  }
}
Beispiel #13
0
static void screen_level() {
	lcdFill(0x00);
	draw_score();
	setIntFont(&Font_7x8);
	lcdSetCrsr(20,32);
  setTextColor(0x00,0xff);
	lcdPrint("Level ");
	lcdPrint(IntToStr(game.level,3,0));
	lcdDisplay();
	delayms_queue(500);
}
Beispiel #14
0
int main(uint32_t startloc) {
	cpu_clock_init();
	ssp_clock_init();
	systickInit();

//	cpu_clock_set(204);

	SETUPgout(EN_VDD);
	SETUPgout(MIXER_EN);
	SETUPgout(MIC_AMP_DIS);

	SETUPgout(LED1);
	SETUPgout(LED2);
	SETUPgout(LED3);
	SETUPgout(LED4);
	inputInit();
	flashInit();

	lcdInit();
	fsInit();
	lcdFill(0xff); /* Display BL Image here */

	sli=startloc;

	if (startloc != (uintptr_t)&_app_start){ /* not booted via DFU, do autoboot */ 
        char filename[FLEN];
        switch(getInputRaw()){
            case BTN_LEFT:
                getInputWaitRelease();
                doRealExec(1);
                break;
            case BTN_UP:
                doMSC();
            default:
            case BTN_NONE:
                readTextFile(BOOTCFG, filename, FLEN);
                lcdPrintln("Booting:");
                lcdPrintln(filename);
                bootFile(filename);
                break;
		};
	};
	static const struct MENU main={ "Bootloader", {
		{ "Exec Firmware", &doExec},
		{ "MSC", &doMSC},
		{ "Flash Boot Ldr", &doFlash},
		{ "Info", &doInfo},
		{NULL,NULL}
	}};
	do {
		handleMenu(&main);
	}while(1);
}
Beispiel #15
0
void lcdInit(void) {
	SETUPgout(LCD_BL_EN);
	SETUPgout(LCD_RESET);
	SETUPgout(LCD_CS);

	/* prepare SPI */
	SETUPpin(LCD_MOSI);
	SETUPpin(LCD_SCK);

	// Reset the display
    OFF(LCD_RESET);
    delayms(100); /* 1 ms */
    ON(LCD_RESET);
    delayms(100); /* 5 ms */

    lcd_select();

	static uint8_t initseq_d[] = {
		/* The controller is a PCF8833 -
		   documentation can be found online.
		 */
		0x11,              // SLEEP_OUT  (wake up)
		0x3A, 2,           // mode 8bpp  (2= 8bpp, 3= 12bpp, 5= 16bpp)
		0x36, 0b11000000,  // my,mx,v,lao,rgb,x,x,x
		0x25, 0x3a,        // set contrast
		0x29,              // display on 
		0x03,              // BSTRON (booster voltage)
		0x2A, 1, RESX,
		0x2B, 1, RESY
	};
	uint16_t initseq_c = ~  (  /* commands: 1, data: 0 */
			(1<< 0) |
			(1<< 1) | (0<< 2) |
			(1<< 3) | (0<< 4) |
			(1<< 5) | (0<< 6) |
			(1<< 7) |
			(1<< 8) |
			(1<< 9) | (0<<10) | (0<<11) |
			(1<<12) | (0<<13) | (0<<14) |
			0);
	int i = 0;

	lcdWrite(0, 0x01); /* most color displays need the pause */
	delayms(10);

	while(i<sizeof(initseq_d)){
		lcdWrite(initseq_c&1, initseq_d[i++]);
		initseq_c = initseq_c >> 1;
	}
    lcd_deselect();
	lcdFill(0xff); /* Clear display buffer */
	setSystemFont();
}
Beispiel #16
0
void ram() {
  for(int x = 63; x >= 0; x--) {
    lcdFill(0);
    DoString(x, 0, "Setting Highscore");
    lcdDisplay();
  }
  highscore_set(23542, "Pentagon V1LLAG3");

  delayms_queue(500);

  for(int x = 63; x >= 0; x--) {
    lcdFill(0);
    DoString(x, 0, "Setting ...");
    lcdDisplay();
  }
  foo_set("PwnedPwnedPwnedPwnedPwnedPwned  ");
  bar_set("http://chaosbay.camp.ccc.de/    ");

  delayms_queue(500);
  time_set(1313803870);
}
Beispiel #17
0
static void death_anim()
{
    int i,j, a=4;

    while(a--) {
        //    lcdToggleFlag(LCD_INVERTED);
        lcdFill(0b11100000);
        lcdDisplay();
        delayms(100);
        lcdFill(0xFF);
        lcdDisplay();
        delayms(100);

#ifdef SIMULATOR
        delayms(5000);
#else
        delayms(250);
#endif
    }
    ;// this is a stub

}
Beispiel #18
0
static bool screen_gameover() {
	char key =0;
	while(key==0) {
		lcdFill(0);
		font = &Font_7x8;
		DoString (14,32, "GAME OVER");
		DoInt (0,0, game.score);
		if (highscore_set(game.score, GLOBAL(nickname)))
			DoString (0,9,"HIGHSCORE!");
		lcdDisplay();
		key=getInputWaitTimeout(5000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}	
Beispiel #19
0
static void draw_splash(void){
  char key=0;
	while(key==0) {
    lcdFill(0);
    if (highscore_set(game.score, GLOBAL(nickname))){
			DoString (16,15,"HIGHSCORE!");
    } else {
      DoString (16,15, "GAME OVER");
    }
		DoString (24,40, "GAME BY");
		DoString (10,50, "@RANZWERTIG");
    lcdDisplay();
		key=getInputWaitTimeout(1000);
  }
  return;
}
Beispiel #20
0
void main_inputtest(void) {
    backlightInit();
	
	char nick[20];
	memset(nick,0,20);
	strcpy(nick,"iggy");
   
	while(1) {
	   input("Nick?", nick, 0x20, 0x7f, 20);
	   
	   lcdFill(0);
	   font=&Font_Orbitron14pt;
	   DoString(20,20,nick);
	   lcdDisplay();
	   
	   while(getInput() != BTN_ENTER){}
	}
}
Beispiel #21
0
int main(void)
{
	cpu_clock_init();
	ssp_clock_init();

	inputInit();

    lcdInit();
    lcdFill(0xff);
	OFF(MIXER_EN);

	static const struct MENU main={ "img test", {
		{ "LCD", &doLCD},
		{NULL,NULL}
	}};
	handleMenu(&main);
	return 0;
}
Beispiel #22
0
int main(uint32_t startloc) {
	cpu_clock_init();
	ssp_clock_init();
	systick_set_reload(208000);
	systick_set_clocksource(0);
	systick_interrupt_enable();
	systick_counter_enable();

//	cpu_clock_pll1_max_speed();

	SETUPgout(EN_VDD);
	SETUPgout(MIXER_EN);

	SETUPgout(LED1);
	SETUPgout(LED2);
	SETUPgout(LED3);
	SETUPgout(LED4);
	inputInit();
	flashInit();

    lcdInit();
	fsInit();
    lcdFill(0xff); /* Display BL Image here */

	sli=startloc;

	if (startloc != (uintptr_t)&_app_start){ /* not booted via DFU, do autoboot */ 
		if (getInputRaw()!=BTN_LEFT){
			char filename[FLEN];
			readTextFile(BOOTCFG, filename, FLEN);
			lcdPrintln("Fname");
			lcdPrintln(filename);
			bootFile(filename,0);
		};
	};
	static const struct MENU main={ "Bootloader", {
		{ "Info", &doInfo},
		{ "Exec", &doExec},
		{ "Flash", &doFlash},
		{NULL,NULL}
	}};
	handleMenu(&main);
	return 0;
}
Beispiel #23
0
static bool screen_gameover() {
	char key =0;
	while(key==0) {
		lcdFill(0x00);
		setIntFont(&Font_7x8);
    setTextColor(0x00,0b11100000);
		lcdSetCrsr(14+15,32+15);lcdPrint("GAME OVER");
    setTextColor(0x00,0xff);
		lcdSetCrsr(0,0);lcdPrint(IntToStr(game.score,6,F_LONG));
		if (highscore_set(game.score, GLOBAL(nickname))){
      setTextColor(0x00,0b00011000);
      lcdSetCrsr(0,9);lcdPrint("HIGHSCORE!");
		};
		lcdDisplay();
		key=getInputWaitTimeout(5000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}
Beispiel #24
0
void ram(void){
	while(1) {
    if (!screen_intro())
     return;
    init_game();
    while(game.ships > 0){
      game.ticks++;
      lcdFill(0);
      conrtols();
      draw_game();
      lcdDisplay();
      delayms_queue_plus(12,0);
      if(game.shot_delay > 0){
        game.shot_delay--;
      }
    }
    draw_splash();
	}
}
Beispiel #25
0
void main(void) {
    // Configure cpu and mandatory peripherals
    cpuInit();                                // Configure the CPU
// we do it later
//    systickInit(CFG_SYSTICK_DELAY_IN_MS);     // Start systick timer
// cpuInit already calls this
//    gpioInit();                               // Enable GPIO 
    pmuInit();                                // Configure power management
    adcInit();                                // Config adc pins to save power

    // initialise basic badge functions
    rbInit();

    initUUID(); // Cache UUID values.
  
    lcdInit(); // display

    lcdFill(0);
    lcdDisplay();
    
    switch(getInputRaw()){
        case BTN_ENTER:
            lcdPrint("ISP active");
            lcdRefresh();
            ReinvokeISP();
            break;
        case BTN_DOWN:
            lcdPrint("MSC active");
            lcdRefresh();
            usbMSCInit();
            while(1);
            break;
    };

    fsInit();

    if( getInputRaw() == BTN_UP ){ // Reset config
            saveConfig();
    }

	wrapper(); // see applications/ subdirectory
}
Beispiel #26
0
int main(void) {
    // Configure cpu and mandatory peripherals
    cpuInit();                                // Configure the CPU
// we do it later
//    systickInit(CFG_SYSTICK_DELAY_IN_MS);     // Start systick timer
// cpuInit already calls this
//    gpioInit();                               // Enable GPIO 
    pmuInit();                                // Configure power management
    adcInit();                                // Config adc pins to save power

    // initialise basic badge functions
    rbInit();

    fsInit();
  
    lcdInit(); // display

    lcdFill(0);
    lcdDisplay();

	wrapper(); // see module/ subdirectory
}
Beispiel #27
0
void simpleNickname(void) {
    int dx=0;
	int dy=0;
    static uint32_t ctr=0;
	ctr++;

	setExtFont(GLOBAL(nickfont));
	dx=DoString(0,0,GLOBAL(nickname));
    dx=(RESX-dx)/2;
    if(dx<0)
        dx=0;
    dy=(RESY-getFontHeight())/3;

    lcdFill(GLOBAL(nickbg));
    setTextColor(GLOBAL(nickbg),GLOBAL(nickfg));
	DoString(dx,dy,GLOBAL(nickname));
    dataLove();
    batteryLevel();
	lcdDisplay();

    getInputWaitTimeout(300);
    return;
}
Beispiel #28
0
static void intro(int num){
#if 0
  FIL file;
  int res;
  UINT readbytes=RESX*RESY_B;
  res=f_open(&file,"ranim.lcd",FA_OPEN_EXISTING|FA_READ);
  if (res) return;
  do {
	lcdFill(0x55);
	res = f_read(&file, (char *)lcdBuffer, RESX*RESY_B, &readbytes);
	if(res)
	return;
	if(readbytes<RESX*RESY_B) {
				f_lseek(&file,0);
				continue;
			};
	lcdRefresh();

	delayms_queue(23*7);

  } while (--num);
#endif
}
Beispiel #29
0
int main(void) {
	cpu_clock_init_();
	ssp_clock_init();

	systickInit();

//	cpu_clock_pll1_max_speed();

	SETUPgout(EN_VDD);
	SETUPgout(MIXER_EN);

	SETUPgout(LED1);
	SETUPgout(LED2);
	SETUPgout(LED3);
	SETUPgout(LED4);

	inputInit();
	feldInit();

    lcdInit();
	fsInit(); 
    lcdFill(0xff);

	static const struct MENU main={ "main 1", {
		{ "FS", &doFS},
		{ "MSC", &doMSC},
		{ "flash", &doFlash},
		{ "LCD", &doLCD},
		{ "speed", &doSpeed},
		{ "ADC", &doADC},
		{ "feld", &doFeld},
		{ "chrg", &doChrg},
		{NULL,NULL}
	}};
	handleMenu(&main);
	return 0;
}
Beispiel #30
0
static bool screen_intro(void) {
	char key=0;
	while(key==0) {
		getInputWaitRelease();
		lcdFill(0);
		int ct = 0;
    for (int i = 0; i < SHIP_HEIGHT; i++){
      for(int d = 0; d < SHIP_WIDTH; d++){
        lcdSetPixel((40+d)%RESX,(10+i)%RESY,SHIP[ct]);
        ct++;
      }
    }
		DoString (13,25,"R0KET TYPE");
		uint32_t highscore;
	  char highnick[20];
	  highscore = highscore_get(highnick);
		DoInt(13, 40, highscore);
		DoString (13, 50, highnick);
		lcdDisplay();
		key=getInputWaitTimeout(1000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}