1
// Noctigon KR4 boost driver layout (attiny1634)
2
// Copyright (C) 2020-2023 Selene ToyKeeper
3
// SPDX-License-Identifier: GPL-3.0-or-later
7
* (based on Noctigon DM11-boost and KR4)
8
* (is basically the same except the switch is on a different pin)
10
* Pin / Name / Function
11
* 1 PA6 (none) (PWM1B) (reserved for DD drivers)
12
* 2 PA5 R: red aux LED (PWM0B)
13
* 3 PA4 G: green aux LED
14
* 4 PA3 B: blue aux LED
25
* 15 PC0 boost PMIC enable (PWM0A not used)
26
* 16 PB3 main LED PWM (PWM1A)
27
* 17 PB2 MISO / e-switch (PCINT10)
28
* 18 PB1 MOSI / battery voltage (ADC6)
30
* 20 PA7 (none) (PCINT7)
31
* ADC12 thermal sensor
33
* Main LED power uses one pin to turn the Opamp on/off,
34
* and one pin to control Opamp power level.
35
* Linear brightness control uses the power level pin, with dynamic PWM.
36
* The on/off pin is only used to turn the main LED on and off,
37
* not to change brightness.
40
#include "hwdef-noctigon-dm11-boost.h"
42
// e-switch is on a different pin
50
#define SWITCH_PIN PB2 // pin 17
51
#define SWITCH_PCINT PCINT10 // pin 17 pin change interrupt
52
#define SWITCH_PCIE PCIE1 // PCIE1 is for PCINT[11:8]
53
#define SWITCH_PCMSK PCMSK1 // PCMSK1 is for PCINT[11:8]
54
#define SWITCH_PORT PINB // PINA or PINB or PINC
55
#define SWITCH_PUE PUEB // pullup group B
56
#define PCINT_vect PCINT1_vect // ISR for PCINT[11:8]