coffee/barista/led.h
2025-11-02 19:24:02 +01:00

36 lines
654 B
C

/* Copyright (c) 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef BARISTA_LED_H
#define BARISTA_LED_H
#ifdef __cplusplus
extern "C" {
#endif
enum led_mode {
LED_OFF = 0,
LED_ON,
LED_PATTERN,
};
struct led {
enum led_mode mode;
const char *pattern;
int pat_i;
int pat_n;
unsigned long step_ms;
unsigned long t_ms;
};
void led_on(struct led *led);
void led_off(struct led *led);
void led_pattern(struct led *led, unsigned long t_ms, unsigned long period_ms, const char *pattern);
int led_level(struct led *led, unsigned long t_ms);
#ifdef __cplusplus
}
#endif
#endif /* BARISTA_LED_H */