Simulator HAL and build targets (#22418)

This commit is contained in:
Chris Pepper
2021-07-22 01:01:23 +01:00
committed by Scott Lahteine
parent e0fa6ed4f8
commit dc67705049
37 changed files with 1847 additions and 16 deletions

View File

@ -97,6 +97,11 @@
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
#define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
#elif defined(__PLAT_NATIVE_SIM__)
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_sw_spi_fn
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_ST7920_sw_spi_fn
#endif
#ifndef U8G_COM_HAL_SW_SPI_FN

View File

@ -360,7 +360,7 @@ void disp_gcode_icon(uint8_t file_num) {
uint32_t lv_open_gcode_file(char *path) {
#if ENABLED(SDSUPPORT)
uint32_t *ps4;
uint32_t pre_sread_cnt = UINT32_MAX;
uintptr_t pre_sread_cnt = UINTPTR_MAX;
char *cur_name;
cur_name = strrchr(path, '/');
@ -370,7 +370,7 @@ uint32_t lv_open_gcode_file(char *path) {
ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:");
// Ignore the beginning message of gcode file
if (ps4) {
pre_sread_cnt = (uint32_t)ps4 - (uint32_t)((uint32_t *)(&public_buf[0]));
pre_sread_cnt = (uintptr_t)ps4 - (uintptr_t)((uint32_t *)(&public_buf[0]));
card.setIndex(pre_sread_cnt);
}
return pre_sread_cnt;

View File

@ -560,11 +560,11 @@ char *creat_title_text() {
#if HAS_GCODE_PREVIEW
uint32_t gPicturePreviewStart = 0;
uintptr_t gPicturePreviewStart = 0;
void preview_gcode_prehandle(char *path) {
#if ENABLED(SDSUPPORT)
uint32_t pre_read_cnt = 0;
uintptr_t pre_read_cnt = 0;
uint32_t *p1;
char *cur_name;
@ -575,7 +575,7 @@ char *creat_title_text() {
p1 = (uint32_t *)strstr((char *)public_buf, ";simage:");
if (p1) {
pre_read_cnt = (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
pre_read_cnt = (uintptr_t)p1 - (uintptr_t)((uint32_t *)(&public_buf[0]));
To_pre_view = pre_read_cnt;
gcode_preview_over = true;
@ -606,7 +606,7 @@ char *creat_title_text() {
uint32_t br = card.read(public_buf, 400);
uint32_t *p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
if (p1) {
gPicturePreviewStart += (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
gPicturePreviewStart += (uintptr_t)p1 - (uintptr_t)((uint32_t *)(&public_buf[0]));
break;
}
else {

View File

@ -398,7 +398,7 @@ lv_fs_res_t sd_open_cb (lv_fs_drv_t * drv, void * file_p, const char * path, lv_
// find small image size
card.read(public_buf, 512);
public_buf[511] = '\0';
char* eol = strpbrk((const char*)public_buf, "\n\r");
const char* eol = strpbrk((const char*)public_buf, "\n\r");
small_image_size = (uintptr_t)eol - (uintptr_t)((uint32_t *)(&public_buf[0])) + 1;
return LV_FS_RES_OK;
}
@ -530,4 +530,10 @@ void lv_encoder_pin_init() {
#endif // HAS_ENCODER_ACTION
#if __PLAT_NATIVE_SIM__
#include <lv_misc/lv_log.h>
typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *);
extern "C" void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb) {}
#endif
#endif // HAS_TFT_LVGL_UI