PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Dependents: YATTT sd_map_test cPong SnowDemo ... more
PokittoLib
Library for programming Pokitto hardware
How to Use
- Import this library to online compiler (see button "import" on the right hand side
- DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
- Change My_settings.h according to your project
- Start coding!
POKITTO_CORE/PokittoFakeavr.h@52:c04087025cab, 2018-07-01 (annotated)
- Committer:
- Pokitto
- Date:
- Sun Jul 01 06:32:37 2018 +0000
- Revision:
- 52:c04087025cab
PokittoCookie, faster Mode2 and Mode13 added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 52:c04087025cab | 1 | /**************************************************************************/ |
Pokitto | 52:c04087025cab | 2 | /*! |
Pokitto | 52:c04087025cab | 3 | @file PokittoFakeavr.h |
Pokitto | 52:c04087025cab | 4 | @author Jonne Valola |
Pokitto | 52:c04087025cab | 5 | |
Pokitto | 52:c04087025cab | 6 | @section LICENSE |
Pokitto | 52:c04087025cab | 7 | |
Pokitto | 52:c04087025cab | 8 | Software License Agreement (BSD License) |
Pokitto | 52:c04087025cab | 9 | |
Pokitto | 52:c04087025cab | 10 | Copyright (c) 2016, Jonne Valola |
Pokitto | 52:c04087025cab | 11 | All rights reserved. |
Pokitto | 52:c04087025cab | 12 | |
Pokitto | 52:c04087025cab | 13 | Redistribution and use in source and binary forms, with or without |
Pokitto | 52:c04087025cab | 14 | modification, are permitted provided that the following conditions are met: |
Pokitto | 52:c04087025cab | 15 | 1. Redistributions of source code must retain the above copyright |
Pokitto | 52:c04087025cab | 16 | notice, this list of conditions and the following disclaimer. |
Pokitto | 52:c04087025cab | 17 | 2. Redistributions in binary form must reproduce the above copyright |
Pokitto | 52:c04087025cab | 18 | notice, this list of conditions and the following disclaimer in the |
Pokitto | 52:c04087025cab | 19 | documentation and/or other materials provided with the distribution. |
Pokitto | 52:c04087025cab | 20 | 3. Neither the name of the copyright holders nor the |
Pokitto | 52:c04087025cab | 21 | names of its contributors may be used to endorse or promote products |
Pokitto | 52:c04087025cab | 22 | derived from this software without specific prior written permission. |
Pokitto | 52:c04087025cab | 23 | |
Pokitto | 52:c04087025cab | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
Pokitto | 52:c04087025cab | 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Pokitto | 52:c04087025cab | 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Pokitto | 52:c04087025cab | 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
Pokitto | 52:c04087025cab | 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Pokitto | 52:c04087025cab | 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Pokitto | 52:c04087025cab | 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
Pokitto | 52:c04087025cab | 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Pokitto | 52:c04087025cab | 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Pokitto | 52:c04087025cab | 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Pokitto | 52:c04087025cab | 34 | */ |
Pokitto | 52:c04087025cab | 35 | /**************************************************************************/ |
Pokitto | 52:c04087025cab | 36 | |
Pokitto | 52:c04087025cab | 37 | #ifndef _POKITTO_FAKEAVR_H_ |
Pokitto | 52:c04087025cab | 38 | #define _POKITTO_FAKEAVR_H_ |
Pokitto | 52:c04087025cab | 39 | |
Pokitto | 52:c04087025cab | 40 | #include "PokittoItoa.h" |
Pokitto | 52:c04087025cab | 41 | #include "binary.h" |
Pokitto | 52:c04087025cab | 42 | #include <stdint.h> |
Pokitto | 52:c04087025cab | 43 | #include <stdlib.h> |
Pokitto | 52:c04087025cab | 44 | |
Pokitto | 52:c04087025cab | 45 | #ifdef POK_SIM |
Pokitto | 52:c04087025cab | 46 | #include <stdbool.h> |
Pokitto | 52:c04087025cab | 47 | #else |
Pokitto | 52:c04087025cab | 48 | #include <stdbool.h> |
Pokitto | 52:c04087025cab | 49 | #endif // POK_SIM |
Pokitto | 52:c04087025cab | 50 | |
Pokitto | 52:c04087025cab | 51 | #define _BV(bit) (1 << (bit)) //jonne |
Pokitto | 52:c04087025cab | 52 | |
Pokitto | 52:c04087025cab | 53 | |
Pokitto | 52:c04087025cab | 54 | |
Pokitto | 52:c04087025cab | 55 | /** data types */ |
Pokitto | 52:c04087025cab | 56 | #ifndef _RPCNDR_H |
Pokitto | 52:c04087025cab | 57 | typedef bool boolean; |
Pokitto | 52:c04087025cab | 58 | #endif |
Pokitto | 52:c04087025cab | 59 | typedef uint8_t byte; |
Pokitto | 52:c04087025cab | 60 | |
Pokitto | 52:c04087025cab | 61 | /** PROGMEM */ |
Pokitto | 52:c04087025cab | 62 | #define PROGMEM |
Pokitto | 52:c04087025cab | 63 | //#define F |
Pokitto | 52:c04087025cab | 64 | |
Pokitto | 52:c04087025cab | 65 | /** AVR program memory string functions **/ |
Pokitto | 52:c04087025cab | 66 | #define sprintf_P sprintf |
Pokitto | 52:c04087025cab | 67 | #define strstr_P strstr |
Pokitto | 52:c04087025cab | 68 | #define strcpy_P strcpy |
Pokitto | 52:c04087025cab | 69 | |
Pokitto | 52:c04087025cab | 70 | #define utoa pokItoa |
Pokitto | 52:c04087025cab | 71 | #define ultoa pokItoa |
Pokitto | 52:c04087025cab | 72 | |
Pokitto | 52:c04087025cab | 73 | /** PROGMEM hacks **/ |
Pokitto | 52:c04087025cab | 74 | #define PROGMEM |
Pokitto | 52:c04087025cab | 75 | #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) |
Pokitto | 52:c04087025cab | 76 | #ifndef WIN32 |
Pokitto | 52:c04087025cab | 77 | #define pgm_read_word(addr) (*(addr)) |
Pokitto | 52:c04087025cab | 78 | #else |
Pokitto | 52:c04087025cab | 79 | #define pgm_read_word(addr) (*(const unsigned int *)(addr)) |
Pokitto | 52:c04087025cab | 80 | #endif // WIN32 |
Pokitto | 52:c04087025cab | 81 | |
Pokitto | 52:c04087025cab | 82 | /** min max & others **/ |
Pokitto | 52:c04087025cab | 83 | |
Pokitto | 52:c04087025cab | 84 | |
Pokitto | 52:c04087025cab | 85 | #ifndef DISABLEAVRMIN |
Pokitto | 52:c04087025cab | 86 | #define max(a,b) ((a)>(b)?(a):(b)) |
Pokitto | 52:c04087025cab | 87 | #define min(a,b) ((a)<(b)?(a):(b)) |
Pokitto | 52:c04087025cab | 88 | #endif // DISABLEAVRMIN |
Pokitto | 52:c04087025cab | 89 | #define __avrmax(a,b) ((a)>(b)?(a):(b)) |
Pokitto | 52:c04087025cab | 90 | #define __avrmin(a,b) ((a)<(b)?(a):(b)) |
Pokitto | 52:c04087025cab | 91 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) |
Pokitto | 52:c04087025cab | 92 | #define min2(a,b) (((a)<(b))?(a):(b)) |
Pokitto | 52:c04087025cab | 93 | |
Pokitto | 52:c04087025cab | 94 | |
Pokitto | 52:c04087025cab | 95 | |
Pokitto | 52:c04087025cab | 96 | #ifdef __cplusplus |
Pokitto | 52:c04087025cab | 97 | extern "C" { |
Pokitto | 52:c04087025cab | 98 | #endif |
Pokitto | 52:c04087025cab | 99 | |
Pokitto | 52:c04087025cab | 100 | void cli(); |
Pokitto | 52:c04087025cab | 101 | void sei(); |
Pokitto | 52:c04087025cab | 102 | |
Pokitto | 52:c04087025cab | 103 | #ifdef __cplusplus |
Pokitto | 52:c04087025cab | 104 | } |
Pokitto | 52:c04087025cab | 105 | #endif |
Pokitto | 52:c04087025cab | 106 | #endif |
Pokitto | 52:c04087025cab | 107 | |
Pokitto | 52:c04087025cab | 108 |