Defines | Functions | Variables
encoder.c File Reference
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "encoder.h"
#include "utils.h"
Include dependency graph for encoder.c:

Go to the source code of this file.


 Standard includes.


void encoder_init ()
int16_t encoder_read ()
void encoder_reset ()


volatile int16_t enc_accum
volatile int8_t enc_delta
static int16_t last

Detailed Description

Code for encoder setup and position acquisition. Contains gray code converter code from Peter Dannegger from, for glitchless encoder position evaluation

Julio Sagardoy

Definition in file encoder.c.

Define Documentation


Standard includes.

AVR includes Own includes

Definition at line 29 of file encoder.c.


Definition at line 30 of file encoder.c.

Function Documentation

void encoder_init ( void  )

Encoder init routine.

Definition at line 77 of file encoder.c.

int16_t encoder_read ( )

Returns actual value in the counter.

Definition at line 47 of file encoder.c.

void encoder_reset ( )

Resets encoder counter to 0. Mandatory to run this after calibration, so it counts from 0.

Definition at line 38 of file encoder.c.

ISR ( TIMER3_COMPA_vect  )

Definition at line 52 of file encoder.c.

Variable Documentation

volatile int16_t enc_accum

Definition at line 33 of file encoder.c.

volatile int8_t enc_delta

Definition at line 32 of file encoder.c.

int16_t last [static]

Definition at line 34 of file encoder.c.

Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:03:46