Re-renable Pico Explorer and enable Pimoroni Bus

This commit is contained in:
Phil Howard 2022-05-28 18:09:39 +01:00
parent c13f53092d
commit 6ace09dbc3
5 changed files with 28 additions and 516 deletions

View File

@ -1,4 +1,5 @@
include(pimoroni_i2c/micropython)
include(pimoroni_bus/micropython)
include(breakout_dotmatrix/micropython)
include(breakout_encoder/micropython)
@ -27,6 +28,7 @@ include(pico_scroll/micropython)
include(pico_rgb_keypad/micropython)
include(pico_unicorn/micropython)
include(pico_wireless/micropython)
include(pico_explorer/micropython)
include(bitmap_fonts/micropython)

View File

@ -2,11 +2,6 @@ add_library(usermod_pico_explorer INTERFACE)
target_sources(usermod_pico_explorer INTERFACE
${CMAKE_CURRENT_LIST_DIR}/pico_explorer.c
${CMAKE_CURRENT_LIST_DIR}/pico_explorer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/pico_explorer/pico_explorer.cpp
${CMAKE_CURRENT_LIST_DIR}/../../../drivers/st7789/st7789.cpp
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/pico_graphics/pico_graphics.cpp
${CMAKE_CURRENT_LIST_DIR}/../../../libraries/pico_graphics/types.cpp
)
target_include_directories(usermod_pico_explorer INTERFACE
@ -22,5 +17,5 @@ target_link_libraries(usermod INTERFACE usermod_pico_explorer)
set_source_files_properties(
${CMAKE_CURRENT_LIST_DIR}/pico_explorer.c
PROPERTIES COMPILE_FLAGS
"-Wno-discarded-qualifiers -Wno-implicit-int"
"-Wno-discarded-qualifiers"
)

View File

@ -1,131 +1,42 @@
#include "pico_explorer.h"
/***** Constants *****/
enum buttons
{
BUTTON_A = 0,
BUTTON_B,
BUTTON_X,
BUTTON_Y,
const mp_rom_obj_tuple_t PicoExplorer_MOTOR1_pins = {
{&mp_type_tuple}, 2, { MP_ROM_INT(9), MP_ROM_INT(8) },
};
enum adcs
{
ADC0 = 0,
ADC1,
ADC2,
const mp_rom_obj_tuple_t PicoExplorer_MOTOR2_pins = {
{&mp_type_tuple}, 2, { MP_ROM_INT(11), MP_ROM_INT(10) },
};
enum motors
{
MOTOR1 = 0,
MOTOR2,
};
enum motions
{
FORWARD = 0,
REVERSE,
STOP,
};
enum gps
{
GP0 = 0,
GP1,
GP2,
GP3,
GP4,
GP5,
GP6,
GP7,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// picoexplorer Module
////////////////////////////////////////////////////////////////////////////////////////////////////
/***** Module Functions *****/
STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoexplorer_init_obj, picoexplorer_init);
STATIC MP_DEFINE_CONST_FUN_OBJ_0(picoexplorer_get_width_obj, picoexplorer_get_width);
STATIC MP_DEFINE_CONST_FUN_OBJ_0(picoexplorer_get_height_obj, picoexplorer_get_height);
STATIC MP_DEFINE_CONST_FUN_OBJ_0(picoexplorer_update_obj, picoexplorer_update);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoexplorer_is_pressed_obj, picoexplorer_is_pressed);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoexplorer_get_adc_obj, picoexplorer_get_adc);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_set_motor_obj, 2, 3, picoexplorer_set_motor);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoexplorer_set_audio_pin_obj, picoexplorer_set_audio_pin);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_set_tone_obj, 1, 2, picoexplorer_set_tone);
//From PicoGraphics parent class
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_set_pen_obj, 1, 3, picoexplorer_set_pen);
STATIC MP_DEFINE_CONST_FUN_OBJ_3(picoexplorer_create_pen_obj, picoexplorer_create_pen);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_set_clip_obj, 4, 4, picoexplorer_set_clip);
STATIC MP_DEFINE_CONST_FUN_OBJ_0(picoexplorer_remove_clip_obj, picoexplorer_remove_clip);
STATIC MP_DEFINE_CONST_FUN_OBJ_0(picoexplorer_clear_obj, picoexplorer_clear);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(picoexplorer_pixel_obj, picoexplorer_pixel);
STATIC MP_DEFINE_CONST_FUN_OBJ_3(picoexplorer_pixel_span_obj, picoexplorer_pixel_span);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_rectangle_obj, 4, 4, picoexplorer_rectangle);
STATIC MP_DEFINE_CONST_FUN_OBJ_3(picoexplorer_circle_obj, picoexplorer_circle);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_character_obj, 3, 4, picoexplorer_character);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoexplorer_text_obj, 4, 5, picoexplorer_text);
/***** Globals Table *****/
STATIC const mp_map_elem_t picoexplorer_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_picoexplorer) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&picoexplorer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_width), MP_ROM_PTR(&picoexplorer_get_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_height), MP_ROM_PTR(&picoexplorer_get_height_obj) },
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&picoexplorer_update_obj) },
{ MP_ROM_QSTR(MP_QSTR_is_pressed), MP_ROM_PTR(&picoexplorer_is_pressed_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_adc), MP_ROM_PTR(&picoexplorer_get_adc_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_motor), MP_ROM_PTR(&picoexplorer_set_motor_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_audio_pin), MP_ROM_PTR(&picoexplorer_set_audio_pin_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_tone), MP_ROM_PTR(&picoexplorer_set_tone_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_pen), MP_ROM_PTR(&picoexplorer_set_pen_obj) },
{ MP_ROM_QSTR(MP_QSTR_create_pen), MP_ROM_PTR(&picoexplorer_create_pen_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_clip), MP_ROM_PTR(&picoexplorer_set_clip_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove_clip), MP_ROM_PTR(&picoexplorer_remove_clip_obj) },
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&picoexplorer_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel), MP_ROM_PTR(&picoexplorer_pixel_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_span), MP_ROM_PTR(&picoexplorer_pixel_span_obj) },
{ MP_ROM_QSTR(MP_QSTR_rectangle), MP_ROM_PTR(&picoexplorer_rectangle_obj) },
{ MP_ROM_QSTR(MP_QSTR_circle), MP_ROM_PTR(&picoexplorer_circle_obj) },
{ MP_ROM_QSTR(MP_QSTR_character), MP_ROM_PTR(&picoexplorer_character_obj) },
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&picoexplorer_text_obj) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_INT(BUTTON_A) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_INT(BUTTON_B) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_INT(BUTTON_X) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(BUTTON_Y) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_INT(12) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_INT(13) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_INT(14) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(15) },
{ MP_ROM_QSTR(MP_QSTR_ADC0), MP_ROM_INT(ADC0) },
{ MP_ROM_QSTR(MP_QSTR_ADC1), MP_ROM_INT(ADC1) },
{ MP_ROM_QSTR(MP_QSTR_ADC2), MP_ROM_INT(ADC2) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR1), MP_ROM_INT(MOTOR1) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR2), MP_ROM_INT(MOTOR2) },
{ MP_ROM_QSTR(MP_QSTR_FORWARD), MP_ROM_INT(FORWARD) },
{ MP_ROM_QSTR(MP_QSTR_REVERSE), MP_ROM_INT(REVERSE) },
{ MP_ROM_QSTR(MP_QSTR_STOP), MP_ROM_INT(STOP) },
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_INT(GP0) },
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_INT(GP1) },
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_INT(GP2) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_INT(GP3) },
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_INT(GP4) },
{ MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_INT(GP5) },
{ MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_INT(GP6) },
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_INT(GP7) },
{ MP_ROM_QSTR(MP_QSTR_ADC0), MP_ROM_INT(26) },
{ MP_ROM_QSTR(MP_QSTR_ADC1), MP_ROM_INT(27) },
{ MP_ROM_QSTR(MP_QSTR_ADC2), MP_ROM_INT(28) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR_1), MP_ROM_PTR(&PicoExplorer_MOTOR1_pins) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR_2), MP_ROM_PTR(&PicoExplorer_MOTOR2_pins) },
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_INT(0) },
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_INT(1) },
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_INT(2) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_INT(3) },
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_INT(4) },
{ MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_INT(5) },
{ MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_INT(6) },
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_INT(7) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_picoexplorer_globals, picoexplorer_globals_table);
/***** Module Definition *****/
const mp_obj_module_t picoexplorer_user_cmodule = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_picoexplorer_globals,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
MP_REGISTER_MODULE(MP_QSTR_picoexplorer, picoexplorer_user_cmodule, MODULE_PICOEXPLORER_ENABLED);
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
MP_REGISTER_MODULE(MP_QSTR_picoexplorer, picoexplorer_user_cmodule, MODULE_PICOEXPLORER_ENABLED);

View File

@ -1,371 +0,0 @@
#include "hardware/spi.h"
#include "hardware/sync.h"
#include "pico/binary_info.h"
#include "libraries/pico_explorer/pico_explorer.hpp"
using namespace pimoroni;
PicoExplorer *explorer = nullptr;
extern "C" {
#include "pico_explorer.h"
#define NOT_INITIALISED_MSG "Cannot call this function, as picoexplorer is not initialised. Call picoexplorer.init(<bytearray>) first."
mp_obj_t picoexplorer_buf_obj;
mp_obj_t picoexplorer_init(mp_obj_t buf_obj) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
picoexplorer_buf_obj = buf_obj;
// If a display already exists, delete it
if(explorer != nullptr) {
delete explorer;
}
// Create a new display pointing to the newly provided buffer
explorer = new PicoExplorer((uint8_t *)bufinfo.buf);
explorer->init();
return mp_const_none;
}
mp_obj_t picoexplorer_get_width() {
return mp_obj_new_int(PicoExplorer::WIDTH);
}
mp_obj_t picoexplorer_get_height() {
return mp_obj_new_int(PicoExplorer::HEIGHT);
}
mp_obj_t picoexplorer_update() {
if(explorer != nullptr)
explorer->update();
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_is_pressed(mp_obj_t button_obj) {
bool buttonPressed = false;
if(explorer != nullptr) {
int buttonID = mp_obj_get_int(button_obj);
switch(buttonID) {
case 0:
buttonPressed = explorer->is_pressed(PicoExplorer::A);
break;
case 1:
buttonPressed = explorer->is_pressed(PicoExplorer::B);
break;
case 2:
buttonPressed = explorer->is_pressed(PicoExplorer::X);
break;
case 3:
buttonPressed = explorer->is_pressed(PicoExplorer::Y);
break;
default:
mp_raise_ValueError("button not valid. Expected 0 to 3");
break;
}
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return buttonPressed ? mp_const_true : mp_const_false;
}
extern mp_obj_t picoexplorer_get_adc(mp_obj_t channel_obj) {
float reading = 0.0f;
if(explorer != nullptr) {
int channel = mp_obj_get_int(channel_obj);
if(channel < 0 || channel > 2)
mp_raise_ValueError("adc channel not valid. Expected 0 to 2");
else
reading = explorer->get_adc(channel);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_obj_new_float(reading);
}
extern mp_obj_t picoexplorer_set_motor(mp_uint_t n_args, const mp_obj_t *args) {
if(explorer != nullptr) {
int channel = mp_obj_get_int(args[0]);
int action = mp_obj_get_int(args[1]);
if(channel < 0 || channel > 1)
mp_raise_ValueError("motor channel not valid. Expected 0 to 1");
else if(action < 0 || action > 2)
mp_raise_ValueError("motor action not valid. Expected 0 to 2");
else {
if(n_args == 3) {
float speed = mp_obj_get_float(args[2]);
explorer->set_motor(channel, action, speed);
}
else
explorer->set_motor(channel, action);
}
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
extern mp_obj_t picoexplorer_set_audio_pin(mp_obj_t pin_obj) {
if(explorer != nullptr) {
int pin = mp_obj_get_int(pin_obj);
explorer->set_audio_pin(pin);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
extern mp_obj_t picoexplorer_set_tone(mp_uint_t n_args, const mp_obj_t *args) {
if(explorer != nullptr) {
int frequency = mp_obj_get_int(args[0]);
if(n_args == 2) {
float duty = mp_obj_get_int(args[1]);
explorer->set_tone(frequency, duty);
}
else
explorer->set_tone(frequency);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_set_pen(mp_uint_t n_args, const mp_obj_t *args) {
if(explorer != nullptr) {
switch(n_args) {
case 1: {
int p = mp_obj_get_int(args[0]);
if(p < 0 || p > 0xffff)
mp_raise_ValueError("p is not a valid pen.");
else
explorer->set_pen(p);
} break;
case 3: {
int r = mp_obj_get_int(args[0]);
int g = mp_obj_get_int(args[1]);
int b = mp_obj_get_int(args[2]);
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
explorer->set_pen(r, g, b);
} break;
default: {
char *buffer;
buffer = (char*)malloc(100);
sprintf(buffer, "function takes 1 or 3 (r,g,b) positional arguments but %d were given", n_args);
mp_raise_TypeError(buffer);
free(buffer);
} break;
}
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_create_pen(mp_obj_t r_obj, mp_obj_t g_obj, mp_obj_t b_obj) {
int pen = 0;
if(explorer != nullptr) {
int r = mp_obj_get_int(r_obj);
int g = mp_obj_get_int(g_obj);
int b = mp_obj_get_int(b_obj);
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 = explorer->create_pen(r, g, b);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_obj_new_int(pen);
}
mp_obj_t picoexplorer_set_clip(mp_uint_t n_args, const mp_obj_t *args) {
(void)n_args; //Unused input parameter, we know it's 4
if(explorer != nullptr) {
int x = mp_obj_get_int(args[0]);
int y = mp_obj_get_int(args[1]);
int w = mp_obj_get_int(args[2]);
int h = mp_obj_get_int(args[3]);
Rect r(x, y, w, h);
explorer->set_clip(r);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_remove_clip() {
if(explorer != nullptr)
explorer->remove_clip();
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_clear() {
if(explorer != nullptr)
explorer->clear();
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_pixel(mp_obj_t x_obj, mp_obj_t y_obj) {
if(explorer != nullptr) {
int x = mp_obj_get_int(x_obj);
int y = mp_obj_get_int(y_obj);
Point p(x, y);
explorer->pixel(p);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_pixel_span(mp_obj_t x_obj, mp_obj_t y_obj, mp_obj_t l_obj) {
if(explorer != nullptr) {
int x = mp_obj_get_int(x_obj);
int y = mp_obj_get_int(y_obj);
int l = mp_obj_get_int(l_obj);
Point p(x, y);
explorer->pixel_span(p, l);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_rectangle(mp_uint_t n_args, const mp_obj_t *args) {
(void)n_args; //Unused input parameter, we know it's 4
if(explorer != nullptr) {
int x = mp_obj_get_int(args[0]);
int y = mp_obj_get_int(args[1]);
int w = mp_obj_get_int(args[2]);
int h = mp_obj_get_int(args[3]);
Rect r(x, y, w, h);
explorer->rectangle(r);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_circle(mp_obj_t x_obj, mp_obj_t y_obj, mp_obj_t r_obj) {
if(explorer != nullptr) {
int x = mp_obj_get_int(x_obj);
int y = mp_obj_get_int(y_obj);
int r = mp_obj_get_int(r_obj);
Point p(x, y);
explorer->circle(p, r);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_character(mp_uint_t n_args, const mp_obj_t *args) {
if(explorer != nullptr) {
int c = mp_obj_get_int(args[0]);
int x = mp_obj_get_int(args[1]);
int y = mp_obj_get_int(args[2]);
Point p(x, y);
if(n_args == 4) {
int scale = mp_obj_get_int(args[3]);
explorer->character((char)c, p, scale);
}
else
explorer->character((char)c, p);
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
mp_obj_t picoexplorer_text(mp_uint_t n_args, const mp_obj_t *args) {
if(explorer != nullptr) {
if(mp_obj_is_str_or_bytes(args[0])) {
GET_STR_DATA_LEN(args[0], str, str_len);
std::string t((const char*)str);
int x = mp_obj_get_int(args[1]);
int y = mp_obj_get_int(args[2]);
int wrap = mp_obj_get_int(args[3]);
Point p(x, y);
if(n_args == 5) {
int scale = mp_obj_get_int(args[4]);
explorer->text(t, p, wrap, scale);
}
else
explorer->text(t, p, wrap);
}
else if(mp_obj_is_float(args[0])) {
mp_raise_TypeError("can't convert 'float' object to str implicitly");
}
else if(mp_obj_is_int(args[0])) {
mp_raise_TypeError("can't convert 'int' object to str implicitly");
}
else if(mp_obj_is_bool(args[0])) {
mp_raise_TypeError("can't convert 'bool' object to str implicitly");
}
else {
mp_raise_TypeError("can't convert object to str implicitly");
}
}
else
mp_raise_msg(&mp_type_RuntimeError, NOT_INITIALISED_MSG);
return mp_const_none;
}
}

View File

@ -1,27 +1,2 @@
// Include MicroPython API.
#include "py/runtime.h"
#include "py/objstr.h"
// Declare the functions we'll make available in Python
extern mp_obj_t picoexplorer_init(mp_obj_t buf_obj);
extern mp_obj_t picoexplorer_get_width();
extern mp_obj_t picoexplorer_get_height();
extern mp_obj_t picoexplorer_update();
extern mp_obj_t picoexplorer_is_pressed(mp_obj_t button_obj);
extern mp_obj_t picoexplorer_get_adc(mp_obj_t channel_obj);
extern mp_obj_t picoexplorer_set_motor(mp_uint_t n_args, const mp_obj_t *args);
extern mp_obj_t picoexplorer_set_audio_pin(mp_obj_t pin_obj);
extern mp_obj_t picoexplorer_set_tone(mp_uint_t n_args, const mp_obj_t *args);
// From PicoGraphics parent class
extern mp_obj_t picoexplorer_set_pen(mp_uint_t n_args, const mp_obj_t *args);
extern mp_obj_t picoexplorer_create_pen(mp_obj_t r_obj, mp_obj_t g_obj, mp_obj_t b_obj);
extern mp_obj_t picoexplorer_set_clip(mp_uint_t n_args, const mp_obj_t *args);
extern mp_obj_t picoexplorer_remove_clip();
extern mp_obj_t picoexplorer_clear();
extern mp_obj_t picoexplorer_pixel(mp_obj_t x_obj, mp_obj_t y_obj);
extern mp_obj_t picoexplorer_pixel_span(mp_obj_t x_obj, mp_obj_t y_obj, mp_obj_t l_obj);
extern mp_obj_t picoexplorer_rectangle(mp_uint_t n_args, const mp_obj_t *args);
extern mp_obj_t picoexplorer_circle(mp_obj_t x_obj, mp_obj_t y_obj, mp_obj_t r_obj);
extern mp_obj_t picoexplorer_character(mp_uint_t n_args, const mp_obj_t *args);
extern mp_obj_t picoexplorer_text(mp_uint_t n_args, const mp_obj_t *args);
#include "py/objstr.h"