aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tk-attiny.h13
-rw-r--r--tk-delay.h19
2 files changed, 25 insertions, 7 deletions
diff --git a/tk-attiny.h b/tk-attiny.h
index 9415a97..4fee640 100644
--- a/tk-attiny.h
+++ b/tk-attiny.h
@@ -84,6 +84,19 @@
// TODO: fill in this section, update Ferrero_Rocher code to use it.
#endif // FERRERO_ROCHER_LAYOUT
+#ifdef NANJG_LAYOUT
+#define STAR2_PIN PB0
+#define STAR3_PIN PB4
+#define STAR4_PIN PB3
+#define PWM_PIN PB1
+#define VOLTAGE_PIN PB2
+#define ADC_CHANNEL 0x01 // MUX 01 corresponds with PB2
+#define ADC_DIDR ADC1D // Digital input disable bit corresponding with PB2
+#define ADC_PRSCL 0x06 // clk/64
+
+#define PWM_LVL OCR0B // OCR0B is the output compare register for PB1
+#endif // NANJG_LAYOUT
+
#ifndef PWM_LVL
Hey, you need to define an I/O pin layout.
#endif
diff --git a/tk-delay.h b/tk-delay.h
index 57bdded..324077a 100644
--- a/tk-delay.h
+++ b/tk-delay.h
@@ -28,15 +28,20 @@ void _delay_ms(uint16_t n)
{
// TODO: make this take tenths of a ms instead of ms,
// for more precise timing?
- #ifdef USE_FINE_DELAY
- if (n==0) { _delay_loop_2(BOGOMIPS/3); }
- else {
- while(n-- > 0) _delay_loop_2(BOGOMIPS);
- }
- #else
+ //#ifdef USE_FINE_DELAY
+ //if (n==0) { _delay_loop_2(BOGOMIPS/3); }
+ //else {
+ // while(n-- > 0) _delay_loop_2(BOGOMIPS);
+ //}
+ //#else
while(n-- > 0) _delay_loop_2(BOGOMIPS);
- #endif
+ //#endif
}
+#ifdef USE_FINE_DELAY
+void _delay_zero() {
+ _delay_loop_2(BOGOMIPS/3);
+}
+#endif
#ifdef USE_DELAY_S
void _delay_s() // because it saves a bit of ROM space to do it this way
{