00001 /*! \file encoder.h \brief Quadrature Encoder reader/driver. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'encoder.h' 00005 // Title : Quadrature Encoder reader/driver 00006 // Author : Pascal Stang - Copyright (C) 2003 00007 // Created : 2003.01.26 00008 // Revised : 2003.01.26 00009 // Version : 0.1 00010 // Target MCU : Atmel AVR Series 00011 // Editor Tabs : 4 00012 // 00013 // Description : 00014 // 00015 // NOTE: This code is currently below version 1.0, and therefore is considered 00016 // to be lacking in some functionality or documentation, or may not be fully 00017 // tested. Nonetheless, you can expect most functions to work. 00018 // 00019 // This code is distributed under the GNU Public License 00020 // which can be found at http://www.gnu.org/licenses/gpl.txt 00021 // 00022 //***************************************************************************** 00023 00024 #ifndef ENCODER_H 00025 #define ENCODER_H 00026 00027 #include "global.h" 00028 00029 // include encoder configuration file 00030 #include "encoderconf.h" 00031 00032 // constants/macros/typdefs 00033 00034 //! Encoder state structure 00035 // stores the position and other information from each encoder 00036 typedef struct struct_EncoderState 00037 { 00038 u08 position; ///< position 00039 u08 velocity; ///< velocity 00040 } EncoderStateType; 00041 00042 00043 // functions 00044 00045 //! encoderInit() initializes hardware and encoder position readings 00046 // Run this init routine once before using any other encoder function. 00047 void encoderInit(void); 00048 00049 //! encoderOff() disables hardware and stops encoder position updates 00050 void encoderOff(void); 00051 00052 //! encoderGetPosition() reads the current position of the encoder 00053 s32 encoderGetPosition(u08 encoderNum); 00054 00055 //! encoderSetPosition() sets the current position of the encoder 00056 void encoderSetPosition(u08 encoderNum, s32 position); 00057 00058 #endif
1.3-rc2