We are closed from December 18, 2024 to January 5, 2025. Orders placed during this time will be processed starting on January 6, 2025.

Debugging

C++ drivers can be debugged from the console using the log() method of the Context object. This method follows the C printf() convention.

#include <context.hpp>

class LedBlinker
{
  public:
    LedBlinker(Context& ctx_)
    : ctx(ctx_)
    , ctl(ctx.mm.get<mem::control>())
    {}

    void set_leds(uint32_t led_value) {
        ctl.write<reg::led>(led_value);
        ctx.log<INFO>("Leds set to value %d \n", led_value);
    }

  private:
    Context& ctx
    Memory<mem::control>& ctl;
};

The output is printed on systemd journal and can be viewed on the board console by running the command:

$ journalctl -u koheron-server.service -f

See also

[email protected]