Skip to content

Commit 167c415

Browse files
committed
Update to new API and addition of preliminary esp-idf support
1 parent 9dc226e commit 167c415

14 files changed

Lines changed: 6331 additions & 39 deletions

Fonts/Courier_Prime_32.h

Lines changed: 738 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Limelight_32.h

Lines changed: 736 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Lora_32.h

Lines changed: 819 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Black_10.h

Lines changed: 329 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Black_16.h

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Black_24.h

Lines changed: 550 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Black_32.h

Lines changed: 683 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Black_40.h

Lines changed: 806 additions & 0 deletions
Large diffs are not rendered by default.

Fonts/Roboto_Thin_32.h

Lines changed: 725 additions & 0 deletions
Large diffs are not rendered by default.

src/OneBitDisplay.cpp

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
// This define (WIMPY_MCU) precludes the use of hardware interfaces
1818
// such as I2C & SPI
1919
//
20+
#include "OneBitDisplay.h"
21+
2022
#if defined (__AVR_ATtiny85__) || defined (ARDUINO_ARCH_MCS51)
2123
#define WIMPY_MCU
2224
#endif
@@ -41,20 +43,22 @@
4143
#define HIGH 1
4244
#define LOW 0
4345
void delay(int);
44-
#else // Arduino
45-
46+
#else // Arduino/IDF
47+
#ifdef ARDUINO
4648
#include <Arduino.h>
49+
#include "obd_io.inl" // I/O (non-portable) code is in here
4750
#ifdef __AVR__
4851
#include <avr/pgmspace.h>
4952
#endif
5053

5154
#ifndef WIMPY_MCU
5255
#include <SPI.h>
5356
#endif
57+
#else // !ARDUINO
58+
#include "esp_generic.inl"
59+
#endif
5460

55-
#endif // _LINUX_
56-
#include "OneBitDisplay.h"
57-
#include "obd_io.inl" // I/O (non-portable) code is in here
61+
#endif // !_LINUX_
5862
#include "obd.inl" // All of the display interface code is in here
5963
#include "obd_gfx.inl" // drawing code
6064
#ifdef __cplusplus
@@ -188,7 +192,7 @@ void ONE_BIT_DISPLAY::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint1
188192
obdRectangle(&_obd, x, y, x+w-1, y+h-1, color, 1);
189193
} /* fillRect() */
190194

191-
void ONE_BIT_DISPLAY::setTextWrap(bool bWrap)
195+
void ONE_BIT_DISPLAY::setWordWrap(bool bWrap)
192196
{
193197
_obd.wrap = (int)bWrap;
194198
}
@@ -207,11 +211,11 @@ void ONE_BIT_DISPLAY::setCursor(int x, int y)
207211
_obd.iCursorY = y;
208212
} /* setCursor() */
209213

210-
int ONE_BIT_DISPLAY::loadG5Image(const uint8_t *pG5, int x, int y, int iFG, int iBG, float fScale)
214+
int ONE_BIT_DISPLAY::drawG5Image(const uint8_t *pG5, int x, int y, int iFG, int iBG, float fScale)
211215
{
212216
return obdLoadG5(&_obd, pG5, x, y, iFG, iBG, fScale);
213217
}
214-
int ONE_BIT_DISPLAY::loadBMP(const uint8_t *pBMP, int x, int y, int iFG, int iBG)
218+
int ONE_BIT_DISPLAY::drawBMP(const uint8_t *pBMP, int x, int y, int iFG, int iBG)
215219
{
216220
return obdLoadBMP(&_obd, pBMP, x, y, iFG, iBG);
217221
} /* loadBMP() */
@@ -363,7 +367,7 @@ char ucTemp[4];
363367
//
364368
// write (Arduino Print friend class)
365369
//
366-
#ifndef __AVR__
370+
#if !defined( __AVR__ ) && defined( ARDUINO )
367371
size_t ONE_BIT_DISPLAY::write(uint8_t c) {
368372
char szTemp[2]; // used to draw 1 character at a time to the C methods
369373
int w, h;
@@ -508,18 +512,12 @@ void ONE_BIT_DISPLAY::getStringBox(const char *string, BB_RECT *pRect)
508512
{
509513
obdGetStringBox(&_obd, (char *)string, pRect);
510514
}
515+
#ifdef ARDUINO
511516
void ONE_BIT_DISPLAY::getStringBox(const String &str, BB_RECT *pRect)
512517
{
513518
obdGetStringBox(&_obd, str.c_str(), pRect);
514519
}
515-
int ONE_BIT_DISPLAY::dataTime(void)
516-
{
517-
return _obd.iDataTime;
518-
}
519-
int ONE_BIT_DISPLAY::opTime(void)
520-
{
521-
return _obd.iOpTime;
522-
}
520+
#endif
523521
int16_t ONE_BIT_DISPLAY::width(void)
524522
{
525523
return _obd.width;
@@ -599,11 +597,12 @@ void ONE_BIT_DISPLAY::drawString(const char *pText, int x, int y)
599597
else
600598
obdWriteString(&_obd, 0, x, y, (char *)pText, _obd.iFont, _obd.iFG, 1);
601599
} /* drawString() */
600+
#ifdef ARDUINO
602601
void ONE_BIT_DISPLAY::drawString(String text, int x, int y)
603602
{
604603
drawString(text.c_str(), x, y);
605604
} /* drawString() */
606-
605+
#endif // ARDUINO
607606
void ONE_BIT_DISPLAY::backlight(int bOn)
608607
{
609608
obdBacklight(&_obd, bOn);

0 commit comments

Comments
 (0)