segatools/common/board/io4.h
グローランプ 41d7ce111d mai2io/led15070: add LED control APIs and PWM/fade handling (#89)
## Summary

- feat(io4): implement PWM/GPIO support for Billboard and Code Reader lights
- feat(mai2io): expose LED control APIs to support new io4 features
- fix(led15070): correct multi-LED color logic and add fade support

## Description

**io4 & mai2io Updates**
Introduced PWM control and GPIO write support in `io4`. These additions allow `mai2io` to properly drive the **Billboard LEDs** and **Code Reader / Player Camera lights**. The APIs have been exposed through `mai2hook` to facilitate scriptable control of these peripherals.

**led15070 Improvements**
Fixed an issue with the multi-LED color changing logic in the `led15070` driver. This ensures correct color output sequence and includes improvements for fade calculation.

Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/89
Co-authored-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
Co-committed-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
2025-12-25 20:10:59 +00:00

42 lines
848 B
C

#pragma once
#include <windows.h>
#include <stdint.h>
#include <stdbool.h>
#define IO4_REPORT_OUT_PAYLOAD_LEN 62
enum {
/* System buttons in button[0] */
IO4_BUTTON_TEST = 1 << 9,
IO4_BUTTON_SERVICE = 1 << 6,
};
struct io4_config {
bool enable;
bool foreground_only;
};
struct io4_state {
uint16_t adcs[8];
uint16_t spinners[4];
uint16_t chutes[2];
uint16_t buttons[2];
};
struct io4_ops {
HRESULT (*poll)(void* ctx, struct io4_state* state);
HRESULT (*write_gpio)(uint8_t* payload, size_t len);
HRESULT (*write_pwm)(uint8_t* payload, size_t len);
HRESULT (*write_unique)(uint8_t* payload, size_t len);
};
HRESULT io4_hook_init(
const struct io4_config* cfg,
const struct io4_ops* ops,
void* ctx,
const wchar_t* window_name,
const bool window_name_is_partial_match);