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 PokittoFakeavr.h Source File

PokittoFakeavr.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*!
00003     @file     PokittoFakeavr.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_FAKEAVR_H_
00038 #define _POKITTO_FAKEAVR_H_
00039 
00040 #include "PokittoItoa.h "
00041 #include "binary.h"
00042 #include <stdint.h>
00043 #include <stdlib.h>
00044 
00045 #ifdef POK_SIM
00046 #include <stdbool.h>
00047 #else
00048 #include <stdbool.h>
00049 #endif // POK_SIM
00050 
00051 #define _BV(bit) (1 << (bit)) //jonne
00052 
00053 
00054 
00055 /** data types */
00056 #ifndef _RPCNDR_H
00057 typedef bool boolean;
00058 #endif
00059 typedef uint8_t byte;
00060 
00061 /** PROGMEM */
00062 #define PROGMEM
00063 //#define F
00064 
00065 /** AVR program memory string functions **/
00066 #define sprintf_P sprintf
00067 #define strstr_P strstr
00068 #define strcpy_P strcpy
00069 
00070 #define utoa pokItoa
00071 #define ultoa pokItoa
00072 
00073 /** PROGMEM hacks **/
00074 #define PROGMEM
00075     #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
00076     #ifndef WIN32
00077     #define pgm_read_word(addr) (*(addr))
00078     #else
00079     #define pgm_read_word(addr) (*(const unsigned int *)(addr))
00080     #endif // WIN32
00081 
00082 /** min max & others **/
00083 
00084 
00085 #ifndef DISABLEAVRMIN
00086 #define max(a,b) ((a)>(b)?(a):(b))
00087 #define min(a,b) ((a)<(b)?(a):(b))
00088 #endif // DISABLEAVRMIN
00089 #define __avrmax(a,b) ((a)>(b)?(a):(b))
00090 #define __avrmin(a,b) ((a)<(b)?(a):(b))
00091 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
00092 #define min2(a,b) (((a)<(b))?(a):(b))
00093 
00094 
00095 
00096 #ifdef __cplusplus
00097 extern "C" {
00098 #endif
00099 
00100 void cli();
00101 void sei();
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 #endif
00107 
00108