Compare commits
No commits in common. 'f48f18ac64cb4b923725e6d9cc777e9d00cb4243' and 'c151a7bb6707c42545ba1468f785eb7482fdcf34' have entirely different histories.
f48f18ac64
...
c151a7bb67
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,69 +0,0 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#define ENC_PORT PORTD
|
||||
#define ENC_DDR DDRD
|
||||
#define ENC_A PIND&(1<<2)
|
||||
#define ENC_B PIND&(1<<4)
|
||||
#define ENC_CCW 0
|
||||
#define ENC_CW 1
|
||||
|
||||
void encoder_action(uint8_t dir);
|
||||
|
||||
volatile uint8_t encoder_direction;
|
||||
|
||||
ISR(INT0_vect)
|
||||
{
|
||||
if (ENC_B)
|
||||
{
|
||||
if (ENC_A)
|
||||
{
|
||||
encoder_direction = ENC_CCW;
|
||||
encoder_action(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
encoder_direction = ENC_CW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ENC_A)
|
||||
{
|
||||
encoder_direction = ENC_CW;
|
||||
}
|
||||
else
|
||||
{
|
||||
encoder_direction = ENC_CCW;
|
||||
encoder_action(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ISR (PCINT3_vect){
|
||||
if (ENC_B)
|
||||
{
|
||||
if (ENC_A)
|
||||
{
|
||||
encoder_direction = ENC_CW;
|
||||
encoder_action(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
encoder_direction = ENC_CCW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ENC_A)
|
||||
{
|
||||
encoder_direction = ENC_CCW;
|
||||
}
|
||||
else
|
||||
{
|
||||
encoder_direction = ENC_CW;
|
||||
encoder_action(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue