Skip to content

Commit 093b5e9

Browse files
committed
add RA8875 support
code cleanup
1 parent f8a617e commit 093b5e9

File tree

3 files changed

+92
-27
lines changed

3 files changed

+92
-27
lines changed

src/VNC.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -929,32 +929,6 @@ bool arduinoVNC::rfb_send_key_event(int key, int down_flag) {
929929
return (write_exact(sock, (char*) &ke, sz_rfbKeyEventMsg));
930930
}
931931

932-
#if 0
933-
// not used need only performance and is not needed
934-
void arduinoVNC::rfb_get_rgb_from_data(int *r, int *g, int *b, char *data) {
935-
CARD16 foo16;
936-
937-
switch(opt.client.bpp) {
938-
case 8:
939-
DEBUG_VNC("FIXME unimplemented\n");
940-
break;
941-
case 16:
942-
memcpy(&foo16, data, 2);
943-
foo16 = Swap16IfLE(foo16);
944-
*r = ((foo16 >> opt.client.redshift) & opt.client.redmax) << 3;
945-
*g = ((foo16 >> opt.client.greenshift) & opt.client.greenmax) << 2;
946-
*b = ((foo16 >> opt.client.blueshift) & opt.client.bluemax) << 3;
947-
break;
948-
case 24:
949-
case 32:
950-
*r = data[2] & 0x00FF;
951-
*g = data[1] & 0x00FF;
952-
*b = data[0] & 0x00FF;
953-
break;
954-
}
955-
}
956-
#endif
957-
958932
//#############################################################################################
959933
// Encode handling
960934
//#############################################################################################
@@ -1133,7 +1107,7 @@ bool arduinoVNC::_handle_corre_encoded_message(rfbFramebufferUpdateRectHeader re
11331107

11341108
#ifdef VNC_HEXTILE
11351109
bool arduinoVNC::_handle_hextile_encoded_message(rfbFramebufferUpdateRectHeader rectheader) {
1136-
uint32_t rect_x, rect_y, rect_w, rect_h, rect_x_end, rect_y_end, rect_x_max, rect_y_max, i = 0, j = 0;
1110+
uint32_t rect_x, rect_y, rect_w, rect_h, i = 0, j = 0;
11371111
uint32_t rect_xW, rect_yW;
11381112

11391113
uint32_t tile_w = 16, tile_h = 16;

src/VNC_RA8875.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* VNC_RA8875.cpp
3+
*
4+
* Created on: 12.05.2015
5+
* Author: links
6+
*/
7+
8+
#include "VNC.h"
9+
10+
#include <Adafruit_RA8875.h>
11+
#include "VNC_RA8875.h"
12+
13+
RA8875VNC::RA8875VNC(int8_t _CS, int8_t _RST = -1) :
14+
Adafruit_RA8875(_CS, _RST = -1) {
15+
}
16+
17+
bool RA8875VNC::hasCopyRect(void) {
18+
return false;
19+
}
20+
21+
uint32_t RA8875VNC::getHeight(void) {
22+
return Adafruit_RA8875::_height;
23+
}
24+
25+
uint32_t RA8875VNC::getWidth(void) {
26+
return Adafruit_RA8875::_width;
27+
}
28+
29+
void RA8875VNC::draw_area(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *data) {
30+
// Adafruit_RA8875::area_update_start(x, y, w, h);
31+
//Adafruit_RA8875::area_update_data(data, (w*h));
32+
// Adafruit_RA8875::area_update_end();
33+
}
34+
35+
36+
void RA8875VNC::draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint16_t color) {
37+
Adafruit_RA8875::fillRect(x, y, w, h, ((((color) & 0xff) << 8) | (((color) >> 8))));
38+
}
39+
40+
void RA8875VNC::copy_rect(uint32_t src_x, uint32_t src_y, uint32_t dest_x, uint32_t dest_y, uint32_t w, uint32_t h) {
41+
42+
}
43+
44+
void RA8875VNC::area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h) {
45+
Adafruit_RA8875::area_update_start(x, y, w, h);
46+
}
47+
48+
void RA8875VNC::area_update_data(char *data, uint32_t pixel){
49+
Adafruit_RA8875::area_update_data((uint8_t *)data, pixel);
50+
}
51+
52+
void RA8875VNC::area_update_end(void){
53+
Adafruit_RA8875::area_update_end();
54+
}

src/VNC_RA8875.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* VNC_RA8875.h
3+
*
4+
* Created on: 12.05.2015
5+
* Author: Markus Sattler
6+
*/
7+
8+
#ifndef VNC_RA8875_H_
9+
#define VNC_RA8875_H_
10+
11+
#include <Adafruit_RA8875.h>
12+
#include "VNC_RA8875.h"
13+
#include "VNC.h"
14+
15+
class RA8875VNC: public VNCdisplay, public Adafruit_RA8875 {
16+
public:
17+
RA8875VNC(int8_t _CS, int8_t _RST);
18+
19+
bool hasCopyRect(void);
20+
21+
uint32_t getHeight(void);
22+
uint32_t getWidth(void);
23+
24+
void draw_area(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *data);
25+
26+
27+
void draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint16_t color);
28+
29+
void copy_rect(uint32_t src_x, uint32_t src_y, uint32_t dest_x, uint32_t dest_y, uint32_t w, uint32_t h);
30+
31+
void area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
32+
void area_update_data(char *data, uint32_t pixel);
33+
void area_update_end(void);
34+
35+
};
36+
37+
#endif /* MARKUS_VNC_RA8875_H_ */

0 commit comments

Comments
 (0)