Skip to content
Permalink
Browse files

Merge pull request #7 from matgoebl/master

  • Loading branch information...
smaffer committed Nov 3, 2019
2 parents acfdc20 + 21ec37c commit a6f1a065bb7fa54577e44b9d58d626bc02c48488
Showing with 26 additions and 4 deletions.
  1. +1 −1 ESPVGAX.cpp
  2. +24 −2 ESPVGAX.h
  3. +1 −1 espvgax_draw.h
@@ -149,7 +149,7 @@ void ESPVGAX::end() {
#endif
interrupts();
}
void ESPVGAX::delay(uint32_t msec) {
void ICACHE_RAM_ATTR ESPVGAX::delay(uint32_t msec) {
// predict the CPU ticks to be awaited
uint32_t us=msec*1000;
uint32_t start=TICKS;
@@ -41,7 +41,7 @@ hardware wiring and library usage.
* enable EXTRA COLORS generation. Two additional PINs are used. These colors
* will cover one or more lines
*/
#define ESPVGAX_EXTRA_COLORS
//#define ESPVGAX_EXTRA_COLORS
/*
* optional PIN for line coloring, used only if ESPVGAX_EXTRA_COLORS is defined
*
@@ -270,21 +270,36 @@ class ESPVGAX {
#define WRITE_PIXEL_BASE \
uint8_t *p=(uint8_t*)&fbb[y*ESPVGAX_BWIDTH + (x>>3)]; \
uint8_t shift=7-(x & 7); \
c&=1;
c=c>0?1:0;
WRITE_PIXEL_BASE;
*p&=~(1<<shift);
*p|= (c<<shift);
}
static inline void orpixel(int x, int y, uint8_t c) {
WRITE_PIXEL_BASE;
c=c>0?1:0;
*p|=(c<<shift);
}
static inline void xorpixel(int x, int y, uint8_t c) {
WRITE_PIXEL_BASE;
#undef WRITE_PIXEL_BASE
c=c>0?1:0;
*p^=(c<<shift);
#undef WRITE_PIXEL_BASE
}
/*
* getpixel(x, y)
* x: horizontal pixel coordinate. Must be less than ESPVGAX_WIDTH
* y: vertical pixel coordinate. Must be less than ESPVGAX_HEIGHT
* return: 1bit color at <x,y> coordinate
*/
static inline uint8_t getpixel(int x, int y) {
if (isXOutside(x) || isYOutside(y))
return 0;
uint8_t *p=(uint8_t*)&fbb[y*ESPVGAX_BWIDTH + (x>>3)];
uint8_t shift=7-(x & 7);
return ( (*p) >> shift ) & 1;
}
/*
* blit_P(src, dx, dy, srcw, scrh, op, scrwstride)
* blit (src, dx, dy, srcw, scrh, op, scrwstride)
@@ -494,6 +509,13 @@ class ESPVGAX {
* the number of pixels in a line!
*/
static volatile uint8_t *fbb;
/*
* tone(uint8_t t)
* noTone()
* Yet unimplemented.
*/
static inline void tone(uint8_t t) {}
static inline void noTone() {}
};
#ifndef SWAP_UINT16
#define SWAP_UINT16(x) (((x)>>8) | ((x)<<8))
@@ -14,7 +14,7 @@ static inline void draw_row(int line, int x0, int x1, uint8_t c, int op) {
x1=tmp;
}
int sw=x1-x0;
while (x0%32) {
while (x0%32 && sw > 32) {
ESPVGAX::putpixel(x0, line, c, op);
x0++;
sw--;

0 comments on commit a6f1a06

Please sign in to comment.
You can’t perform that action at this time.