board/sg-led.c: Implement RGB LED support

Used by AiMe reader, possibly used elsewhere.
This commit is contained in:
Tau
2018-11-20 20:27:05 -05:00
parent 4936fc2bcc
commit 1630784c3d
4 changed files with 256 additions and 0 deletions

30
board/sg-led.h Normal file
View File

@ -0,0 +1,30 @@
#pragma once
#include <windows.h>
#include <stdint.h>
#include "hook/iobuf.h"
struct sg_led_ops {
HRESULT (*reset)(void *ctx);
HRESULT (*set_color)(void *ctx, uint8_t r, uint8_t g, uint8_t b);
};
struct sg_led {
const struct sg_led_ops *ops;
void *ops_ctx;
uint8_t addr;
};
void sg_led_init(
struct sg_led *led,
uint8_t addr,
const struct sg_led_ops *ops,
void *ctx);
void sg_led_transact(
struct sg_led *led,
struct iobuf *resp_frame,
const void *req_bytes,
size_t req_nbytes);