From b609ce85b58b667bf562b6040ce66e3d252784b8 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Sun, 15 Jan 2017 19:31:22 +0100 Subject: [PATCH] nrf5: Adding configuration defines for the graphics module (draw) and enabling this by default if using oled ssd1306 display which has a compatible python object definition. --- nrf5/mpconfigport.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nrf5/mpconfigport.h b/nrf5/mpconfigport.h index 0b78313cf7..bebc429fc1 100644 --- a/nrf5/mpconfigport.h +++ b/nrf5/mpconfigport.h @@ -145,6 +145,8 @@ #define MICROPY_PY_DISPLAY_LCD_ILI9341 (0) #define MICROPY_PY_DISPLAY_OLED_SSD1306 (0) #define MICROPY_PY_DISPLAY_OLED_SSD1305 (0) +#define MICROPY_PY_LCD_MONO_FB (0) +#define MICROPY_PY_DISPLAY_FRAMEBUFFER (0) #elif MICROPY_PY_DISPLAY @@ -170,6 +172,11 @@ #define MICROPY_PY_DISPLAY_OLED_SSD1306 (0) #endif +#if MICROPY_PY_DISPLAY_OLED_SSD1306 +#define MICROPY_PY_DISPLAY_FRAMEBUFFER (1) +#define MICROPY_PY_DISPLAY_GRAPHICS (1) +#endif + #endif // MICROPY_PY_DISPLAY #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) @@ -205,6 +212,7 @@ extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_lcd_mono_fb; extern const struct _mp_obj_module_t mp_module_display; +extern const struct _mp_obj_module_t graphics_module; #if MICROPY_PY_USOCKET #define SOCKET_BUILTIN_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, @@ -232,6 +240,13 @@ extern const struct _mp_obj_module_t mp_module_display; #define DISPLAY_MODULE #endif +#if MICROPY_PY_DISPLAY_GRAPHICS +#define GRAPHICS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_draw), (mp_obj_t)&graphics_module }, +#else +#define GRAPHICS_MODULE +#endif + + #if BLUETOOTH_SD extern const struct _mp_obj_module_t ble_module; #define MICROPY_PORT_BUILTIN_MODULES \ @@ -245,6 +260,7 @@ extern const struct _mp_obj_module_t ble_module; NETWORK_BUILTIN_MODULE \ LCD_MONO_FB_MODULE \ DISPLAY_MODULE \ + GRAPHICS_MODULE \ #else @@ -256,6 +272,7 @@ extern const struct _mp_obj_module_t ble_module; { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \ LCD_MONO_FB_MODULE \ DISPLAY_MODULE \ + GRAPHICS_MODULE \ #endif // BLUETOOTH_SD