Skip to content

[suggestion/question] A simple way to inject input / redirect output to stdio? #4841

Closed
@Alfrederson

Description

@Alfrederson

In the ESP32 version of NodeMCU (the lua interpreter) you can do this by calling a function to process an input string placed into a certain buffer and by 1) creating a function that accepts the same parameters as stdout and returns an integer 2) passing that function to esp_vfs_register, so that commands like printf write to that function instead of stdout, and it can call the old stdio, which writes to the uart interface

This way you can have a task running in FreeRTOS that takes data received via the built in bluetooth running in classic mode and issue commands to the interpreter itself, for example

How difficult would it be to do something similar within micropython?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions