Skip to content

Commit 22f8333

Browse files
committed
evm lcd module test
1 parent a030f69 commit 22f8333

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 80a337dc4cc980f80e595971147eb41458b29ae8
1+
Subproject commit 60fe8c0ae6e24d165cf42770b95c7df22b778386

drivers/zephyr/display/stm32_hal/display_ili9341.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static int ili9341_write(const struct device *dev, const u16_t x,
325325
ili9341_set_mem_area(data, x, y, desc->width, desc->height);
326326

327327
ili9341_write_cmd ( ILI9341_CMD_MEM_WRITE );
328-
uint32_t nbr_of_points = desc->height * desc->height;
328+
uint32_t nbr_of_points = desc->width * desc->height;
329329
uint32_t pixel_index = 0;
330330
for (uint32_t i = 0; i < nbr_of_points; i ++ ) {
331331
ili9341_write_data ( write_data_start[pixel_index++] | write_data_start[pixel_index++] >> 8 );

modules/evm/evm_module_lcd.c

+24
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#ifdef CONFIG_EVM_LCD
1616

1717
#include "evm_module.h"
18+
#include <drivers/display.h>
19+
20+
21+
uint16_t evm_lcd_color = 0;
1822

1923
//LCD()
2024
static evm_val_t evm_module_lcd(evm_t *e, evm_val_t *p, int argc, evm_val_t *v)
@@ -23,6 +27,12 @@ static evm_val_t evm_module_lcd(evm_t *e, evm_val_t *p, int argc, evm_val_t *v)
2327
EVM_UNUSED(p);
2428
EVM_UNUSED(argc);
2529
EVM_UNUSED(v);
30+
const char * name = evm_2_string(v);
31+
struct device * dev = device_get_binding(name);
32+
if (dev == NULL) {
33+
evm_set_err(evm_runtime, ec_type, "Driver is not found");
34+
}
35+
evm_object_set_ext_data(p, (intptr_t)dev);
2636
return EVM_VAL_UNDEFINED;
2737
}
2838

@@ -32,6 +42,8 @@ static evm_val_t evm_module_lcd_on(evm_t *e, evm_val_t *p, int argc, evm_val_t *
3242
EVM_UNUSED(p);
3343
EVM_UNUSED(argc);
3444
EVM_UNUSED(v);
45+
struct device * dev = (struct device *)evm_object_get_ext_data(p);
46+
display_blanking_off(dev);
3547
return EVM_VAL_UNDEFINED;
3648
}
3749

@@ -41,6 +53,8 @@ static evm_val_t evm_module_lcd_off(evm_t *e, evm_val_t *p, int argc, evm_val_t
4153
EVM_UNUSED(p);
4254
EVM_UNUSED(argc);
4355
EVM_UNUSED(v);
56+
struct device * dev = (struct device *)evm_object_get_ext_data(p);
57+
display_blanking_on(dev);
4458
return EVM_VAL_UNDEFINED;
4559
}
4660

@@ -51,6 +65,16 @@ static evm_val_t evm_module_lcd_set_pixel(evm_t *e, evm_val_t *p, int argc, evm_
5165
EVM_UNUSED(p);
5266
EVM_UNUSED(argc);
5367
EVM_UNUSED(v);
68+
struct device * dev = (struct device *)evm_object_get_ext_data(p);
69+
struct display_buffer_descriptor buf_desc;
70+
buf_desc.buf_size = 2;
71+
buf_desc.pitch = 1;
72+
buf_desc.width = 1;
73+
buf_desc.height = 1;
74+
75+
int x = evm_2_integer(v);
76+
int y = evm_2_integer(v + 1);
77+
display_write(dev, x, y, &buf_desc, &evm_lcd_color);
5478
return EVM_VAL_UNDEFINED;
5579
}
5680
//color = LCD.get_pixel(x, y)

0 commit comments

Comments
 (0)