Skip to content

Commit 4821001

Browse files
committed
Envie: port doom :)
Need to preflash utils/doom.fat.dump in external QSPI with /home/martino/.arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1/dfu-util --device 0x2341:0x005b -a1 -D utils/doom.fat.dump --dfuse-address=0x90000000
1 parent 9cd4be7 commit 4821001

File tree

188 files changed

+67667
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+67667
-0
lines changed

examples/Doom/Doom.ino

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include "QSPIFBlockDevice.h"
2+
#include "FATFileSystem.h"
3+
#include "doomgeneric.h"
4+
5+
QSPIFBlockDevice block_device(PD_11, PD_12, PF_7, PD_13,
6+
PF_10, PG_6, QSPIF_POLARITY_MODE_1, MBED_CONF_QSPIF_QSPI_FREQ);
7+
8+
mbed::FATFileSystem fs("fs");
9+
10+
extern "C" int main_wrapper(int argc, char **argv);
11+
char*argv[] = {"/fs/doom", "-iwad", "/fs/DOOM1.WAD"};
12+
13+
void setup() {
14+
// put your setup code here, to run once:
15+
delay(2000);
16+
int err = fs.mount(&block_device);
17+
if (err) {
18+
// Reformat if we can't mount the filesystem
19+
// this should only happen on the first boot
20+
printf("No filesystem found, formatting... ");
21+
fflush(stdout);
22+
err = fs.reformat(&block_device);
23+
}
24+
DIR *dir;
25+
struct dirent *ent;
26+
printf("try to open dir\n");
27+
if ((dir = opendir("/fs")) != NULL) {
28+
/* print all the files and directories within directory */
29+
while ((ent = readdir (dir)) != NULL) {
30+
printf ("%s\n", ent->d_name);
31+
}
32+
closedir (dir);
33+
} else {
34+
/* could not open directory */
35+
printf ("error\n");
36+
}
37+
main_wrapper(3, argv);
38+
}
39+
40+
void loop() {
41+
// put your main code here, to run repeatedly:
42+
43+
}

0 commit comments

Comments
 (0)