PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Dependents:   YATTT sd_map_test cPong SnowDemo ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PokittoGlobs.h Source File

PokittoGlobs.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*!
00003     @file     PokittoGlobs.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 #ifndef POKITTO_GLOBS_H
00038 #define POKITTO_GLOBS_H
00039 
00040 #include <stdint.h>
00041 
00042 #ifdef POK_SIM
00043     #include "SimLCD.h"
00044     #include "SimSound.h"
00045     #include "PokittoSimulator.h"
00046 #else
00047     #include "mbed.h"
00048     #include "HWLCD.h "
00049     #include "HWSound.h"
00050 #endif // POK_SIM
00051 
00052 extern int random(int);
00053 extern int random(int,int);
00054 
00055 #define HIGH    1
00056 #define LOW     0
00057 
00058 #define swapWT(type, a, b)    \
00059 {               \
00060     type _t_;   \
00061     _t_ = a;    \
00062     a = b;      \
00063     b = _t_;    \
00064 }
00065 
00066 #define SAMPLE_RATE POK_AUD_FREQ //was 16000, was 57000
00067 #define NUMFRAMES 570 //1 ms before refresh was 357
00068 
00069 
00070 // TODO: move these into some suitable place
00071 extern void fakeISR();
00072 extern void audio_IRQ();
00073 extern void update_SDAudioStream();
00074 extern uint16_t soundbyte;
00075 
00076 #if POK_STREAMING_MUSIC
00077     #define SPEAKER 3
00078    // #define BUFFER_SIZE 512 //5120 // was 256
00079 #if POK_HIGH_RAM == HIGH_RAM_MUSIC
00080     extern unsigned char *buffers[];
00081 #else
00082     extern unsigned char buffers[][BUFFER_SIZE];
00083 #endif
00084     extern volatile int currentBuffer, oldBuffer;
00085     extern volatile int bufindex, vol;
00086     extern volatile unsigned char * currentPtr;
00087     extern volatile unsigned char * endPtr;
00088     extern int8_t streamvol;
00089     extern uint32_t streamcounter;
00090     extern uint8_t streamstep;
00091 #endif
00092 
00093 #endif // POKITTO_GLOBS_H
00094 
00095