4
* Attiny portability header.
5
* This helps abstract away the differences between various attiny MCUs.
7
* Copyright (C) 2015 Selene Scriven
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
// Choose your MCU here, or in the main .c file, or in the build script
28
/******************** hardware-specific values **************************/
30
#define F_CPU 4800000UL
35
// TODO: Use 6.4 MHz instead of 8 MHz?
36
#define F_CPU 8000000UL
41
// TODO: Use 6.4 MHz instead of 8 MHz?
42
#define F_CPU 8000000UL
47
Hey, you need to define ATTINY.
51
/******************** I/O pin and register layout ************************/
55
* OTC -|2 7|- Voltage ADC
56
* Star 3 -|3 6|- PWM (FET)
57
* GND -|4 5|- PWM (1x7135)
61
#define STAR2_PIN PB0 // If this pin isn't used for ALT_PWM
62
#define STAR3_PIN PB4 // pin 3
64
#define CAP_PIN PB3 // pin 2, OTC
65
#define CAP_CHANNEL 0x03 // MUX 03 corresponds with PB3 (Star 4)
66
#define CAP_DIDR ADC3D // Digital input disable bit corresponding with PB3
68
#define PWM_PIN PB1 // pin 6, FET PWM
69
#define PWM_LVL OCR0B // OCR0B is the output compare register for PB1
70
#define ALT_PWM_PIN PB0 // pin 5, 1x7135 PWM
71
#define ALT_PWM_LVL OCR0A // OCR0A is the output compare register for PB0
73
#define VOLTAGE_PIN PB2 // pin 7, voltage ADC
74
#define ADC_CHANNEL 0x01 // MUX 01 corresponds with PB2
75
#define ADC_DIDR ADC1D // Digital input disable bit corresponding with PB2
76
#define ADC_PRSCL 0x06 // clk/64
78
//#define TEMP_DIDR ADC4D
79
#define TEMP_CHANNEL 0b00001111