Jonne Valola / PokittoLib Featured

Dependents:   YATTT sd_map_test cPong SnowDemo ... more

PokittoLib

Library for programming Pokitto hardware

How to Use

  1. Import this library to online compiler (see button "import" on the right hand side
  2. DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
  3. Change My_settings.h according to your project
  4. Start coding!

Files at this revision

API Documentation at this revision

Comitter:
Pokitto
Date:
Sun Oct 07 10:19:52 2018 +0000
Parent:
59:61d308a0b113
Child:
61:123aefc978a7
Child:
64:1d52d8287c39
Commit message:
Rid of all warnings on build all

Changed in this revision

POKITTO_CORE/PokittoCore.h Show annotated file Show diff for this revision Revisions of this file
POKITTO_CORE/PokittoDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
POKITTO_CORE/PokittoGlobs.h Show annotated file Show diff for this revision Revisions of this file
POKITTO_HW/HWLCD.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/POKITTO_CORE/PokittoCore.h	Sun Oct 07 10:10:24 2018 +0000
+++ b/POKITTO_CORE/PokittoCore.h	Sun Oct 07 10:19:52 2018 +0000
@@ -62,6 +62,7 @@
 #include "PokittoFakeavr.h"
 
 #define PALETTE_SIZE 256
+#undef PI
 #define PI 3.141592741f
 
 // For GB compatibility
--- a/POKITTO_CORE/PokittoDisplay.cpp	Sun Oct 07 10:10:24 2018 +0000
+++ b/POKITTO_CORE/PokittoDisplay.cpp	Sun Oct 07 10:19:52 2018 +0000
@@ -532,10 +532,10 @@
         uint16_t j = POK_BITFRAME;
         if (bgcolor & 0x1) memset((void*)m_scrbuf,0xFF,j);// R
         else memset((void*)m_scrbuf,0x00,j);// R
-        if ((bgcolor>>1) & 0x1) memset((void*)m_scrbuf+POK_BITFRAME,0xFF,j);// G
-        else memset((void*)m_scrbuf+POK_BITFRAME,0x00,j);// G
-        if ((bgcolor>>2) & 0x1) memset((void*)m_scrbuf+POK_BITFRAME*2,0xFF,j);// B
-        else memset((void*)m_scrbuf+POK_BITFRAME*2,0x00,j);// B
+        if ((bgcolor>>1) & 0x1) memset((void*)((uint8_t*)m_scrbuf+POK_BITFRAME),0xFF,j);// G
+        else memset((void*)((uint8_t*)m_scrbuf+POK_BITFRAME),0x00,j);// G
+        if ((bgcolor>>2) & 0x1) memset((void*)((uint8_t*)m_scrbuf+POK_BITFRAME*2),0xFF,j);// B
+        else memset((void*)((uint8_t*)m_scrbuf+POK_BITFRAME*2),0x00,j);// B
         setCursor(0,0);
         return;
     } else {
@@ -1492,11 +1492,10 @@
 
     /** 3 bpp mode */
     else if (m_colordepth==3) {
-        int16_t i, j, byteNum, bitNum, byteWidth = (w + 7) >> 3;
+        int16_t i, j, byteNum, byteWidth = (w + 7) >> 3;
         int16_t bitFrame = w * h / 8;
         for (i = 0; i < w; i++) {
         byteNum = i / 8;
-        bitNum = i % 8;
 
         uint8_t bitcount=0;
         for (j = 0; j <= h/8; j++) {
@@ -1592,15 +1591,14 @@
     /** 4bpp fast version */
 
     if (m_colordepth==8) {
-	int16_t scrx,scry,xclip,xjump,scrxjump;
-    xclip=xjump=scrxjump=0;
+	int16_t scrx,scry,xjump,scrxjump;
+    xjump=scrxjump=0;
     /** y clipping */
     if (y<0) { h+=y; bitmap -= y*w; y=0;}
     else if (y+h>height) { h -=(y-height);}
     /** x clipping */
-    if (x<0) { xclip=x; w+=x; xjump = (-x); bitmap += xjump; x=0;}
+    if (x<0) { w+=x; xjump = (-x); bitmap += xjump; x=0;}
     else if (x+w>width) {
-            xclip = x;
             scrxjump = x;
             xjump=(x+w-width)+scrxjump;
             w = width-x;}
--- a/POKITTO_CORE/PokittoGlobs.h	Sun Oct 07 10:10:24 2018 +0000
+++ b/POKITTO_CORE/PokittoGlobs.h	Sun Oct 07 10:19:52 2018 +0000
@@ -52,6 +52,8 @@
 extern int random(int);
 extern int random(int,int);
 
+#undef HIGH
+#undef LOW
 #define HIGH    1
 #define LOW     0
 
--- a/POKITTO_HW/HWLCD.cpp	Sun Oct 07 10:10:24 2018 +0000
+++ b/POKITTO_HW/HWLCD.cpp	Sun Oct 07 10:19:52 2018 +0000
@@ -455,9 +455,9 @@
 */
 void Pokitto::lcdRefreshMode1(uint8_t * scrbuf, uint8_t updRectX, uint8_t updRectY, uint8_t updRectW, uint8_t updRectH, uint16_t* paletteptr) {
 
-    uint16_t x,y,xptr;
+    uint16_t x,y;
     uint16_t scanline[4][176]; // read 4 half-nibbles = 4 pixels at a time
-    uint8_t *d, yoffset=0;
+    uint8_t *d;
 
     // If not the full screen is updated, check the validity of the update rect.
     if ( updRectX != 0 || updRectY != 0 ||updRectW != LCDWIDTH ||updRectH != LCDHEIGHT ) {
@@ -477,7 +477,6 @@
     xptr = 8;
     setDRAMptr(8, 0);
     #else
-    xptr = 0;
     setDRAMptr(0, 0);
     #endif
 
@@ -485,7 +484,6 @@
         d = scrbuf+(x>>2);// point to beginning of line in data
 
         /** find colours in one scanline **/
-        uint8_t s=0;
         d += (updRectY * 220/4);
         for (y=updRectY; y<updRectY+updRectH; y++) {
             uint8_t tdata = *d;
@@ -960,7 +958,7 @@
     
 
 void Pokitto::lcdRefreshMode2(uint8_t * scrbuf, uint16_t* paletteptr ) {
-  uint32_t x,y,byte,c,t=1<<12;
+  uint32_t x,y;
   uint32_t scanline[110];
 
   write_command(0x03); write_data(0x1038);
@@ -1752,7 +1750,7 @@
    CLR_CS_SET_CD_RD_WR;
    SET_MASK_P2;
    
-   uint32_t x, y=0, c, t;
+   uint32_t x, y=0;
    
 #ifndef __ARMCC_VERSION
    asm volatile(
@@ -1851,7 +1849,7 @@
  }
 
 void Pokitto::lcdRefreshMode14(uint8_t * scrbuf, uint16_t* paletteptr) {
-uint16_t x,y,data,xptr;
+uint16_t x,y;
 uint16_t scanline[176]; uint16_t* scptr;
 uint8_t *d;
 
@@ -1988,11 +1986,10 @@
 #else
 
 void Pokitto::lcdRefreshMode15(uint16_t* paletteptr, uint8_t* scrbuf){
-uint16_t x,y,xptr;
+uint16_t x,y;
 uint16_t scanline[2][176]; // read two nibbles = pixels at a time
-uint8_t *d, yoffset=0;
+uint8_t *d;
 
-xptr = 0;
 //setDRAMptr(xptr,yoffset);
 
 write_command(0x20); write_data(0);