Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DigitalInOut.pull on RP2040 #4052

Merged
merged 2 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0

SUPEROPT_GC = 0
CFLAGS_INLINE_LIMIT = 50
CFLAGS_INLINE_LIMIT = 40


# Include these Python libraries in firmware.
Expand Down
10 changes: 1 addition & 9 deletions ports/atmel-samd/boards/qtpy_m0/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0

SUPEROPT_GC = 0
SUPEROPT_VM = 0

CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
endif
27 changes: 12 additions & 15 deletions ports/raspberrypi/common-hal/digitalio/DigitalInOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(
digitalio_drive_mode_t drive_mode) {
const uint8_t pin = self->pin->number;
gpio_set_dir(pin, GPIO_OUT);
// Turn on "strong" pin driving (more current available). See DRVSTR doc in datasheet.
// hri_port_set_PINCFG_DRVSTR_bit(PORT, (enum gpio_port)GPIO_PORT(pin), GPIO_PIN(pin));
// TODO: Turn on "strong" pin driving (more current available).

self->output = true;
common_hal_digitalio_digitalinout_set_drive_mode(self, drive_mode);
Expand Down Expand Up @@ -140,18 +139,16 @@ void common_hal_digitalio_digitalinout_set_pull(

digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
digitalio_digitalinout_obj_t* self) {
// uint32_t pin = self->pin->number;
// if (self->output) {
// mp_raise_AttributeError(translate("Cannot get pull while in output mode"));
// return PULL_NONE;
// } else {
// if (hri_port_get_PINCFG_PULLEN_bit(PORT, GPIO_PORT(pin), GPIO_PIN(pin)) == 0) {
// return PULL_NONE;
// } if (hri_port_get_OUT_reg(PORT, GPIO_PORT(pin), 1U << GPIO_PIN(pin)) > 0) {
// return PULL_UP;
// } else {
// return PULL_DOWN;
// }
// }
uint32_t pin = self->pin->number;
if (self->output) {
mp_raise_AttributeError(translate("Cannot get pull while in output mode"));
return PULL_NONE;
} else {
if (gpio_is_pulled_up(pin)) {
return PULL_UP;
} else if (gpio_is_pulled_down(pin)) {
return PULL_DOWN;
}
}
return PULL_NONE;
}