~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/hwdef-noctigon-kr4-2ch.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 w/ tint ramping
 
2
// Copyright (C) 2021-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
 
5
 
 
6
/*
 
7
 * (same driver as emisar-2ch, but with the switch on a different pin)
 
8
 *
 
9
 * Pin / Name / Function
 
10
 *   1    PA6   2nd LED PWM (linear) (PWM1B)
 
11
 *   2    PA5   R: red aux LED (PWM0B)
 
12
 *   3    PA4   G: green aux LED
 
13
 *   4    PA3   B: blue aux LED
 
14
 *   5    PA2   button LED
 
15
 *   6    PA1   Opamp 2 enable (2nd LEDs)
 
16
 *   7    PA0   Opamp 1 enable (main LEDs)
 
17
 *   8    GND   GND
 
18
 *   9    VCC   VCC
 
19
 *  10    PC5   (none)
 
20
 *  11    PC4   (none)
 
21
 *  12    PC3   RESET
 
22
 *  13    PC2   (none)
 
23
 *  14    PC1   SCK
 
24
 *  15    PC0   main LED PWM (FET) (PWM0A) (unused on some models because tint ramping)
 
25
 *  16    PB3   main LED PWM (linear) (PWM1A)
 
26
 *  17    PB2   MISO / e-switch (PCINT10)
 
27
 *  18    PB1   MOSI / battery voltage (ADC6)
 
28
 *  19    PB0   (none)
 
29
 *  20    PA7   (none)
 
30
 *      ADC12   thermal sensor
 
31
 */
 
32
 
 
33
#define ATTINY 1634
 
34
#include <avr/io.h>
 
35
 
 
36
// move the switch to a different pin
 
37
#define SWITCH_PIN   PB2     // pin 17
 
38
#define SWITCH_PCINT PCINT10 // pin 17 pin change interrupt
 
39
#define SWITCH_PCIE  PCIE1   // PCIE1 is for PCINT[11:8]
 
40
#define SWITCH_PCMSK PCMSK1  // PCMSK1 is for PCINT[11:8]
 
41
#define SWITCH_PORT  PINB    // PINA or PINB or PINC
 
42
#define SWITCH_PUE   PUEB    // pullup group B
 
43
#define PCINT_vect   PCINT1_vect  // ISR for PCINT[11:8]
 
44
 
 
45
// the rest of the config is the same as the generic Emisar 2ch build
 
46
#include "hwdef-emisar-2ch.h"
 
47