added dfu button to debug app

This commit is contained in:
Bernd Herzog 2023-04-16 19:51:06 +02:00
parent bcefa774cd
commit d74fd92451
3 changed files with 7 additions and 11 deletions

View File

@ -274,13 +274,14 @@ void ControlsSwitchesWidget::paint(Painter& painter) {
{ 32, 32, 16, 16 }, // Select
{ 16, 96, 16, 16 }, // Encoder phase 0
{ 48, 96, 16, 16 }, // Encoder phase 1
{ 64, 0, 16, 16 }, // Dfu
{ 80, 0, 16, 16 }, // Dfu
} };
const auto pos = screen_pos();
auto switches_raw = control::debug::switches(); // all 7 + dfu
auto switches_debounced = get_switches_state().to_ulong(); // stops at 5, 6 is dfu
switches_debounced = (switches_debounced & 0x1f) | ((switches_debounced >> 5) << 7);
auto switches_event = key_event_mask;
switches_debounced = (switches_debounced & 0x1f) | ((switches_debounced & 0x40) << 2);
auto switches_event = key_event_mask; // 5 keys, 6 is "back", 7 is dfu
key_event_mask = (key_event_mask & 0x1f) | ((key_event_mask & 0x80) << 1);
for(const auto r : button_rects) {
const auto c =

View File

@ -508,8 +508,7 @@ static const std::array<scu_setup_t, 26> pins_setup_portapack { {
{ 2, 1, scu_config_normal_drive_t { .mode=4, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* U0_RXD: PortaPack P2_1/ADDR */
{ 2, 3, scu_config_normal_drive_t { .mode=4, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* I2C1_SDA: PortaPack P2_3/LCD_TE */
{ 2, 4, scu_config_normal_drive_t { .mode=4, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* I2C1_SCL: PortaPack P2_4/LCD_RDX */
//TODO: find right settings
{ 2, 8, scu_config_normal_drive_t { .mode=4, .epd=0, .epun=1, .ehs=0, .ezi=0, .zif=0 } }, /* P2_8: 10K PD, BOOT2, DFU switch, PortaPack P2_8/<unused> */
{ 2, 8, scu_config_normal_drive_t { .mode=1, .epd=0, .epun=0, .ehs=0, .ezi=1, .zif=1 } }, /* P2_8: 10K PD, BOOT2, DFU switch, PortaPack P2_8/<unused> */
{ 2, 9, scu_config_normal_drive_t { .mode=0, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* P2_9: 10K PD, BOOT3, PortaPack P2_9/LCD_WRX */
{ 2, 13, scu_config_normal_drive_t { .mode=0, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* P2_13: PortaPack P2_13/DIR */
{ 7, 0, scu_config_normal_drive_t { .mode=0, .epd=0, .epun=1, .ehs=0, .ezi=1, .zif=0 } }, /* GPIO3_8: PortaPack GPIO3_8(IO) */

View File

@ -48,11 +48,7 @@ void IO::init() {
gpio_io_stbx.output();
gpio_addr.output();
gpio_rot_a.input();
//TODO: find right settings
//gpio_rot_b.set();
gpio_rot_b.input();
//gpio_rot_b.configure();
}
void IO::lcd_backlight(const bool value) {
@ -114,8 +110,8 @@ uint32_t IO::io_update(const TouchPinsConfig write_value) {
}
gpio_addr.write(addr);
auto dfu_btn = portapack::io.dfu_read();
return (switches_raw & 0x7f) | (dfu_btn << 7 );
auto dfu_btn = portapack::io.dfu_read() & 0x01;
return (switches_raw & 0x7f) | (dfu_btn << 7);
}
}