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

Dependents:   Sensitive

Fork of PokittoLib by Jonne Valola

Committer:
spinal
Date:
Wed Oct 18 14:47:54 2017 +0000
Revision:
15:0bbe8f6fae32
Parent:
0:e8b8f36b4505
direct lcd stuff used by sensitive

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pokitto 0:e8b8f36b4505 1 /**************************************************************************/
Pokitto 0:e8b8f36b4505 2 /*!
Pokitto 0:e8b8f36b4505 3 @file Pokitto_extport.cpp
Pokitto 0:e8b8f36b4505 4 @author Jonne Valola
Pokitto 0:e8b8f36b4505 5
Pokitto 0:e8b8f36b4505 6 @section LICENSE
Pokitto 0:e8b8f36b4505 7
Pokitto 0:e8b8f36b4505 8 Pokitto development stage library
Pokitto 0:e8b8f36b4505 9 Software License Agreement
Pokitto 0:e8b8f36b4505 10
Pokitto 0:e8b8f36b4505 11 Copyright (c) 2015, Jonne Valola ("Author")
Pokitto 0:e8b8f36b4505 12 All rights reserved.
Pokitto 0:e8b8f36b4505 13
Pokitto 0:e8b8f36b4505 14 This library is intended solely for the purpose of Pokitto development.
Pokitto 0:e8b8f36b4505 15
Pokitto 0:e8b8f36b4505 16 Redistribution and use in source and binary forms, with or without
Pokitto 0:e8b8f36b4505 17 modification requires written permission from Author.
Pokitto 0:e8b8f36b4505 18 */
Pokitto 0:e8b8f36b4505 19 /**************************************************************************/
Pokitto 0:e8b8f36b4505 20
Pokitto 0:e8b8f36b4505 21 #include "Pokitto.h"
Pokitto 0:e8b8f36b4505 22
Pokitto 0:e8b8f36b4505 23 using namespace mbed; //needed for interruptin
Pokitto 0:e8b8f36b4505 24
Pokitto 0:e8b8f36b4505 25 #if POK_USE_EXT > 0
Pokitto 0:e8b8f36b4505 26 //#if POK_BOARDREV == 1
Pokitto 0:e8b8f36b4505 27 /** 2-layer board rev 1.3 **/
Pokitto 0:e8b8f36b4505 28 //#else
Pokitto 0:e8b8f36b4505 29 /** 4-layer board rev 2.1 **/
Pokitto 0:e8b8f36b4505 30 //InterruptIn ext0(P1_19);
Pokitto 0:e8b8f36b4505 31 AnalogIn ext0(P1_19);
Pokitto 0:e8b8f36b4505 32 DigitalIn ext1(P0_11, PullUp);
Pokitto 0:e8b8f36b4505 33 //DigitalOut ext0(P1_19);
Pokitto 0:e8b8f36b4505 34 //DigitalOut ext1(P0_11);
Pokitto 0:e8b8f36b4505 35 DigitalOut ext2(P0_12);
Pokitto 0:e8b8f36b4505 36 DigitalOut ext3(P0_13);
Pokitto 0:e8b8f36b4505 37 DigitalOut ext4(P0_14);
Pokitto 0:e8b8f36b4505 38 DigitalOut ext5(P0_17);
Pokitto 0:e8b8f36b4505 39 DigitalOut ext6(P0_18);
Pokitto 0:e8b8f36b4505 40 DigitalOut ext7(P0_19);
Pokitto 0:e8b8f36b4505 41 DigitalOut ext8(P1_20);
Pokitto 0:e8b8f36b4505 42 DigitalOut ext9(P1_21);
Pokitto 0:e8b8f36b4505 43 DigitalOut ext10(P1_22);
Pokitto 0:e8b8f36b4505 44 DigitalOut ext11(P1_23);
Pokitto 0:e8b8f36b4505 45 DigitalOut ext12(P1_5);
Pokitto 0:e8b8f36b4505 46 DigitalOut ext13(P1_6);
Pokitto 0:e8b8f36b4505 47 DigitalOut ext14(P1_8);
Pokitto 0:e8b8f36b4505 48 DigitalOut ext15(P1_26);
Pokitto 0:e8b8f36b4505 49 DigitalOut ext16(P1_27);
Pokitto 0:e8b8f36b4505 50 DigitalOut ext17(P0_16);
Pokitto 0:e8b8f36b4505 51 //#endif // POK_BOARDREV
Pokitto 0:e8b8f36b4505 52 #endif // POK_USE_EXT
Pokitto 0:e8b8f36b4505 53
Pokitto 0:e8b8f36b4505 54
Pokitto 0:e8b8f36b4505 55
Pokitto 0:e8b8f36b4505 56 void ext_write(uint32_t value) {
Pokitto 0:e8b8f36b4505 57 #if POK_USE_EXT > 0
Pokitto 0:e8b8f36b4505 58 if (value & 1) SET_EXT0 else CLR_EXT0;
Pokitto 0:e8b8f36b4505 59 value >>= 1;
Pokitto 0:e8b8f36b4505 60 if (value & 1) SET_EXT1 else CLR_EXT1;
Pokitto 0:e8b8f36b4505 61 value >>= 1;
Pokitto 0:e8b8f36b4505 62 if (value & 1) SET_EXT2 else CLR_EXT2;
Pokitto 0:e8b8f36b4505 63 value >>= 1;
Pokitto 0:e8b8f36b4505 64 if (value & 1) SET_EXT3 else CLR_EXT3;
Pokitto 0:e8b8f36b4505 65 value >>= 1;
Pokitto 0:e8b8f36b4505 66 if (value & 1) SET_EXT4 else CLR_EXT4;
Pokitto 0:e8b8f36b4505 67 value >>= 1;
Pokitto 0:e8b8f36b4505 68 if (value & 1) SET_EXT5 else CLR_EXT5;
Pokitto 0:e8b8f36b4505 69 value >>= 1;
Pokitto 0:e8b8f36b4505 70 if (value & 1) SET_EXT6 else CLR_EXT6;
Pokitto 0:e8b8f36b4505 71 value >>= 1;
Pokitto 0:e8b8f36b4505 72 if (value & 1) SET_EXT7 else CLR_EXT7;
Pokitto 0:e8b8f36b4505 73 value >>= 1;
Pokitto 0:e8b8f36b4505 74 if (value & 1) SET_EXT8 else CLR_EXT8;
Pokitto 0:e8b8f36b4505 75 value >>= 1;
Pokitto 0:e8b8f36b4505 76 if (value & 1) SET_EXT9 else CLR_EXT9;
Pokitto 0:e8b8f36b4505 77 value >>= 1;
Pokitto 0:e8b8f36b4505 78 if (value & 1) SET_EXT10 else CLR_EXT10;
Pokitto 0:e8b8f36b4505 79 value >>= 1;
Pokitto 0:e8b8f36b4505 80 if (value & 1) SET_EXT11 else CLR_EXT11;
Pokitto 0:e8b8f36b4505 81 value >>= 1;
Pokitto 0:e8b8f36b4505 82 if (value & 1) SET_EXT12 else CLR_EXT12;
Pokitto 0:e8b8f36b4505 83 value >>= 1;
Pokitto 0:e8b8f36b4505 84 if (value & 1) SET_EXT13 else CLR_EXT13;
Pokitto 0:e8b8f36b4505 85 value >>= 1;
Pokitto 0:e8b8f36b4505 86 if (value & 1) SET_EXT14 else CLR_EXT14;
Pokitto 0:e8b8f36b4505 87 value >>= 1;
Pokitto 0:e8b8f36b4505 88 if (value & 1) SET_EXT15 else CLR_EXT15;
Pokitto 0:e8b8f36b4505 89 value >>= 1;
Pokitto 0:e8b8f36b4505 90 if (value & 1) SET_EXT16 else CLR_EXT16;
Pokitto 0:e8b8f36b4505 91 value >>= 1;
Pokitto 0:e8b8f36b4505 92 if (value & 1) SET_EXT17 else CLR_EXT17;
Pokitto 0:e8b8f36b4505 93 #endif
Pokitto 0:e8b8f36b4505 94 }
Pokitto 0:e8b8f36b4505 95