2020-06-29 22:52:17 +02:00
|
|
|
/* Copyright 2020 B. Fletcher (toraifu) <typefast@kyaa.gg>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "indicators.h"
|
2024-01-04 07:05:37 +01:00
|
|
|
#include "drivers/led/issi/is31fl3731-mono.h"
|
2020-06-29 22:52:17 +02:00
|
|
|
#include "i2c_master.h"
|
|
|
|
|
|
|
|
/* Set up IS31FL3731 for use in powering indicator LEDs. Absolutely overkill for this job but it was already in the design.
|
|
|
|
* init IS31FL3731 and i2c
|
|
|
|
*/
|
|
|
|
void init_fallacy_leds(void) {
|
2023-11-01 01:53:45 +01:00
|
|
|
is31fl3731_init_drivers();
|
2020-06-29 22:52:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* update the buffer
|
|
|
|
*/
|
|
|
|
void update_fallacy_leds(void) {
|
2023-10-22 19:32:27 +02:00
|
|
|
is31fl3731_flush();
|
2020-06-29 22:52:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* wrapper to actually set the LED PWM
|
|
|
|
*/
|
|
|
|
void set_fallacy_led(int index, bool state) {
|
|
|
|
if (state) {
|
2023-07-29 07:25:00 +02:00
|
|
|
is31fl3731_set_value(index, 128);
|
2020-06-29 22:52:17 +02:00
|
|
|
}
|
|
|
|
else {
|
2023-07-29 07:25:00 +02:00
|
|
|
is31fl3731_set_value(index, 0);
|
2020-06-29 22:52:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* define LED matrix
|
|
|
|
*/
|
2023-11-01 01:53:45 +01:00
|
|
|
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
|
2020-06-29 22:52:17 +02:00
|
|
|
{0, C1_1},
|
|
|
|
{0, C2_1},
|
|
|
|
{0, C3_1},
|
|
|
|
};
|