Compare commits
2 commits
fc610a2f44
...
0c2fbb1d19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c2fbb1d19 | ||
|
|
2d85b5138c |
2 changed files with 14 additions and 8 deletions
11
main.c
11
main.c
|
|
@ -75,7 +75,8 @@
|
||||||
*
|
*
|
||||||
* Ticks are used as our way of keep track of long button presses.
|
* Ticks are used as our way of keep track of long button presses.
|
||||||
* */
|
* */
|
||||||
#define LONG_PRESS_TICKS 60
|
//original sent had 60
|
||||||
|
#define LONG_PRESS_TICKS 66
|
||||||
|
|
||||||
|
|
||||||
/*A structure to hold the button info*/
|
/*A structure to hold the button info*/
|
||||||
|
|
@ -381,9 +382,8 @@ static inline void init_timer0() {
|
||||||
TCCR0B = 0x00; //zero timer
|
TCCR0B = 0x00; //zero timer
|
||||||
|
|
||||||
/*set prescaler*/
|
/*set prescaler*/
|
||||||
//TCCR0B |= (1<<CS00)|(1<<CS02);
|
//Set to div64
|
||||||
TCCR0B |= (1<<CS01)|(1<<CS00);
|
TCCR0B |= (1<<CS01)|(1<<CS00);
|
||||||
//TCCR0B |= (1<<CS01);
|
|
||||||
|
|
||||||
|
|
||||||
/*Enable global interrupts*/
|
/*Enable global interrupts*/
|
||||||
|
|
@ -403,6 +403,9 @@ ISR(TIM0_OVF_vect)
|
||||||
/*Disable global interrupts*/
|
/*Disable global interrupts*/
|
||||||
cli();
|
cli();
|
||||||
|
|
||||||
|
/*Check the state of the switches*/
|
||||||
|
debounce_switch();
|
||||||
|
|
||||||
/*Update the tick_count*/
|
/*Update the tick_count*/
|
||||||
if(btn1.timer_enabled && btn1.pressed_ticks <= UINT8_MAX){
|
if(btn1.timer_enabled && btn1.pressed_ticks <= UINT8_MAX){
|
||||||
btn1.pressed_ticks += 1;
|
btn1.pressed_ticks += 1;
|
||||||
|
|
@ -412,8 +415,6 @@ ISR(TIM0_OVF_vect)
|
||||||
btn2.pressed_ticks += 1;
|
btn2.pressed_ticks += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Check the state of the switches*/
|
|
||||||
debounce_switch();
|
|
||||||
|
|
||||||
/*Re-Enable global interrupts*/
|
/*Re-Enable global interrupts*/
|
||||||
sei();
|
sei();
|
||||||
|
|
|
||||||
11
makefile
11
makefile
|
|
@ -8,8 +8,9 @@
|
||||||
CC = avr-gcc
|
CC = avr-gcc
|
||||||
|
|
||||||
#Default cpu frequency is 9.8Mhz, 4.8 gives us less power consumption
|
#Default cpu frequency is 9.8Mhz, 4.8 gives us less power consumption
|
||||||
#F_CPU = 4800000UL
|
#F_CPU = 1000000UL
|
||||||
F_CPU = 9800000UL
|
F_CPU = 4800000UL
|
||||||
|
#F_CPU = 9800000UL
|
||||||
MCU = attiny13a
|
MCU = attiny13a
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
|
|
@ -45,11 +46,15 @@ $(TARGET).elf: $(OBJ)
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
size: $(TARGET).o
|
size: $(TARGET).o
|
||||||
avr-size --mcu=$(MCU) -t ./$(TARGET).o
|
avr-size --mcu=$(MCU) -t ./$(TARGET).o
|
||||||
|
# Default for the attiny13a is going to be 9.6Mhz
|
||||||
flash_defualt_fuses:
|
flash_defualt_fuses:
|
||||||
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -U lock:w:0xFF:m
|
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -U lock:w:0xFF:m
|
||||||
|
# This is for 4.8Mhz
|
||||||
flash_slow_fuse:
|
flash_slow_fuse:
|
||||||
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U lfuse:w:0x69:m -U hfuse:w:0xFF:m -U lock:w:0xFF:m
|
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U lfuse:w:0x69:m -U hfuse:w:0xFF:m -U lock:w:0xFF:m
|
||||||
|
flash_slow_nodiv8:
|
||||||
|
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U lfuse:w:0x79:m -U hfuse:w:0xFF:m -U lock:w:0xFF:m
|
||||||
flash: $(TARGET).hex
|
flash: $(TARGET).hex
|
||||||
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U flash:w:$(TARGET).hex:i
|
$(AVRDUDE) $(AVRDUDE_PROGRAMMER) $(AVRDUDE_PORT) $(AVRDUDE_MCU) $(BUADRATE) -U flash:w:$(TARGET).hex:i
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue