trying to figure out how to get 1s in .1s intervals
This commit is contained in:
parent
65cbd98027
commit
27a9eb281a
|
@ -12,7 +12,7 @@ LDFLAGS += -mmcu=$(MCU)
|
|||
AVDFLAGS += -p $(MCU)
|
||||
AVDFLAGS += -c usbtiny
|
||||
|
||||
FUSES += -U lfuse:w:0x7f:m
|
||||
FUSES += -U lfuse:w:0xff:m
|
||||
FUSES += -U hfuse:w:0xd9:m
|
||||
FUSES += -U efuse:w:0xff:m
|
||||
|
||||
|
|
2
avr.c
2
avr.c
|
@ -20,7 +20,7 @@ ISR(TIM0_OVF_vect)
|
|||
|
||||
m += (256 * 64);
|
||||
if (m >= JIFFY_uS) {
|
||||
m %= JIFFY_uS;
|
||||
m -= JIFFY_uS;
|
||||
tick = true;
|
||||
jiffies += 1;
|
||||
}
|
||||
|
|
1
avr.h
1
avr.h
|
@ -5,7 +5,6 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
|
||||
// Make sure JIFFY_uS is going to be an integer and not a float!
|
||||
#define JIFFIES_PER_SECOND 100
|
||||
#define JIFFY_uS (1000000 / JIFFIES_PER_SECOND)
|
||||
|
|
5
main.c
5
main.c
|
@ -242,16 +242,15 @@ loop()
|
|||
{
|
||||
uint32_t i;
|
||||
|
||||
|
||||
if (tick) {
|
||||
tick = false;
|
||||
|
||||
update_controller();
|
||||
|
||||
if (jiffies % (JIFFIES_PER_SECOND / 10) == 0) {
|
||||
if (jiffies % JIFFIES_PER_SECOND == 0) {
|
||||
if (jiffies % 66 == 0) {
|
||||
PORTB ^= 0xff;
|
||||
}
|
||||
if (jiffies % (JIFFIES_PER_SECOND / 10) == 0) {
|
||||
switch (state) {
|
||||
case SETUP:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue