Skip to content

[WIP] Fix M5 keyboard integration in main.cpp#56

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-m5-keyboard-integration
Draft

[WIP] Fix M5 keyboard integration in main.cpp#56
Copilot wants to merge 1 commit intomainfrom
copilot/fix-m5-keyboard-integration

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Problem

The main.cpp fails to compile because M5.Keyboard is not a member of M5Unified. File: src/main.cpp (ref 84c027b).

Current failing lines:

if (M5.Keyboard.isChange()) {
    if (M5.Keyboard.isPressed()) {
        auto keycode = M5.Keyboard.getKeyCode();
        // ...
    }
}

Solution

  1. Replace usages of M5.Keyboard in main.cpp with a custom keyboard instance meant for Cardputer ADV, sourced from a new drivers/cardputer_adv_driver.h (and .cpp) file. The new interface should expose:

    • an object named Keyboard with isChange(), isPressed(), and getKeyCode().
    • an initialization function initialize_driver().
  2. Create the driver implementation:

    • Add drivers/cardputer_adv_driver.h:
#ifndef CARDPUTER_ADV_DRIVER_H
#define CARDPUTER_ADV_DRIVER_H
#include <M5Unified.h>
// TODO: include actual keyboard header/library for Cardputer ADV
class CardputerKeyboard {
public:
    void begin();
    bool isChange();
    bool isPressed();
    uint8_t getKeyCode();
};
extern CardputerKeyboard Keyboard;
void initialize_driver();
#endif
  • Add drivers/cardputer_adv_driver.cpp:
#include "cardputer_adv_driver.h"
CardputerKeyboard Keyboard;
void CardputerKeyboard::begin() { /* ... */ }
bool CardputerKeyboard::isChange() { /* ... */ return false; }
bool CardputerKeyboard::isPressed() { /* ... */ return false; }
uint8_t CardputerKeyboard::getKeyCode() { /* ... */ return 0; }
void initialize_driver() {
    Keyboard.begin();
}
  • The implementation should be replaced with the real Cardputer ADV keyboard support, but this stub makes the project build and ready for adaptation.
  1. Update platformio.ini if necessary to ensure M5Unified (and the Cardputer keyboard library, if available) are declared in lib_deps.

Outcome

With these changes, the build will succeed, and the repo will be ready for Cardputer ADV flashing. The keyboard logic can be filled in with true Cardputer ADV routines later when available. The interface now prepares the project for further Cardputer ADV development and flashing.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@Crashkeyz
Copy link
Owner

@copilot platformio

Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot platformio

Could you clarify what you'd like me to do with PlatformIO? I can:

  1. Verify the build configuration
  2. Test compilation (though I'm experiencing network issues downloading the espressif32 platform)
  3. Fix a specific issue with the PlatformIO setup

Or if you're pointing to a specific problem, please let me know what needs to be addressed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.registry.nm1.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run --verbose (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio pkg install --platform espressif32 (dns block)
  • api.registry.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run --verbose (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio pkg install --platform espressif32 (dns block)
  • collector.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio run --verbose (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pio /home/REDACTED/.local/bin/pio platform list (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants