#pragma once
#include <cstdint>
#include <functional>
namespace obb::tools::gimbal {
struct StickState {
int16_t x = 0; // -1024 .. +1024 normalized
int16_t y = 0;
bool press = false; // stick button
};
struct ControllerState {
StickState left;
StickState right;
uint32_t keypad_mask = 0; // 20-key touch keypad mapped to bits
bool rp2040_online = false; // mini USB dongle detected
};
using controller_callback_t = std::function<void(const ControllerState &)>;
void init();
void poll();
void set_callback(controller_callback_t cb);
const ControllerState &last_state();
} // namespace obb::tools::gimbal