Fixed all printf related problems on discovery using workarounds and newlib nano-instead of newlib
This commit is contained in:
@@ -10,7 +10,7 @@ static CHECKBOX_STRUCT c_cbox;
|
|||||||
static NUMUPDOWN_STRUCT n_updown;
|
static NUMUPDOWN_STRUCT n_updown;
|
||||||
|
|
||||||
static void checkboxCB(void *checkbox, bool checked) {
|
static void checkboxCB(void *checkbox, bool checked) {
|
||||||
// printf("Checkbox %s\n",(checked?"checked":"unchecked"));
|
printf("Checkbox %s\n",(checked?"checked":"unchecked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void b_back_cb(void* button) {
|
static void b_back_cb(void* button) {
|
||||||
@@ -18,7 +18,7 @@ static void b_back_cb(void* button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void n_updown_cb(void* numupdown, int16_t value) {
|
static void n_updown_cb(void* numupdown, int16_t value) {
|
||||||
//printf("New NumUpDown Value %d\n",value);
|
printf("New NumUpDown Value %d\n",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void touchCB(void* touchArea, TOUCH_ACTION triggeredAction) {
|
static void touchCB(void* touchArea, TOUCH_ACTION triggeredAction) {
|
||||||
@@ -104,14 +104,14 @@ static void enter(void* screen) {
|
|||||||
n_updown.max=11;
|
n_updown.max=11;
|
||||||
n_updown.min =-5;
|
n_updown.min =-5;
|
||||||
n_updown.callback=n_updown_cb;
|
n_updown.callback=n_updown_cb;
|
||||||
//gui_numupdown_add(&n_updown);
|
gui_numupdown_add(&n_updown);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void leave(void* screen) {
|
static void leave(void* screen) {
|
||||||
gui_button_remove(&b_back);
|
gui_button_remove(&b_back);
|
||||||
gui_checkbox_remove(&c_cbox);
|
gui_checkbox_remove(&c_cbox);
|
||||||
//gui_numupdown_remove(&n_updown);
|
gui_numupdown_remove(&n_updown);
|
||||||
touch_unregister_area(&a_area);
|
touch_unregister_area(&a_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ LIBSEARCHDIRS+=$(LIB_DIR)/StmUsbHost
|
|||||||
LIBSEARCHDIRS+=$(LIB_DIR)/Pixy
|
LIBSEARCHDIRS+=$(LIB_DIR)/Pixy
|
||||||
|
|
||||||
|
|
||||||
LDFLAGS=--specs=nosys.specs -Wl,--gc-sections
|
LDFLAGS=--specs=nano.specs -Wl,--gc-sections
|
||||||
LDFLAGS+=$(addprefix -L,$(LIBSEARCHDIRS))
|
LDFLAGS+=$(addprefix -L,$(LIBSEARCHDIRS))
|
||||||
LDFLAGS+=$(addprefix -l,$(LIBS))
|
LDFLAGS+=$(addprefix -l,$(LIBS))
|
||||||
|
|
||||||
|
|||||||
@@ -411,41 +411,7 @@ void tft_reset_window()
|
|||||||
|
|
||||||
void ll_tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
|
void ll_tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
|
||||||
{
|
{
|
||||||
if(y1==y2){
|
if(abs(x2-x1) > abs(y2-y1)) //line has more distance in x than y => iterate over x distance
|
||||||
if(x2<x1){
|
|
||||||
tft_set_cursor(x2,y1);
|
|
||||||
do{
|
|
||||||
TFT_RAM = color;
|
|
||||||
} while(x2++!=x1);
|
|
||||||
} else {
|
|
||||||
tft_set_cursor(x1,y1);
|
|
||||||
do{
|
|
||||||
TFT_RAM = color;
|
|
||||||
} while(x1++!=x2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(x1==x2){
|
|
||||||
tft_write_reg(0x11,0x6030); // Change adresspointer direction
|
|
||||||
|
|
||||||
if(y2<y1)
|
|
||||||
{
|
|
||||||
tft_set_cursor(x1,y2);
|
|
||||||
do {
|
|
||||||
TFT_RAM = color;
|
|
||||||
} while(y2++!=y1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tft_set_cursor(x1,y1);
|
|
||||||
do {
|
|
||||||
TFT_RAM = color;
|
|
||||||
}while(y1++!=y2);
|
|
||||||
}
|
|
||||||
tft_write_reg(0x11,0x6018); // Set adresspointer direction normal again
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(abs(x2-x1) > abs(y2-y1))
|
|
||||||
{
|
{
|
||||||
//Without floating point!
|
//Without floating point!
|
||||||
int deltax = ((int)x2-(int)x1);
|
int deltax = ((int)x2-(int)x1);
|
||||||
@@ -470,7 +436,7 @@ void ll_tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16
|
|||||||
while(x++!=deltax);
|
while(x++!=deltax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // => iterate over y distance
|
||||||
{
|
{
|
||||||
int deltax = ((int)x2-(int)x1)<<1;
|
int deltax = ((int)x2-(int)x1)<<1;
|
||||||
int deltay = ((int)y2-(int)y1);
|
int deltay = ((int)y2-(int)y1);
|
||||||
@@ -495,7 +461,6 @@ void ll_tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void ll_tft_draw_pixel(uint16_t x,uint16_t y,uint16_t color)
|
void ll_tft_draw_pixel(uint16_t x,uint16_t y,uint16_t color)
|
||||||
{
|
{
|
||||||
@@ -521,20 +486,26 @@ void ll_tft_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = x1;
|
i = x1;
|
||||||
|
//Drawing the two horizontal lines
|
||||||
tft_set_cursor(x1, y1);
|
tft_set_cursor(x1, y1);
|
||||||
while(i++ != x2) TFT_RAM = color;
|
while(i++ != x2) TFT_RAM = color;
|
||||||
tft_set_cursor(x1,y2);
|
tft_set_cursor(x1,y2);
|
||||||
while(i-- != x1) TFT_RAM = color;
|
while(i-- != x1) TFT_RAM = color;
|
||||||
|
|
||||||
i = y1;
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
//uncommented because tft_write_reg seems to fail sometimes so it's safer to use draw line instead (below)
|
||||||
|
i = y1;
|
||||||
tft_write_reg(0x11,0x6030); // Change adresspointer direction
|
tft_write_reg(0x11,0x6030); // Change adresspointer direction
|
||||||
tft_set_cursor(x2, y1);
|
tft_set_cursor(x2, y1);
|
||||||
while(i++ != y2) TFT_RAM = color;
|
while(i++ != y2) TFT_RAM = color;
|
||||||
tft_set_cursor(x1, y1);
|
tft_set_cursor(x1, y1);
|
||||||
while(i-- != y1) TFT_RAM = color;
|
while(i-- != y1) TFT_RAM = color;
|
||||||
tft_write_reg(0x11,0x6018); // Set adresspointer direction normal again
|
tft_write_reg(0x11,0x6018); // Set adresspointer direction normal again
|
||||||
|
*/
|
||||||
|
tft_draw_line(x1,y1,x1,y2,color);
|
||||||
|
tft_draw_line(x2,y1,x2,y2,color);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ll_tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color)
|
void ll_tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color)
|
||||||
|
|||||||
Reference in New Issue
Block a user