PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Embed:
(wiki syntax)
Show/hide line numbers
Pokitto_settings.h
Go to the documentation of this file.
00001 /**************************************************************************/ 00002 /*! 00003 @file Pokitto_settings.h 00004 @author Jonne Valola 00005 00006 @section LICENSE 00007 00008 Software License Agreement (BSD License) 00009 00010 Copyright (c) 2016, Jonne Valola 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided that the following conditions are met: 00015 1. Redistributions of source code must retain the above copyright 00016 notice, this list of conditions and the following disclaimer. 00017 2. Redistributions in binary form must reproduce the above copyright 00018 notice, this list of conditions and the following disclaimer in the 00019 documentation and/or other materials provided with the distribution. 00020 3. Neither the name of the copyright holders nor the 00021 names of its contributors may be used to endorse or promote products 00022 derived from this software without specific prior written permission. 00023 00024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 00025 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 00028 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00031 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 /**************************************************************************/ 00036 00037 00038 #ifndef POKITTO_SETTINGS_H 00039 #define POKITTO_SETTINGS_H 00040 00041 #include "../My_settings.h" 00042 00043 #ifdef PROJ_BOARDREV 00044 #define POK_BOARDREV PROJ_BOARDREV // which revision of Pokitto board 00045 #else 00046 #define POK_BOARDREV 2 // default is boardrev 2 (the 4-layer board) 00047 #endif 00048 00049 /** LOGO */ 00050 #ifdef PROJ_STARTUPLOGO 00051 #define POK_DISPLAYLOGO PROJ_STARTUPLOGO// if enabled, show logo at start 00052 #else 00053 #define POK_DISPLAYLOGO 1 00054 #endif 00055 00056 #define POK_ENABLE_REFRESHWITHWAIT 0 // choose whether waiting in application refreshes display or not 00057 #define POK_ENABLE_FPSCOUNTER 0 // turn off to save some cpu 00058 #define POK_ENABLE_SD 1 // Define true to include SD library 00059 #define POK_LOADER_COUNTDOWN 3 //how many seconds waiting for C press for loader 00060 00061 #ifndef PROJ_ENABLE_SOUND 00062 #define POK_ENABLE_SOUND 1 00063 #else 00064 #define POK_ENABLE_SOUND PROJ_ENABLE_SOUND 00065 #endif 00066 00067 #ifndef PROJ_SOUND_BUFFERED 00068 #define POK_SOUND_BUFFERED 0 00069 #else 00070 #define POK_SOUND_BUFFERED PROJ_SOUND_BUFFERED 00071 #endif 00072 00073 #ifndef PROJ_GBSOUND 00074 #if POK_ENABLE_SOUND > 0 00075 #define POK_GBSOUND 0 00076 #endif 00077 #else 00078 #define POK_GBSOUND PROJ_GBSOUND 00079 #endif 00080 00081 00082 #ifndef PROJ_STREAMING_MUSIC 00083 #define POK_STREAMING_MUSIC 0 // Define true to stream music from SD 00084 #else 00085 #define POK_STREAMING_MUSIC PROJ_STREAMING_MUSIC 00086 #endif // PROJ_STREAMING_MUSIC 00087 00088 #ifndef PROJ_ENABLE_SYNTH 00089 #define POK_ENABLE_SYNTH 0 00090 #else 00091 #define POK_ENABLE_SYNTH PROJ_ENABLE_SYNTH 00092 #endif // PROJ_ENABLE_SYNTH 00093 00094 00095 /** CONSOLE **/ 00096 #define POK_USE_CONSOLE 0 //if debugging console is available or not 00097 #define POK_CONSOLE_VISIBLE_AT_STARTUP 1 // whaddaya think ? 00098 #define POK_CONSOLE_INTERVAL 1000 // interval in ms how often console is drawn 00099 #if POK_USE_CONSOLE > 0 // this prevents trying to log messages if console is disabled 00100 #define POK_CONSOLE_LOG_BUTTONS 0 // if console logs keypresses 00101 #define POK_CONSOLE_LOG_COLLISIONS 1 // if console logs collisions 00102 #endif // POK_USE_CONSOLE 00103 #define CONSOLEBUFSIZE 20 00104 #define POK_SHOW_VOLUME 0 // volumebar drawn after console if enabled 00105 #define VOLUMEBAR_TIMEOUT 10 // frames before disappearing 00106 00107 /** PROJECT LIBRARY TYPE **/ 00108 // Tiled mode can NOT be buffered mode (fast mode, arduboy mode, gamebuino mode etc) 00109 #if PROJ_TILEDMODE > 0 00110 #define POK_TILEDMODE 1 00111 #ifdef PROJ_TILEWIDTH 00112 #define POK_TILE_W PROJ_TILEWIDTH 00113 #else 00114 #define POK_TILE_W 11 00115 #endif // PROJ_TILEWIDTH 00116 #if POK_TILE_W == 11 00117 #define POK_TILES_X 20 00118 #define LCDWIDTH 220 00119 #elif POK_TILE_W == 12 00120 #define POK_TILES_X 18 00121 #define LCDWIDTH 216 00122 #elif POK_TILE_W == 8 00123 #define POK_TILES_X 27 00124 #define LCDWIDTH 216 00125 #elif POK_TILE_W == 32 00126 #define POK_TILES_X 6 00127 #define LCDWIDTH 220 00128 #elif POK_TILE_W == 10 00129 #define POK_TILES_X 22 00130 #define LCDWIDTH 220 00131 #elif POK_TILE_W == 14 00132 #define POK_TILES_X 15 00133 #define LCDWIDTH 210 00134 #endif 00135 #ifdef PROJ_TILEHEIGHT 00136 #define POK_TILE_H PROJ_TILEHEIGHT 00137 #else 00138 #define POK_TILE_H 11 00139 #endif // PROJ_TILEHEIGHT 00140 #if POK_TILE_H == 11 00141 #define POK_TILES_Y 16 00142 #define LCDHEIGHT 176 00143 #elif POK_TILE_H == 12 00144 #define POK_TILES_Y 14 00145 #define LCDHEIGHT 168 00146 #elif POK_TILE_H == 8 00147 #define POK_TILES_Y 22 00148 #define LCDHEIGHT 176 00149 #elif POK_TILE_H == 32 00150 #define POK_TILES_Y 5 00151 #define LCDHEIGHT 176 00152 #elif POK_TILE_H == 10 00153 #define POK_TILES_Y 17 00154 #define LCDHEIGHT 170 00155 #elif POK_TILE_H == 14 00156 #define POK_TILES_Y 12 00157 #define LCDHEIGHT 168 00158 #endif 00159 #else 00160 #if PROJ_GAMEBUINO > 0 00161 #define POK_GAMEBUINO_SUPPORT PROJ_GAMEBUINO // Define true to support Gamebuino library calls 00162 #define PROJ_SCREENMODE MODE_GAMEBUINO_16COLOR 00163 #define POK_STRETCH 1 00164 #define PICOPALETTE 0 00165 #define POK_COLORDEPTH 4 00166 #else 00167 #if PROJ_ARDUBOY > 0 00168 #define POK_ARDUBOY_SUPPORT PROJ_ARDUBOY // Define true to support Arduboy library calls 00169 #define PROJ_SCREENMODE MODE_ARDUBOY_16COLOR 00170 #define POK_COLORDEPTH 1 00171 #define POK_STRETCH 1 00172 #define POK_FPS 20 00173 #define PICOPALETTE 0 00174 #else 00175 #if PROJ_RBOY > 0 00176 #define PROJ_SCREENMODE MODE_GAMEBUINO_16COLOR 00177 #define POK_COLORDEPTH 1 00178 #define POK_STRETCH 0 00179 #define POK_FPS 40 00180 #define PICOPALETTE 0 00181 #else 00182 #if PROJ_GAMEBOY > 0 00183 #define PROJ_SCREENMODE MODE_GAMEBOY 00184 #define POK_COLORDEPTH 2 00185 #define POK_STRETCH 0 00186 #define POK_FPS 6 00187 #define PICOPALETTE 0 00188 #else 00189 #define POK_GAMEBUINO_SUPPORT 0 00190 #define POK_GAMEBOY_SUPPORT 0 00191 #define POK_ARDUBOY_SUPPORT 0 00192 #define PICOPALETTE 0 00193 #define POK_COLORDEPTH 4 00194 #endif // PROJ_GAMEBOY 00195 #endif // PROJ_RBOY 00196 #endif // PROJ_ARDUBOY 00197 #endif // PROJ_GAMEBUINO 00198 #endif // PROJ_TILEDMODE 00199 00200 00201 /** SCREEN MODES TABLE -- DO NOT CHANGE THESE **/ 00202 00203 #define POK_LCD_W 220 //<- do not change !! 00204 #define POK_LCD_H 176 //<- do not change !! 00205 00206 #define MODE_NOBUFFER 0 //Size: 0 00207 #define BUFSIZE_NOBUFFER 0 00208 #define MODE_HI_4COLOR 1 //Size: 9680 00209 #define BUFSIZE_HI_4 9680 00210 #define MODE_FAST_16COLOR 2 //Size: 4840 00211 #define BUFSIZE_FAST_16 4840 00212 #define MODE_HI_16COLOR 3 00213 #define BUFSIZE_HI_16 19360 00214 #define MODE_GAMEBUINO_16COLOR 4 //Size: 2016 00215 #define BUFSIZE_GAMEBUINO_16 2016 00216 #define MODE_ARDUBOY_16COLOR 5 //Size: 4096 00217 #define BUFSIZE_ARDUBOY_16 4096 00218 #define MODE_HI_MONOCHROME 6 //Size: 4840 00219 #define BUFSIZE_HI_MONO 4840 00220 #define MODE_HI_GRAYSCALE 7 //Size: 9680 00221 #define BUFSIZE_HI_GS 9680 00222 #define MODE_GAMEBOY 8 00223 #define BUFSIZE_GAMEBOY 5760 00224 #define MODE_UZEBOX 9 00225 #define MODE_TVOUT 10 00226 #define MODE_LAMENES 11 00227 #define BUFSIZE_LAMENES 7680 00228 #define MODE_256_COLOR 12 00229 #define BUFSIZE_MODE_12 4176 // 72 x 58 00230 #define MODE13 13 00231 #define BUFSIZE_MODE13 9680 // 110*88 00232 #define MODE14 14 00233 #define BUFSIZE_MODE14 14520 00234 // Tiled modes 00235 #define MODE_TILED_1BIT 1001 00236 #define MODE_TILED_8BIT 1002 00237 00238 00239 #define R_MASK 0xF800 00240 #define G_MASK 0x7E0 00241 #define B_MASK 0x1F 00242 00243 /** SCREENMODE - USE THIS SELECTION FOR YOUR PROJECT **/ 00244 00245 #if POK_TILEDMODE > 0 00246 #ifndef PROJ_TILEBITDEPTH 00247 #define PROJ_TILEBITDEPTH 8 //default tiling mode is 256 color mode! 00248 #endif // PROJ_TILEBITDEPTH 00249 #if PROJ_TILEBITDEPTH == 1 00250 #define POK_SCREENMODE MODE_TILED_1BIT 00251 #define POK_COLORDEPTH 1 00252 #else 00253 #define POK_SCREENMODE MODE_TILED_8BIT 00254 #define POK_COLORDEPTH 8 00255 #endif // PROJ_TILEBITDEPTH 00256 #else 00257 #ifndef PROJ_SCREENMODE 00258 #undef POK_COLORDEPTH 00259 #ifdef PROJ_HIRES 00260 #if PROJ_HIRES > 0 00261 #define POK_SCREENMODE MODE_HI_4COLOR 00262 #undef POK_COLORDEPTH 00263 #define POK_COLORDEPTH 2 00264 #elif PROJ_HICOLOR > 0 00265 #define POK_SCREENMODE MODE_256_COLOR 00266 #undef POK_COLORDEPTH 00267 #define POK_COLORDEPTH 8 00268 #else 00269 #define POK_SCREENMODE MODE_FAST_16COLOR 00270 #undef POK_COLORDEPTH 00271 #define POK_COLORDEPTH 4 00272 #endif // PROJ_HIRES 00273 #else 00274 #define POK_SCREENMODE MODE_FAST_16COLOR 00275 #define POK_COLORDEPTH 4 00276 #endif // PROJ_HIRES 00277 #else 00278 #define POK_SCREENMODE PROJ_SCREENMODE 00279 #endif 00280 #endif // POK_TILEDMODE 00281 00282 #if PROJ_MODE13 > 0 00283 #undef POK_SCREENMODE //get rid of warnings 00284 #undef POK_COLORDEPTH 00285 #undef POK_FPS 00286 #define POK_SCREENMODE MODE13 00287 #define POK_COLORDEPTH 8 00288 #define POK_STRETCH 0 00289 #define POK_FPS 30 00290 #endif 00291 00292 #if PROJ_MODE14 > 0 00293 #undef POK_SCREENMODE //get rid of warnings 00294 #undef POK_COLORDEPTH 00295 #undef POK_FPS 00296 #define POK_SCREENMODE MODE14 00297 #define POK_COLORDEPTH 3 00298 #define POK_STRETCH 0 00299 #define POK_FPS 30 00300 #endif 00301 #if PROJ_MODE15 > 0 00302 #undef POK_SCREENMODE //get rid of warnings 00303 #undef POK_COLORDEPTH 00304 #undef POK_FPS 00305 #define POK_SCREENMODE MODE15 00306 #define POK_COLORDEPTH 4 00307 #define POK_STRETCH 0 00308 #define POK_FPS 30 00309 #endif 00310 /* DEFINE SCREENMODE AS THE MAXIMUM SCREEN SIZE NEEDED BY YOUR APP ... SEE SIZES LISTED ABOVE */ 00311 00312 /** AUTOMATIC COLOR DEPTH SETTING - DO NOT CHANGE **/ 00313 #ifndef POK_COLORDEPTH 00314 #define POK_COLORDEPTH 4 // 1...5 is valid 00315 #endif // POK_COLORDEPTH 00316 00317 /** AUTOMATIC SCREEN BUFFER SIZE CALCULATION - DO NOT CHANGE **/ 00318 #if POK_SCREENMODE == 0 00319 #define POK_SCREENBUFFERSIZE 0 00320 #define LCDWIDTH POK_LCD_W 00321 #define LCDHEIGHT POK_LCD_H 00322 #define POK_BITFRAME 0 00323 #elif POK_SCREENMODE == MODE_HI_MONOCHROME 00324 #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H*POK_COLORDEPTH/8 00325 #define LCDWIDTH POK_LCD_W 00326 #define LCDHEIGHT POK_LCD_H 00327 #define POK_BITFRAME 4840 00328 #elif POK_SCREENMODE == MODE_HI_16COLOR 00329 #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H/2 00330 #define LCDWIDTH 220 00331 #define LCDHEIGHT 176 00332 #define POK_BITFRAME 4840 00333 #elif POK_SCREENMODE == MODE_HI_4COLOR || POK_SCREENMODE == MODE_HI_GRAYSCALE 00334 #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H*POK_COLORDEPTH/4 00335 #define LCDWIDTH POK_LCD_W 00336 #define LCDHEIGHT POK_LCD_H 00337 #define POK_BITFRAME 4840 00338 #elif POK_SCREENMODE == MODE_FAST_16COLOR 00339 #define POK_SCREENBUFFERSIZE (POK_LCD_W/2)*(POK_LCD_H/2)*POK_COLORDEPTH/8 00340 #define XCENTER POK_LCD_W/4 00341 #define YCENTER POK_LCD_H/4 00342 #define LCDWIDTH 110 00343 #define LCDHEIGHT 88 00344 #define POK_BITFRAME 1210 00345 #elif POK_SCREENMODE == MODE_256_COLOR 00346 #define POK_SCREENBUFFERSIZE 72*58 00347 #define XCENTER 36 00348 #define YCENTER 29 00349 #define LCDWIDTH 72 00350 #define LCDHEIGHT 58 00351 #define POK_BITFRAME 72*58 00352 #elif POK_SCREENMODE == MODE_GAMEBUINO_16COLOR 00353 #define POK_SCREENBUFFERSIZE (84/2)*(48/2)*POK_COLORDEPTH/8 00354 #define LCDWIDTH 84 00355 #define LCDHEIGHT 48 00356 #define POK_BITFRAME 504 00357 #elif POK_SCREENMODE == MODE_ARDUBOY_16COLOR 00358 #define POK_SCREENBUFFERSIZE (128/2)*(64/2)*POK_COLORDEPTH/8 00359 #define LCDWIDTH 128 00360 #define LCDHEIGHT 64 00361 #define POK_BITFRAME 1024 00362 #elif POK_SCREENMODE == MODE_LAMENES 00363 #define POK_SCREENBUFFERSIZE (128)*(120)*POK_COLORDEPTH/8 00364 #define LCDWIDTH 128 00365 #define LCDHEIGHT 120 00366 #define POK_BITFRAME 1210 00367 #elif POK_SCREENMODE == MODE_GAMEBOY 00368 #define POK_SCREENBUFFERSIZE (160)*(144)/4 00369 #define LCDWIDTH 160 00370 #define LCDHEIGHT 144 00371 #define POK_BITFRAME 2880 00372 #elif POK_SCREENMODE == MODE13 00373 #define POK_SCREENBUFFERSIZE 110*88 00374 #define LCDWIDTH 110 00375 #define LCDHEIGHT 88 00376 #define POK_BITFRAME 110*88 00377 #elif POK_SCREENMODE == MODE14 00378 #define POK_SCREENBUFFERSIZE 14520 00379 #define LCDWIDTH 220 00380 #define LCDHEIGHT 176 00381 #define POK_BITFRAME 4840 00382 #elif POK_SCREENMODE == MODE15 00383 #define POK_SCREENBUFFERSIZE 0x4BA0 00384 #define LCDWIDTH 220 00385 #define LCDHEIGHT 176 00386 00387 #else 00388 #define POK_SCREENBUFFERSIZE 0 00389 #endif // POK_SCREENMODE 00390 00391 #ifndef POK_STRETCH 00392 #define POK_STRETCH 1 // Stretch Gamebuino display 00393 #endif 00394 00395 #ifdef PROJ_FPS 00396 #define POK_FPS PROJ_FPS 00397 #endif 00398 #ifndef POK_FPS 00399 #define POK_FPS 20 00400 #endif 00401 #define POK_FRAMEDURATION 1000/POK_FPS 00402 00403 /** SCROLL TEXT VS. WRAP AROUND WHEN PRINTING **/ 00404 #define SCROLL_TEXT 1 00405 00406 /** AUDIO **/ 00407 #define POK_AUD_PIN P2_19 00408 #define POK_AUD_PWM_US 15 //31 //Default value 31 00409 #ifndef PROJ_AUD_FREQ 00410 #define POK_AUD_FREQ 22050 //Valid values: 8000, 11025, 16000, 22050 // audio update frequency in Hz 00411 #else 00412 #define POK_AUD_FREQ PROJ_AUD_FREQ 00413 #endif 00414 00415 00416 #define POK_USE_EXT 0 // if extension port is in use or not 00417 00418 #define POK_STREAMFREQ_HALVE 0 // if true, stream update freq is half audio freq 00419 #define POK_STREAM_LOOP 1 //master switch 00420 00421 #ifndef PROJ_USE_DAC 00422 #define POK_USE_DAC 1 // is DAC in use in this project 00423 #else 00424 #define POK_USE_DAC PROJ_USE_DAC 00425 #endif 00426 #ifndef PROJ_USE_PWM 00427 #define POK_USE_PWM 1 // is PWM for audio used in this project 00428 #else 00429 #define POK_USE_PWM PROJ_USE_PWM 00430 #endif 00431 00432 #ifndef PROJ_STREAM_TO_DAC 00433 #define POK_STREAM_TO_DAC 1 // 1 = stream from SD to DAC, synthesizer to PWM, 0 = opposite 00434 #else 00435 #define POK_STREAM_TO_DAC PROJ_STREAM_TO_DAC 00436 #endif 00437 00438 00439 #define POK_BACKLIGHT_PIN P2_2 00440 #define POK_BACKLIGHT_INITIALVALUE 0.3f 00441 00442 #define POK_BATTERY_PIN1 P0_22 // read battery level through these pins 00443 #define POK_BATTERY_PIN2 P0_23 00444 00445 #define POK_BTN_A_PIN P1_9 00446 #define POK_BTN_B_PIN P1_4 00447 #define POK_BTN_C_PIN P1_10 00448 #define POK_BTN_UP_PIN P1_13 00449 #define POK_BTN_DOWN_PIN P1_3 00450 #define POK_BTN_LEFT_PIN P1_25 00451 #define POK_BTN_RIGHT_PIN P1_7 00452 00453 #define UPBIT 0 00454 #define DOWNBIT 1 00455 #define LEFTBIT 2 00456 #define RIGHTBIT 3 00457 #define ABIT 4 00458 #define BBIT 5 00459 #define CBIT 6 00460 00461 /** LOADER UPDATE MECHANISM **/ 00462 #define POK_ENABLE_LOADER_UPDATES 1 //1=check for new loader versions on SD and update if new found 00463 00464 #ifndef SPRITE_COUNT 00465 #define SPRITE_COUNT 4 // The default max sprite count 00466 #endif 00467 00468 /** SYSTEM SETTINGS ADDRESSES IN EEPROM **/ 00469 #define EESETTINGS_FILENAME 3980 // 0xF8C 20bytes last filename requested 00470 #define EESETTINGS_VOL 4000 // 0xFA0 Volume 00471 #define EESETTINGS_DEFAULTVOL 4001 // 0xFA1 Default volume 00472 #define EESETTINGS_LOADERWAIT 4002 // 0xFA2 Loader wait in sec 00473 #define EESETTINGS_VOLWAIT 4003 // 0xFA3 Volume screen wait in sec 00474 #define EESETTINGS_TIMEFORMAT 4004 // 0xFA4 Time format (0=24 hrs, 1 = 12 hrs) 00475 #define EESETTINGS_LASTHOURSSET 4005 // 0xFA5 Last time set in hours 00476 #define EESETTINGS_LASTMINUTESSET 4006 // 0xFA6 Last time set in minutes 00477 #define EESETTINGS_DATEFORMAT 4007 // 0xFA7 Date format (0=D/M/Y, 1 = M/D/Y) 00478 #define EESETTINGS_LASTDAYSET 4008 // 0xFA8 Last Day set 00479 #define EESETTINGS_LASTMONTHSET 4009 // 0xFA9 Last Month set 00480 #define EESETTINGS_LASTYEARSET 4010 // 0xFAA Last Year set (counting from 2000) 00481 #define EESETTINGS_RTCALARMMODE 4011 // 0xFAB RTC alarm mode (0=disabled, 1=enabled, 3 = enabled with sound) 00482 #define EESETTINGS_RESERVED 4012 // 0xFAC 4bytes reserved (additional sleep configuration) 00483 #define EESETTINGS_WAKEUPTIME 4016 // 0xFB0 Wake-up time as 32bit value for 1Hz RTC clock 00484 00485 00486 #endif // POKITTO_SETTINGS_H 00487 00488
Generated on Tue Jul 12 2022 21:03:51 by 1.7.2