00001 /*! \file pwmsw.h \brief Software interrupt-driven multi-output PWM function library. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'pwmsw.h' 00005 // Title : Software interrupt-driven multi-output PWM function library 00006 // Author : Pascal Stang - Copyright (C) 2002 00007 // Created : 7/20/2002 00008 // Revised : 7/31/2002 00009 // Version : 0.1 00010 // Target MCU : Atmel AVR Series 00011 // Editor Tabs : 4 00012 // 00013 // This code is distributed under the GNU Public License 00014 // which can be found at http://www.gnu.org/licenses/gpl.txt 00015 // 00016 //***************************************************************************** 00017 00018 #ifndef PWMSW_H 00019 #define PWMSW_H 00020 00021 #include "global.h" 00022 #include "timer.h" 00023 00024 // constants/macros/typdefs 00025 typedef struct struct_SwPwmChannel 00026 { 00027 u08 port; ///< channel's hardware I/O port 00028 u08 pin; ///< channel's hardware I/O pin 00029 u16 duty; ///< active PWM duty setting 00030 u16 setduty; ///< requested PWM duty setting 00031 } SwPwmChannelType; 00032 00033 // number of PWM channels 00034 #define SWPWM_NUM_CHANNELS 3 00035 // define port 00036 #define SWPWMPORT PORTB 00037 #define SWPWMDDR DDRB 00038 00039 // functions 00040 00041 //! initializes software PWM system 00042 void pwmswInit(u16 periodTics); 00043 00044 //! turns off software PWM system 00045 void pwmswOff(void); 00046 00047 //! set duty on channel 00048 void pwmswPWMSet(u08 channel, u16 duty); 00049 00050 //! software PWM interrupt service routine 00051 void pwmswService(void); 00052 00053 #endif
1.3-rc2