diff options
Diffstat (limited to 'oled/ss_oled.c')
-rw-r--r-- | oled/ss_oled.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/oled/ss_oled.c b/oled/ss_oled.c index c29171f..d2ec30d 100644 --- a/oled/ss_oled.c +++ b/oled/ss_oled.c @@ -602,7 +602,9 @@ static int16_t pgm_read_word(uint8_t *ptr) static void _I2CWrite(SSOLED *pOLED, unsigned char *pData, int iLen) { +#ifndef SDL2_BUILD I2CWrite(&pOLED->bbi2c, pOLED->oled_addr, pData, iLen); +#endif } /* _I2CWrite() */ #ifdef FUTURE @@ -727,7 +729,9 @@ int rc = OLED_NOT_FOUND; // Disable SPI mode code iCSPin = iDCPin = -1; +#ifndef SDL2_BUILD I2CInit(&pOLED->bbi2c, iSpeed); // on Linux, SDA = bus number, SCL = device address +#endif // Reset it #ifdef FUTURE @@ -743,6 +747,7 @@ int rc = OLED_NOT_FOUND; } #endif +#ifndef SDL2_BUILD // find the device address if requested if (iAddr == -1 || iAddr == 0 || iAddr == 0xff) // find it { @@ -765,6 +770,9 @@ int rc = OLED_NOT_FOUND; uint8_t u = 0; I2CReadRegister(&pOLED->bbi2c, pOLED->oled_addr, 0x00, &u, 1); // read the status register u &= 0x0f; // mask off power on/off bit +#else + uint8_t u = 3; // The type of display we are using +#endif if (u == 0x7 || u == 0xf) // SH1107 { pOLED->oled_type = OLED_128x128; @@ -1318,6 +1326,7 @@ unsigned char uc, ucOld; if (pOLED->ucScreen) uc = ucOld = pOLED->ucScreen[i]; +#ifndef SDL2_BUILD else if (pOLED->oled_type == OLED_132x64 || pOLED->oled_type == OLED_128x128) // SH1106/SH1107 can read data { uint8_t ucTemp[3]; @@ -1331,6 +1340,7 @@ unsigned char uc, ucOld; uc = ucOld = ucTemp[1]; // first byte is garbage } else +#endif uc = ucOld = 0; uc &= ~(0x1 << (y & 7)); |