Compare commits

..

No commits in common. "0c2fbb1d194e6bdaf45a81945d5d4cee9cad1c07" and "fc610a2f446091fe504a027f057186e4c4434a42" have entirely different histories.

2 changed files with 8 additions and 14 deletions

11
main.c
View file

@ -75,8 +75,7 @@
* *
* 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.
* */ * */
//original sent had 60 #define LONG_PRESS_TICKS 60
#define LONG_PRESS_TICKS 66
/*A structure to hold the button info*/ /*A structure to hold the button info*/
@ -382,8 +381,9 @@ static inline void init_timer0() {
TCCR0B = 0x00; //zero timer TCCR0B = 0x00; //zero timer
/*set prescaler*/ /*set prescaler*/
//Set to div64 //TCCR0B |= (1<<CS00)|(1<<CS02);
TCCR0B |= (1<<CS01)|(1<<CS00); TCCR0B |= (1<<CS01)|(1<<CS00);
//TCCR0B |= (1<<CS01);
/*Enable global interrupts*/ /*Enable global interrupts*/
@ -403,9 +403,6 @@ 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;
@ -415,6 +412,8 @@ 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();

View file

@ -8,9 +8,8 @@
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 = 1000000UL #F_CPU = 4800000UL
F_CPU = 4800000UL F_CPU = 9800000UL
#F_CPU = 9800000UL
MCU = attiny13a MCU = attiny13a
# Flags # Flags
@ -46,15 +45,11 @@ $(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