00001 /*! \file fixedpt.h \brief Fixed-point math function library. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'fixedpt.h' 00005 // Title : Fixed-point math function library 00006 // Author : Pascal Stang - Copyright (C) 2003 00007 // Created : 2003.01.26 00008 // Revised : 2003.02.04 00009 // Version : 0.1 00010 // Target MCU : Atmel AVR Series 00011 // Editor Tabs : 4 00012 // 00013 // NOTE: This code is currently below version 1.0, and therefore is considered 00014 // to be lacking in some functionality or documentation, or may not be fully 00015 // tested. Nonetheless, you can expect most functions to work. 00016 // 00017 // This code is distributed under the GNU Public License 00018 // which can be found at http://www.gnu.org/licenses/gpl.txt 00019 // 00020 //***************************************************************************** 00021 00022 #ifndef FIXEDPT_H 00023 #define FIXEDPT_H 00024 00025 #include "global.h" 00026 00027 // constants/macros/typdefs 00028 00029 // functions 00030 00031 //! fixedptInit() initializes fixed-point math function library 00032 // set the number of bits to use behind the point 00033 void fixedptInit(u08 fixedPtBits); 00034 00035 //! convert integer to fixed-point number 00036 s32 fixedptConvertFromInt(s32 int_number); 00037 00038 //! convert fixed-point number to integer 00039 s32 fixedptConvertToInt(s32 fp_number); 00040 00041 //! add a and b (a+b) with fixed-point math 00042 s32 fixedptAdd(s32 a, s32 b); 00043 00044 //! subtract a and b (a-b) with fixed-point math 00045 s32 fixedptSubtract(s32 a, s32 b); 00046 00047 //! multiply a and b (a*b) with fixed-point math 00048 s32 fixedptMultiply(s32 a, s32 b); 00049 00050 //! divide numer by denom (numer/denom) with fixed-point math 00051 s32 fixedptDivide(s32 numer, s32 denom); 00052 00053 #endif
1.3-rc2