~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/hwdef-noctigon-kr4-boost.h

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Noctigon KR4 boost driver layout (attiny1634)
 
2
// Copyright (C) 2020-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
 
5
 
 
6
/*
 
7
 * (based on Noctigon DM11-boost and KR4)
 
8
 * (is basically the same except the switch is on a different pin)
 
9
 *
 
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
 
15
 *   5    PA2   L: button LED
 
16
 *   6    PA1   (none)
 
17
 *   7    PA0   (none)
 
18
 *   8    GND   GND
 
19
 *   9    VCC   VCC
 
20
 *  10    PC5   (none)
 
21
 *  11    PC4   (none)
 
22
 *  12    PC3   RESET
 
23
 *  13    PC2   (none)
 
24
 *  14    PC1   SCK
 
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)
 
29
 *  19    PB0   Opamp power
 
30
 *  20    PA7   (none)  (PCINT7)
 
31
 *      ADC12   thermal sensor
 
32
 *
 
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.
 
38
 */
 
39
 
 
40
#include "hwdef-noctigon-dm11-boost.h"
 
41
 
 
42
// e-switch is on a different pin
 
43
#undef SWITCH_PIN
 
44
#undef SWITCH_PCINT
 
45
#undef SWITCH_PCIE
 
46
#undef SWITCH_PCMSK
 
47
#undef SWITCH_PORT
 
48
#undef SWITCH_PUE
 
49
#undef PCINT_vect
 
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]
 
57