Skip to content
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
9 changes: 7 additions & 2 deletions ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "shared-module/displayio/__init__.h"
#include "shared-bindings/board/__init__.h"
#include "supervisor/shared/board.h"
#include "py/mphal.h"
#include "inky-shared.h"

#define DELAY 0x80
Expand Down Expand Up @@ -55,6 +56,7 @@ static void pre_init(void) {
gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE);
uint8_t state = 0u;
for (uint8_t i = 0u; i < 8; i++) {
mp_hal_delay_us(1); // reduce clockout frequency
gpio_put(SR_CLK, true);
if (gpio_get(SR_DATA)) {
state |= (0b1 << i);
Expand All @@ -64,8 +66,7 @@ static void pre_init(void) {
reset_button_state = state;

// Turn on LED_CONN so the user knows it is ok to release the button.
// The LED is only on for a short time, since it is automatically turned
// off during board-init.
// The LED is only on for a short time, since it is reset from board_init.
gpio_init(LED_CONN);
gpio_put(LED_CONN, true);
gpio_set_dir(LED_CONN, GPIO_OUT);
Expand Down Expand Up @@ -117,6 +118,10 @@ const uint8_t refresh_sequence[] = {
};

void board_init(void) {
// reset LED_CONN (turned on in pre_init())
gpio_deinit(LED_CONN);

// create bus and display
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
busio_spi_obj_t *spi = common_hal_board_create_spi(0);

Expand Down
9 changes: 7 additions & 2 deletions ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/board.h"
#include "py/mphal.h"
#include "inky-shared.h"

digitalio_digitalinout_obj_t enable_pin_obj;
Expand Down Expand Up @@ -53,6 +54,7 @@ static void pre_init(void) {
gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE);
uint8_t state = 0u;
for (uint8_t i = 0u; i < 8; i++) {
mp_hal_delay_us(1); // reduce clockout frequency
gpio_put(SR_CLK, true);
if (gpio_get(SR_DATA)) {
state |= (0b1 << i);
Expand All @@ -62,8 +64,7 @@ static void pre_init(void) {
reset_button_state = state;

// Turn on LED_CONN so the user knows it is ok to release the button.
// The LED is only on for a short time, since it is automatically turned
// off during board-init.
// The LED is only on for a short time, since it is reset from board_init.
gpio_init(LED_CONN);
gpio_put(LED_CONN, true);
gpio_set_dir(LED_CONN, GPIO_OUT);
Expand Down Expand Up @@ -160,6 +161,10 @@ const uint8_t refresh_sequence[] = {
};

void board_init(void) {
// reset LED_CONN (turned on in pre_init())
gpio_deinit(LED_CONN);

// create bus and display
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
busio_spi_obj_t *spi = common_hal_board_create_spi(0);

Expand Down
20 changes: 10 additions & 10 deletions ports/raspberrypi/boards/pimoroni_inky_frame_7_3/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
#include "inky-shared.h"

// For use with keypad.ShiftRegisterKeys(): maps keycodes (bit-number)
// to logical names such as board.KEYCODES.BUTTON_A etc.
// to logical names such as board.KEYCODES.SW_A etc.
// N.B.: labels and bit-numbers in the schematic are reversed, i.e.
// BUTTON_A on D0 has bit-number 7
// SW_A on D0 has bit-number 7

static const qstr board_keycodes_fields[] = {
MP_QSTR_BUTTON_A,
MP_QSTR_BUTTON_B,
MP_QSTR_BUTTON_C,
MP_QSTR_BUTTON_D,
MP_QSTR_BUTTON_E,
MP_QSTR_SW_A,
MP_QSTR_SW_B,
MP_QSTR_SW_C,
MP_QSTR_SW_D,
MP_QSTR_SW_E,
MP_QSTR_RTC_ALARM,
MP_QSTR_EXT_TRIGGER,
MP_QSTR_INKY_BUS
Expand Down Expand Up @@ -59,9 +59,9 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_LED_CONN), MP_ROM_PTR(&pin_GPIO7) },

{ MP_ROM_QSTR(MP_QSTR_BUTTON_CLK), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_BUTTON_OUT), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_SWITCH_CLK), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_SWITCH_LATCH), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_SWITCH_OUT), MP_ROM_PTR(&pin_GPIO10) },

{ MP_ROM_QSTR(MP_QSTR_LED_A), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO12) },
Expand Down
Loading