kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Micropython bindings for ColourLCD and minor tweaks for ST7789, and RoundLCD
rodzic
02c5817865
commit
16106d5596
|
@ -1,7 +1,12 @@
|
|||
add_library(st7789
|
||||
${CMAKE_CURRENT_LIST_DIR}/st7789.cpp)
|
||||
set(DRIVER_NAME st7789)
|
||||
add_library(${DRIVER_NAME} INTERFACE)
|
||||
|
||||
target_sources(${DRIVER_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
|
||||
|
||||
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
target_include_directories(st7789 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Pull in pico libraries that we need
|
||||
target_link_libraries(st7789 pico_stdlib hardware_spi hardware_pwm hardware_dma)
|
||||
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib hardware_spi hardware_pwm hardware_dma)
|
||||
|
|
|
@ -6,6 +6,8 @@ add_subdirectory(breakout_rgbmatrix5x5)
|
|||
add_subdirectory(breakout_matrix11x7)
|
||||
add_subdirectory(breakout_trackball)
|
||||
add_subdirectory(breakout_sgp30)
|
||||
add_subdirectory(breakout_colourlcd240x240)
|
||||
|
||||
add_subdirectory(pico_display)
|
||||
add_subdirectory(pico_unicorn)
|
||||
add_subdirectory(pico_unicorn_plasma)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
set(OUTPUT_NAME colourlcd240x240_demo)
|
||||
|
||||
add_executable(
|
||||
${OUTPUT_NAME}
|
||||
demo.cpp
|
||||
)
|
||||
|
||||
# Pull in pico libraries that we need
|
||||
target_link_libraries(${OUTPUT_NAME} pico_stdlib breakout_colourlcd240x240)
|
||||
|
||||
# create map/bin/hex file etc.
|
||||
pico_add_extra_outputs(${OUTPUT_NAME})
|
|
@ -0,0 +1,42 @@
|
|||
#include "pico/stdlib.h"
|
||||
#include "math.h"
|
||||
#include "breakout_colourlcd240x240.hpp"
|
||||
|
||||
using namespace pimoroni;
|
||||
|
||||
uint16_t buffer[BreakoutColourLCD240x240::WIDTH * BreakoutColourLCD240x240::HEIGHT];
|
||||
BreakoutColourLCD240x240 lcd(buffer);
|
||||
|
||||
int main() {
|
||||
gpio_init(PICO_DEFAULT_LED_PIN);
|
||||
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
|
||||
|
||||
lcd.init();
|
||||
lcd.set_backlight(255);
|
||||
|
||||
Pen my_pen = lcd.create_pen(255, 0, 0);
|
||||
|
||||
|
||||
uint32_t t = 0;
|
||||
|
||||
while(true) {
|
||||
uint16_t x = (sinf(float(t) / 100.0f) * 60) + 60;
|
||||
lcd.set_pen(0, 255, 0);
|
||||
lcd.clear();
|
||||
lcd.set_pen(255, 255, 0);
|
||||
lcd.rectangle(Rect(10, 10, 240-20, 240-20));
|
||||
|
||||
lcd.set_pen(0, 0, 255);
|
||||
lcd.rectangle(Rect(10, 10, 30, 30));
|
||||
lcd.set_pen(255, 0, 0);
|
||||
lcd.rectangle(Rect(x, x, 20, 20));
|
||||
lcd.update();
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, true);
|
||||
sleep_ms(8);
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, false);
|
||||
sleep_ms(8);
|
||||
t++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
add_subdirectory(breakout_dotmatrix)
|
||||
add_subdirectory(breakout_ltr559)
|
||||
add_subdirectory(breakout_colourlcd160x80)
|
||||
add_subdirectory(breakout_colourlcd240x240)
|
||||
add_subdirectory(breakout_roundlcd)
|
||||
add_subdirectory(breakout_rgbmatrix5x5)
|
||||
add_subdirectory(breakout_matrix11x7)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
set(LIB_NAME breakout_colourlcd240x240)
|
||||
add_library(${LIB_NAME} INTERFACE)
|
||||
|
||||
target_sources(${LIB_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Pull in pico libraries that we need
|
||||
target_link_libraries(${LIB_NAME} INTERFACE pico_stdlib st7789 pico_graphics)
|
|
@ -0,0 +1,14 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/../../drivers/st7789/st7789.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../pico_graphics/pico_graphics.cmake)
|
||||
|
||||
set(LIB_NAME breakout_colourlcd240x240)
|
||||
add_library(${LIB_NAME} INTERFACE)
|
||||
|
||||
target_sources(${LIB_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Pull in pico libraries that we need
|
||||
target_link_libraries(${LIB_NAME} INTERFACE pico_stdlib st7789 pico_graphics)
|
|
@ -0,0 +1,58 @@
|
|||
#include "breakout_colourlcd240x240.hpp"
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
BreakoutColourLCD240x240::BreakoutColourLCD240x240(uint16_t *buf)
|
||||
: PicoGraphics(WIDTH, HEIGHT, buf), screen(WIDTH, HEIGHT, buf) {
|
||||
__fb = buf;
|
||||
}
|
||||
|
||||
BreakoutColourLCD240x240::BreakoutColourLCD240x240(uint16_t *buf, spi_inst_t *spi,
|
||||
uint8_t cs, uint8_t dc, uint8_t sck, uint8_t mosi, uint8_t miso, uint8_t bl)
|
||||
: PicoGraphics(WIDTH, HEIGHT, buf), screen(WIDTH, HEIGHT, buf, spi, cs, dc, sck, mosi, miso, bl) {
|
||||
__fb = buf;
|
||||
}
|
||||
|
||||
BreakoutColourLCD240x240::BreakoutColourLCD240x240(uint16_t *buf, ST7789::BG_SPI_SLOT slot)
|
||||
: PicoGraphics(WIDTH, HEIGHT, buf), screen(WIDTH, HEIGHT, buf, slot) {
|
||||
__fb = buf;
|
||||
}
|
||||
|
||||
void BreakoutColourLCD240x240::init() {
|
||||
// initialise the screen
|
||||
screen.init();
|
||||
}
|
||||
|
||||
spi_inst_t* BreakoutColourLCD240x240::get_spi() const {
|
||||
return screen.get_spi();
|
||||
}
|
||||
|
||||
int BreakoutColourLCD240x240::get_cs() const {
|
||||
return screen.get_cs();
|
||||
}
|
||||
|
||||
int BreakoutColourLCD240x240::get_dc() const {
|
||||
return screen.get_dc();
|
||||
}
|
||||
|
||||
int BreakoutColourLCD240x240::get_sck() const {
|
||||
return screen.get_sck();
|
||||
}
|
||||
|
||||
int BreakoutColourLCD240x240::get_mosi() const {
|
||||
return screen.get_mosi();
|
||||
}
|
||||
|
||||
int BreakoutColourLCD240x240::get_bl() const {
|
||||
return screen.get_bl();
|
||||
}
|
||||
|
||||
void BreakoutColourLCD240x240::update() {
|
||||
screen.update();
|
||||
}
|
||||
|
||||
void BreakoutColourLCD240x240::set_backlight(uint8_t brightness) {
|
||||
screen.set_backlight(brightness);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../drivers/st7789/st7789.hpp"
|
||||
#include "../../libraries/pico_graphics/pico_graphics.hpp"
|
||||
|
||||
namespace pimoroni {
|
||||
|
||||
class BreakoutColourLCD240x240 : public PicoGraphics {
|
||||
//--------------------------------------------------
|
||||
// Constants
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
static const int WIDTH = 240;
|
||||
static const int HEIGHT = 240;
|
||||
static const uint8_t PIN_UNUSED = UINT8_MAX;
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// Variables
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
uint16_t *__fb;
|
||||
private:
|
||||
ST7789 screen;
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// Constructors/Destructor
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
BreakoutColourLCD240x240(uint16_t *buf);
|
||||
BreakoutColourLCD240x240(uint16_t *buf, spi_inst_t *spi,
|
||||
uint8_t cs, uint8_t dc, uint8_t sck, uint8_t mosi, uint8_t miso = PIN_UNUSED, uint8_t bl = PIN_UNUSED);
|
||||
BreakoutColourLCD240x240(uint16_t *buf, ST7789::BG_SPI_SLOT slot);
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// Methods
|
||||
//--------------------------------------------------
|
||||
public:
|
||||
void init();
|
||||
|
||||
spi_inst_t* get_spi() const;
|
||||
int get_cs() const;
|
||||
int get_dc() const;
|
||||
int get_sck() const;
|
||||
int get_mosi() const;
|
||||
int get_bl() const;
|
||||
|
||||
void update();
|
||||
void set_backlight(uint8_t brightness);
|
||||
};
|
||||
|
||||
}
|
|
@ -13,7 +13,8 @@ namespace pimoroni {
|
|||
__fb = buf;
|
||||
}
|
||||
|
||||
BreakoutRoundLCD::BreakoutRoundLCD(uint16_t *buf, ST7789::BG_SPI_SLOT slot) : PicoGraphics(WIDTH, HEIGHT, buf), screen(WIDTH, HEIGHT, buf, slot) {
|
||||
BreakoutRoundLCD::BreakoutRoundLCD(uint16_t *buf, ST7789::BG_SPI_SLOT slot)
|
||||
: PicoGraphics(WIDTH, HEIGHT, buf), screen(WIDTH, HEIGHT, buf, slot) {
|
||||
__fb = buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace pimoroni {
|
|||
static const int WIDTH = 240;
|
||||
static const int HEIGHT = 240;
|
||||
|
||||
static const uint8_t PIN_UNUSED = UINT8_MAX;
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// Variables
|
||||
|
@ -29,7 +31,7 @@ namespace pimoroni {
|
|||
public:
|
||||
BreakoutRoundLCD(uint16_t *buf);
|
||||
BreakoutRoundLCD(uint16_t *buf, spi_inst_t *spi,
|
||||
uint8_t cs, uint8_t dc, uint8_t sck, uint8_t mosi, uint8_t miso = -1, uint8_t bl = -1);
|
||||
uint8_t cs, uint8_t dc, uint8_t sck, uint8_t mosi, uint8_t miso = PIN_UNUSED, uint8_t bl = PIN_UNUSED);
|
||||
BreakoutRoundLCD(uint16_t *buf, ST7789::BG_SPI_SLOT slot);
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
import time, random
|
||||
from breakout_colourlcd240x240 import BreakoutColourLCD240x240
|
||||
|
||||
width = BreakoutColourLCD240x240.WIDTH
|
||||
height = BreakoutColourLCD240x240.HEIGHT
|
||||
|
||||
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
|
||||
display = BreakoutColourLCD240x240(display_buffer)
|
||||
|
||||
display.set_backlight(1.0)
|
||||
|
||||
|
||||
class Ball:
|
||||
def __init__(self, x, y, r, dx, dy, pen):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.r = r
|
||||
self.dx = dx
|
||||
self.dy = dy
|
||||
self.pen = pen
|
||||
|
||||
# initialise shapes
|
||||
balls = []
|
||||
for i in range(0, 100):
|
||||
r = random.randint(0, 10) + 3
|
||||
balls.append(
|
||||
Ball(
|
||||
random.randint(r, r + (width - 2 * r)),
|
||||
random.randint(r, r + (height - 2 * r)),
|
||||
r,
|
||||
(14 - r) / 2,
|
||||
(14 - r) / 2,
|
||||
display.create_pen(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)),
|
||||
)
|
||||
)
|
||||
|
||||
while True:
|
||||
display.set_pen(40, 40, 40)
|
||||
display.clear()
|
||||
|
||||
for ball in balls:
|
||||
ball.x += ball.dx
|
||||
ball.y += ball.dy
|
||||
|
||||
xmax = width - ball.r
|
||||
xmin = ball.r
|
||||
ymax = height - ball.r
|
||||
ymin = ball.r
|
||||
|
||||
if ball.x < xmin or ball.x > xmax:
|
||||
ball.dx *= -1
|
||||
|
||||
if ball.y < ymin or ball.y > ymax:
|
||||
ball.dy *= -1
|
||||
|
||||
display.set_pen(ball.pen)
|
||||
display.circle(int(ball.x), int(ball.y), int(ball.r))
|
||||
|
||||
display.update()
|
||||
time.sleep(0.01)
|
|
@ -0,0 +1,78 @@
|
|||
#include "breakout_colourlcd240x240.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// BreakoutColourLCD240x240 Class
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***** Methods *****/
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutColourLCD240x240_update_obj, BreakoutColourLCD240x240_update);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_set_backlight_obj, 1, BreakoutColourLCD240x240_set_backlight);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_set_pen_obj, 1, BreakoutColourLCD240x240_set_pen);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_create_pen_obj, 1, BreakoutColourLCD240x240_create_pen);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_set_clip_obj, 1, BreakoutColourLCD240x240_set_clip);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutColourLCD240x240_remove_clip_obj, BreakoutColourLCD240x240_remove_clip);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(BreakoutColourLCD240x240_clear_obj, BreakoutColourLCD240x240_clear);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_pixel_obj, 1, BreakoutColourLCD240x240_pixel);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_pixel_span_obj, 1, BreakoutColourLCD240x240_pixel_span);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_rectangle_obj, 1, BreakoutColourLCD240x240_rectangle);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_circle_obj, 1, BreakoutColourLCD240x240_circle);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_character_obj, 1, BreakoutColourLCD240x240_character);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_text_obj, 1, BreakoutColourLCD240x240_text);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_polygon_obj, 1, BreakoutColourLCD240x240_polygon);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_triangle_obj, 1, BreakoutColourLCD240x240_triangle);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutColourLCD240x240_line_obj, 1, BreakoutColourLCD240x240_line);
|
||||
|
||||
/***** Binding of Methods *****/
|
||||
STATIC const mp_rom_map_elem_t BreakoutColourLCD240x240_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&BreakoutColourLCD240x240_update_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_set_backlight), MP_ROM_PTR(&BreakoutColourLCD240x240_set_backlight_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_set_pen), MP_ROM_PTR(&BreakoutColourLCD240x240_set_pen_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_create_pen), MP_ROM_PTR(&BreakoutColourLCD240x240_create_pen_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_set_clip), MP_ROM_PTR(&BreakoutColourLCD240x240_set_clip_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_remove_clip), MP_ROM_PTR(&BreakoutColourLCD240x240_remove_clip_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&BreakoutColourLCD240x240_clear_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_pixel), MP_ROM_PTR(&BreakoutColourLCD240x240_pixel_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_pixel_span), MP_ROM_PTR(&BreakoutColourLCD240x240_pixel_span_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rectangle), MP_ROM_PTR(&BreakoutColourLCD240x240_rectangle_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_circle), MP_ROM_PTR(&BreakoutColourLCD240x240_circle_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_character), MP_ROM_PTR(&BreakoutColourLCD240x240_character_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&BreakoutColourLCD240x240_text_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_polygon), MP_ROM_PTR(&BreakoutColourLCD240x240_polygon_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_triangle), MP_ROM_PTR(&BreakoutColourLCD240x240_triangle_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_line), MP_ROM_PTR(&BreakoutColourLCD240x240_line_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(WIDTH) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(HEIGHT) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(BreakoutColourLCD240x240_locals_dict, BreakoutColourLCD240x240_locals_dict_table);
|
||||
|
||||
/***** Class Definition *****/
|
||||
const mp_obj_type_t breakout_colourlcd240x240_BreakoutColourLCD240x240_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_breakout_colourlcd240x240,
|
||||
.print = BreakoutColourLCD240x240_print,
|
||||
.make_new = BreakoutColourLCD240x240_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&BreakoutColourLCD240x240_locals_dict,
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// breakout_colourlcd240x240 Module
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***** Globals Table *****/
|
||||
STATIC const mp_map_elem_t breakout_colourlcd240x240_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_colourlcd240x240) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutColourLCD240x240), (mp_obj_t)&breakout_colourlcd240x240_BreakoutColourLCD240x240_type },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_colourlcd240x240_globals, breakout_colourlcd240x240_globals_table);
|
||||
|
||||
/***** Module Definition *****/
|
||||
const mp_obj_module_t breakout_colourlcd240x240_user_cmodule = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t*)&mp_module_breakout_colourlcd240x240_globals,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
MP_REGISTER_MODULE(MP_QSTR_breakout_colourlcd240x240, breakout_colourlcd240x240_user_cmodule, MODULE_BREAKOUT_COLOURLCD240X240_ENABLED);
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,545 @@
|
|||
#include "../../../pimoroni-pico/libraries/breakout_colourlcd240x240/breakout_colourlcd240x240.hpp"
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
#define IS_VALID_PERIPH(spi, pin) ((((pin) & 8) >> 3) == (spi))
|
||||
#define IS_VALID_SCK(spi, pin) (((pin) & 3) == 2 && IS_VALID_PERIPH(spi, pin))
|
||||
#define IS_VALID_MOSI(spi, pin) (((pin) & 3) == 3 && IS_VALID_PERIPH(spi, pin))
|
||||
#define IS_VALID_MISO(spi, pin) (((pin) & 3) == 0 && IS_VALID_PERIPH(spi, pin))
|
||||
|
||||
|
||||
using namespace pimoroni;
|
||||
|
||||
extern "C" {
|
||||
#include "breakout_colourlcd240x240.h"
|
||||
|
||||
/***** Variables Struct *****/
|
||||
typedef struct _breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t {
|
||||
mp_obj_base_t base;
|
||||
BreakoutColourLCD240x240 *breakout;
|
||||
} breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t;
|
||||
|
||||
/***** Print *****/
|
||||
void BreakoutColourLCD240x240_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
(void)kind; //Unused input parameter
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(self_in, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
BreakoutColourLCD240x240* breakout = self->breakout;
|
||||
mp_print_str(print, "BreakoutColourLCD240x240(");
|
||||
|
||||
mp_print_str(print, "spi = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_spi() == spi0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", cs = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_cs()), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", dc = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_dc()), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", sck = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sck()), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", mosi = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_mosi()), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", bl = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_bl()), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ")");
|
||||
}
|
||||
|
||||
/***** Constructor *****/
|
||||
mp_obj_t BreakoutColourLCD240x240_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = nullptr;
|
||||
|
||||
if(n_args <= 1) {
|
||||
enum { ARG_buffer };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
};
|
||||
|
||||
// Parse args.
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
self = m_new_obj(breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->base.type = &breakout_colourlcd240x240_BreakoutColourLCD240x240_type;
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_RW);
|
||||
|
||||
self->breakout = new BreakoutColourLCD240x240((uint16_t *)bufinfo.buf);
|
||||
}
|
||||
else if(n_args == 2) {
|
||||
enum { ARG_buffer, ARG_slot };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_slot, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
// Parse args.
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
int slot = args[ARG_slot].u_int;
|
||||
if(slot == ST7789::BG_SPI_FRONT || slot == ST7789::BG_SPI_BACK) {
|
||||
self = m_new_obj(breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->base.type = &breakout_colourlcd240x240_BreakoutColourLCD240x240_type;
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_RW);
|
||||
|
||||
self->breakout = new BreakoutColourLCD240x240((uint16_t *)bufinfo.buf, (ST7789::BG_SPI_SLOT)slot);
|
||||
}
|
||||
else {
|
||||
mp_raise_ValueError("slot not a valid value. Expected 0 to 1");
|
||||
}
|
||||
}
|
||||
else {
|
||||
enum { ARG_buffer, ARG_spi, ARG_cs, ARG_dc, ARG_sck, ARG_mosi, ARG_bl };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_cs, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_dc, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_sck, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_mosi, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_bl, MP_ARG_INT, {.u_int = BreakoutColourLCD240x240::PIN_UNUSED} },
|
||||
};
|
||||
|
||||
// Parse args.
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_RW);
|
||||
|
||||
// Get SPI bus.
|
||||
int spi_id = args[ARG_spi].u_int;
|
||||
if(spi_id < 0 || spi_id > 1) {
|
||||
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("SPI(%d) doesn't exist"), spi_id);
|
||||
}
|
||||
|
||||
int sck = args[ARG_sck].u_int;
|
||||
if(!IS_VALID_SCK(spi_id, sck)) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("bad SCK pin"));
|
||||
}
|
||||
|
||||
int mosi = args[ARG_mosi].u_int;
|
||||
if(!IS_VALID_SCK(spi_id, mosi)) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("bad MOSI pin"));
|
||||
}
|
||||
|
||||
self = m_new_obj(breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->base.type = &breakout_colourlcd240x240_BreakoutColourLCD240x240_type;
|
||||
|
||||
spi_inst_t *spi = (spi_id == 0) ? spi0 : spi1;
|
||||
self->breakout = new BreakoutColourLCD240x240((uint16_t *)bufinfo.buf, spi,
|
||||
args[ARG_cs].u_int, args[ARG_dc].u_int, sck, mosi, BreakoutColourLCD240x240::PIN_UNUSED, args[ARG_bl].u_int);
|
||||
}
|
||||
|
||||
self->breakout->init();
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
/***** Methods *****/
|
||||
mp_obj_t BreakoutColourLCD240x240_update(mp_obj_t self_in) {
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(self_in, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->breakout->update();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_set_backlight(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_brightness };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_brightness, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
float brightness = mp_obj_get_float(args[ARG_brightness].u_obj);
|
||||
|
||||
if(brightness < 0 || brightness > 1.0f)
|
||||
mp_raise_ValueError("brightness out of range. Expected 0.0 to 1.0");
|
||||
else
|
||||
self->breakout->set_backlight((uint8_t)(brightness * 255.0f));
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_set_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
|
||||
if(n_args <= 2) {
|
||||
enum { ARG_self, ARG_pen };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_pen, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int pen = args[ARG_pen].u_int;
|
||||
|
||||
if(pen < 0 || pen > 0xffff)
|
||||
mp_raise_ValueError("p is not a valid pen.");
|
||||
else
|
||||
self->breakout->set_pen(pen);
|
||||
}
|
||||
else {
|
||||
enum { ARG_self, ARG_r, ARG_g, ARG_b };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_r, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_g, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_b, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int r = args[ARG_r].u_int;
|
||||
int g = args[ARG_g].u_int;
|
||||
int b = args[ARG_b].u_int;
|
||||
|
||||
if(r < 0 || r > 255)
|
||||
mp_raise_ValueError("r out of range. Expected 0 to 255");
|
||||
else if(g < 0 || g > 255)
|
||||
mp_raise_ValueError("g out of range. Expected 0 to 255");
|
||||
else if(b < 0 || b > 255)
|
||||
mp_raise_ValueError("b out of range. Expected 0 to 255");
|
||||
else
|
||||
self->breakout->set_pen(r, g, b);
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_create_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
int pen = 0;
|
||||
|
||||
enum { ARG_self, ARG_r, ARG_g, ARG_b };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_r, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_g, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_b, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int r = args[ARG_r].u_int;
|
||||
int g = args[ARG_g].u_int;
|
||||
int b = args[ARG_b].u_int;
|
||||
|
||||
if(r < 0 || r > 255)
|
||||
mp_raise_ValueError("r out of range. Expected 0 to 255");
|
||||
else if(g < 0 || g > 255)
|
||||
mp_raise_ValueError("g out of range. Expected 0 to 255");
|
||||
else if(b < 0 || b > 255)
|
||||
mp_raise_ValueError("b out of range. Expected 0 to 255");
|
||||
else
|
||||
pen = self->breakout->create_pen(r, g, b);
|
||||
|
||||
return mp_obj_new_int(pen);
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_set_clip(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x, ARG_y, ARG_w, ARG_h };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_w, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_h, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
int w = args[ARG_w].u_int;
|
||||
int h = args[ARG_h].u_int;
|
||||
|
||||
Rect r(x, y, w, h);
|
||||
self->breakout->set_clip(r);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_remove_clip(mp_obj_t self_in) {
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(self_in, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->breakout->remove_clip();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_clear(mp_obj_t self_in) {
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(self_in, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
self->breakout->clear();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_pixel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x, ARG_y };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
|
||||
Point p(x, y);
|
||||
self->breakout->pixel(p);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_pixel_span(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x, ARG_y, ARG_l };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_l, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
int l = args[ARG_l].u_int;
|
||||
|
||||
Point p(x, y);
|
||||
self->breakout->pixel_span(p, l);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_rectangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x, ARG_y, ARG_w, ARG_h };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_w, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_h, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
int w = args[ARG_w].u_int;
|
||||
int h = args[ARG_h].u_int;
|
||||
|
||||
Rect r(x, y, w, h);
|
||||
self->breakout->rectangle(r);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_circle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x, ARG_y, ARG_r };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_r, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
int r = args[ARG_r].u_int;
|
||||
|
||||
Point p(x, y);
|
||||
self->breakout->circle(p, r);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_character(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_char, ARG_x, ARG_y, ARG_scale };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_char, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_scale, MP_ARG_INT, {.u_int = 2} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int c = mp_obj_get_int(args[ARG_char].u_obj);
|
||||
int x = args[ARG_y].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
|
||||
Point p(x, y);
|
||||
if(n_args == 4) {
|
||||
int scale = args[ARG_scale].u_int;
|
||||
self->breakout->character((char)c, p, scale);
|
||||
}
|
||||
else
|
||||
self->breakout->character((char)c, p);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_text, ARG_x, ARG_y, ARG_wrap, ARG_scale };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_text, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_wr, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_scale, MP_ARG_INT, {.u_int = 2} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
mp_check_self(mp_obj_is_str_or_bytes(args[ARG_text].u_obj));
|
||||
GET_STR_DATA_LEN(args[ARG_text].u_obj, str, str_len);
|
||||
|
||||
std::string t((const char*)str);
|
||||
|
||||
int x = args[ARG_x].u_int;
|
||||
int y = args[ARG_y].u_int;
|
||||
int wrap = args[ARG_wrap].u_int;
|
||||
|
||||
Point p(x, y);
|
||||
if(n_args == 5) {
|
||||
int scale = args[ARG_scale].u_int;
|
||||
self->breakout->text(t, p, wrap, scale);
|
||||
}
|
||||
else
|
||||
self->breakout->text(t, p, wrap);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_polygon(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
// enum { ARG_self, ARG_x, ARG_y, ARG_r };
|
||||
// static const mp_arg_t allowed_args[] = {
|
||||
// { MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
// { MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
// { MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
// { MP_QSTR_r, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
// };
|
||||
|
||||
// mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
// mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
// breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
// int x = args[ARG_x].u_int;
|
||||
// int y = args[ARG_y].u_int;
|
||||
// int r = args[ARG_r].u_int;
|
||||
|
||||
// Point p(x, y);
|
||||
// self->breakout->circle(p, r);
|
||||
|
||||
mp_raise_NotImplementedError("polygon is not implemented. Please avoid using this function for now");
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_triangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_x3, ARG_y3 };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_x3, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y3, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x1 = args[ARG_x1].u_int;
|
||||
int y1 = args[ARG_y1].u_int;
|
||||
int x2 = args[ARG_x1].u_int;
|
||||
int y2 = args[ARG_y1].u_int;
|
||||
int x3 = args[ARG_x1].u_int;
|
||||
int y3 = args[ARG_y1].u_int;
|
||||
|
||||
Point p1(x1, y1);
|
||||
Point p2(x2, y2);
|
||||
Point p3(x3, y3);
|
||||
self->breakout->triangle(p1, p2, p3);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t BreakoutColourLCD240x240_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_self, ARG_x1, ARG_y1, ARG_x2, ARG_y2 };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, breakout_colourlcd240x240_BreakoutColourLCD240x240_obj_t);
|
||||
|
||||
int x1 = args[ARG_x1].u_int;
|
||||
int y1 = args[ARG_y1].u_int;
|
||||
int x2 = args[ARG_x1].u_int;
|
||||
int y2 = args[ARG_y1].u_int;
|
||||
|
||||
Point p1(x1, y1);
|
||||
Point p2(x2, y2);
|
||||
self->breakout->line(p1, p2);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Include MicroPython API.
|
||||
#include "py/runtime.h"
|
||||
#include "py/objstr.h"
|
||||
|
||||
/***** Constants *****/
|
||||
static const int WIDTH = 240;
|
||||
static const int HEIGHT = 240;
|
||||
|
||||
|
||||
/***** Extern of Class Definition *****/
|
||||
extern const mp_obj_type_t breakout_colourlcd240x240_BreakoutColourLCD240x240_type;
|
||||
|
||||
/***** Extern of Class Methods *****/
|
||||
extern void BreakoutColourLCD240x240_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_update(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_set_backlight(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
|
||||
extern mp_obj_t BreakoutColourLCD240x240_set_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_create_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_set_clip(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_remove_clip(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_clear(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_pixel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_pixel_span(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_rectangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_circle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_character(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_polygon(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_triangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutColourLCD240x240_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
@ -0,0 +1,20 @@
|
|||
set(MOD_NAME breakout_colourlcd240x240)
|
||||
string(TOUPPER ${MOD_NAME} MOD_NAME_UPPER)
|
||||
add_library(usermod_${MOD_NAME} INTERFACE)
|
||||
|
||||
target_sources(usermod_${MOD_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${MOD_NAME}.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/${MOD_NAME}.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/${MOD_NAME}/${MOD_NAME}.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../../drivers/st7789/st7789.cpp
|
||||
)
|
||||
|
||||
target_include_directories(usermod_${MOD_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(usermod_${MOD_NAME} INTERFACE
|
||||
-DMODULE_${MOD_NAME_UPPER}_ENABLED=1
|
||||
)
|
||||
|
||||
target_link_libraries(usermod INTERFACE usermod_${MOD_NAME})
|
|
@ -0,0 +1,13 @@
|
|||
set(MOD_NAME breakout_colourlcd240x240)
|
||||
BREAKOUT_MOD_DIR := $(USERMOD_DIR)
|
||||
|
||||
# Add our source files to the respective variables.
|
||||
SRC_USERMOD += $(BREAKOUT_MOD_DIR)/${MOD_NAME}.c
|
||||
SRC_USERMOD_CXX += $(BREAKOUT_MOD_DIR)/${MOD_NAME}.cpp
|
||||
|
||||
# Add our module directory to the include path.
|
||||
CFLAGS_USERMOD += -I$(BREAKOUT_MOD_DIR)
|
||||
CXXFLAGS_USERMOD += -I$(BREAKOUT_MOD_DIR)
|
||||
|
||||
# We use C++ features so have to link against the standard library.
|
||||
LDFLAGS_USERMOD += -lstdc++
|
|
@ -69,8 +69,33 @@ mp_obj_t BreakoutRoundLCD_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
|||
|
||||
self->breakout = new BreakoutRoundLCD((uint16_t *)bufinfo.buf);
|
||||
}
|
||||
else if(n_args == 2) {
|
||||
enum { ARG_buffer, ARG_slot };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_slot, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
};
|
||||
|
||||
// Parse args.
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
int slot = args[ARG_slot].u_int;
|
||||
if(slot == ST7789::BG_SPI_FRONT || slot == ST7789::BG_SPI_BACK) {
|
||||
self = m_new_obj(breakout_roundlcd_BreakoutRoundLCD_obj_t);
|
||||
self->base.type = &breakout_roundlcd_BreakoutRoundLCD_type;
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_RW);
|
||||
|
||||
self->breakout = new BreakoutRoundLCD((uint16_t *)bufinfo.buf, (ST7789::BG_SPI_SLOT)slot);
|
||||
}
|
||||
else {
|
||||
mp_raise_ValueError("slot not a valid value. Expected 0 to 1");
|
||||
}
|
||||
}
|
||||
else {
|
||||
enum { ARG_buffer, ARG_spi, ARG_cs, ARG_dc, ARG_sck, ARG_mosi };
|
||||
enum { ARG_buffer, ARG_spi, ARG_cs, ARG_dc, ARG_sck, ARG_mosi, ARG_bl };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
|
@ -78,6 +103,7 @@ mp_obj_t BreakoutRoundLCD_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
|||
{ MP_QSTR_dc, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_sck, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_mosi, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_bl, MP_ARG_INT, {.u_int = BreakoutRoundLCD::PIN_UNUSED} },
|
||||
};
|
||||
|
||||
// Parse args.
|
||||
|
@ -107,7 +133,8 @@ mp_obj_t BreakoutRoundLCD_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
|||
self->base.type = &breakout_roundlcd_BreakoutRoundLCD_type;
|
||||
|
||||
spi_inst_t *spi = (spi_id == 0) ? spi0 : spi1;
|
||||
self->breakout = new BreakoutRoundLCD((uint16_t *)bufinfo.buf, spi, args[ARG_cs].u_int, args[ARG_dc].u_int, sck, mosi);
|
||||
self->breakout = new BreakoutRoundLCD((uint16_t *)bufinfo.buf, spi,
|
||||
args[ARG_cs].u_int, args[ARG_dc].u_int, sck, mosi, BreakoutRoundLCD::PIN_UNUSED, args[ARG_bl].u_int);
|
||||
}
|
||||
|
||||
self->breakout->init();
|
||||
|
|
|
@ -13,20 +13,20 @@ extern const mp_obj_type_t breakout_roundlcd_BreakoutRoundLCD_type;
|
|||
/***** Extern of Class Methods *****/
|
||||
extern void BreakoutRoundLCD_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
|
||||
extern mp_obj_t BreakoutRoundLCD_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_update(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_set_backlight(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_update(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_set_backlight(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
|
||||
extern mp_obj_t BreakoutRoundLCD_set_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_create_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_set_clip(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_remove_clip(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_clear(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_pixel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_pixel_span(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_rectangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_circle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_character(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_polygon(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_triangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_set_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_create_pen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_set_clip(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_remove_clip(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_clear(mp_obj_t self_in);
|
||||
extern mp_obj_t BreakoutRoundLCD_pixel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_pixel_span(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_rectangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_circle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_character(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_polygon(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_triangle(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
extern mp_obj_t BreakoutRoundLCD_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
@ -1,13 +1,13 @@
|
|||
set(MOD_NAME breakout_roundlcd)
|
||||
PICOSCROLL_MOD_DIR := $(USERMOD_DIR)
|
||||
BREAKOUT_MOD_DIR := $(USERMOD_DIR)
|
||||
|
||||
# Add our source files to the respective variables.
|
||||
SRC_USERMOD += $(PICOSCROLL_MOD_DIR)/${MOD_NAME}.c
|
||||
SRC_USERMOD_CXX += $(PICOSCROLL_MOD_DIR)/${MOD_NAME}.cpp
|
||||
SRC_USERMOD += $(BREAKOUT_MOD_DIR)/${MOD_NAME}.c
|
||||
SRC_USERMOD_CXX += $(BREAKOUT_MOD_DIR)/${MOD_NAME}.cpp
|
||||
|
||||
# Add our module directory to the include path.
|
||||
CFLAGS_USERMOD += -I$(PICOSCROLL_MOD_DIR)
|
||||
CXXFLAGS_USERMOD += -I$(PICOSCROLL_MOD_DIR)
|
||||
CFLAGS_USERMOD += -I$(BREAKOUT_MOD_DIR)
|
||||
CXXFLAGS_USERMOD += -I$(BREAKOUT_MOD_DIR)
|
||||
|
||||
# We use C++ features so have to link against the standard library.
|
||||
LDFLAGS_USERMOD += -lstdc++
|
|
@ -6,6 +6,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/breakout_rgbmatrix5x5/micropython.cmake)
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/breakout_matrix11x7/micropython.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/breakout_trackball/micropython.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/breakout_sgp30/micropython.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/breakout_colourlcd240x240/micropython.cmake)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/pico_scroll/micropython.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/pico_rgb_keypad/micropython.cmake)
|
||||
|
|
Ładowanie…
Reference in New Issue