Commit from zer0 (2007-05-06 12:41 CEST) ---------------- Update IRQ_LOCKS for encoders eirbot
aversive modules/devices/encoders/encoders_eirbot/encoders_eirbot.c 1.5 ------------------------------------------------------------------- aversive/modules/devices/encoders/encoders_eirbot/encoders_eirbot.c (1.4 -> 1.5) ------------------------------------------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: encoders_eirbot.c,v 1.4 2006-11-03 09:05:12 zer0 Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: encoders_eirbot.c,v 1.5 2007-05-06 10:41:56 zer0 Exp $ * */ *************** *** 107,112 **** --- 107,113 ---- uint8_t number; int8_t res, lu; uint8_t nombre_a_ajouter; // pour gerer les nombres négatifs + uint8_t flags; for(number = 0 ; number < ENCODERS_NUMBER; number ++) { *************** *** 119,127 **** nombre_a_ajouter = ((res >> (ENCODERS_DATA_NBBITS - 1))&1) ? DIFF_DATA_MASK : 0; // si MSb = 1, on prend mask res = (res & ~DIFF_DATA_MASK) + nombre_a_ajouter; // bits de poids faibles = donnees, les autres = signe ! IRQ_LOCK(); g_codeur_valeurs[number] += res; ! IRQ_UNLOCK(); } } --- 120,128 ---- nombre_a_ajouter = ((res >> (ENCODERS_DATA_NBBITS - 1))&1) ? DIFF_DATA_MASK : 0; // si MSb = 1, on prend mask res = (res & ~DIFF_DATA_MASK) + nombre_a_ajouter; // bits de poids faibles = donnees, les autres = signe ! IRQ_LOCK(flags); g_codeur_valeurs[number] += res; ! IRQ_UNLOCK(flags); } } *************** *** 129,138 **** encoders encoders_get_value(uint8_t number) { encoders value; ! IRQ_LOCK(); value = g_codeur_valeurs[number]; ! IRQ_UNLOCK(); return value; } --- 130,140 ---- encoders encoders_get_value(uint8_t number) { encoders value; + uint8_t flags; ! IRQ_LOCK(flags); value = g_codeur_valeurs[number]; ! IRQ_UNLOCK(flags); return value; } Commit from zer0 (2007-05-06 12:45 CEST) ---------------- Fix pwm to use new aversive_parts.h file aversive modules/hardware/pwm/test/pwm_config.h 1.5 aversive modules/hardware/pwm/config/pwm_config.h 1.3 aversive modules/hardware/pwm/pwm.h 1.9 aversive modules/hardware/pwm/pwm.c 1.10 ----------------------------------------------- aversive/modules/hardware/pwm/test/pwm_config.h (1.4 -> 1.5) ----------------------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm_config.h,v 1.4 2006-03-02 11:24:27 zer0 Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm_config.h,v 1.5 2007-05-06 10:45:43 zer0 Exp $ * */ *************** *** 33,38 **** --- 33,40 ---- #ifndef _PWM_CONFIG_ #define _PWM_CONFIG_ + #define _PWM_CONFIG_VERSION_ 2 + /* Which PWM are enabled ? */ //#define PWM0_ENABLED #define PWM1A_ENABLED *************** *** 49,64 **** // timer configs (not all possibilities can be used at this time) #define TIMER0_MODE TIMER_8_MODE_PWM ! #define TIMER0_PRESCALE TIMER_8_PRESCALE_64 #define TIMER1_MODE TIMER_16_MODE_PWM_10 ! #define TIMER1_PRESCALE TIMER_16_PRESCALE_8 #define TIMER2_MODE TIMER_8_MODE_PWM ! #define TIMER2_PRESCALE TIMER_8_PRESCALE_64 #define TIMER3_MODE TIMER_16_MODE_PWM_10 ! #define TIMER3_PRESCALE TIMER_16_PRESCALE_8 --- 51,66 ---- // timer configs (not all possibilities can be used at this time) #define TIMER0_MODE TIMER_8_MODE_PWM ! #define TIMER0_PRESCALE TIMER0_PRESCALER_DIV_64 #define TIMER1_MODE TIMER_16_MODE_PWM_10 ! #define TIMER1_PRESCALE TIMER1_PRESCALER_DIV_8 #define TIMER2_MODE TIMER_8_MODE_PWM ! #define TIMER2_PRESCALE TIMER1_PRESCALER_DIV_64 #define TIMER3_MODE TIMER_16_MODE_PWM_10 ! #define TIMER3_PRESCALE TIMER3_PRESCALER_DIV_8 ------------------------------------------------- aversive/modules/hardware/pwm/config/pwm_config.h (1.2 -> 1.3) ------------------------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm_config.h,v 1.2 2006-02-28 00:13:10 zer0 Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm_config.h,v 1.3 2007-05-06 10:45:43 zer0 Exp $ * */ *************** *** 33,38 **** --- 33,40 ---- #ifndef _PWM_CONFIG_ #define _PWM_CONFIG_ + #define _PWM_CONFIG_VERSION_ 2 + /* Which PWM are enabled ? */ //#define PWM0_ENABLED #define PWM1A_ENABLED *************** *** 49,64 **** // timer configs (not all possibilities can be used at this time) #define TIMER0_MODE TIMER_8_MODE_PWM ! #define TIMER0_PRESCALE TIMER_8_PRESCALE_64 #define TIMER1_MODE TIMER_16_MODE_PWM_10 ! #define TIMER1_PRESCALE TIMER_16_PRESCALE_8 #define TIMER2_MODE TIMER_8_MODE_PWM ! #define TIMER2_PRESCALE TIMER_8_PRESCALE_64 #define TIMER3_MODE TIMER_16_MODE_PWM_10 ! #define TIMER3_PRESCALE TIMER_16_PRESCALE_8 --- 51,66 ---- // timer configs (not all possibilities can be used at this time) #define TIMER0_MODE TIMER_8_MODE_PWM ! #define TIMER0_PRESCALE TIMER0_PRESCALER_DIV_64 #define TIMER1_MODE TIMER_16_MODE_PWM_10 ! #define TIMER1_PRESCALE TIMER1_PRESCALER_DIV_8 #define TIMER2_MODE TIMER_8_MODE_PWM ! #define TIMER2_PRESCALE TIMER1_PRESCALER_DIV_64 #define TIMER3_MODE TIMER_16_MODE_PWM_10 ! #define TIMER3_PRESCALE TIMER3_PRESCALER_DIV_8 ----------------------------------- aversive/modules/hardware/pwm/pwm.h (1.8 -> 1.9) ----------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm.h,v 1.8 2007-05-01 15:35:52 zer0 Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm.h,v 1.9 2007-05-06 10:45:43 zer0 Exp $ * */ *************** *** 37,42 **** --- 37,43 ---- #include <utils.h> #include <aversive_timers.h> + #include <aversive_parts.h> #include <pwm_config.h> ----------------------------------- aversive/modules/hardware/pwm/pwm.c (1.9 -> 1.10) ----------------------------------- *************** *** 15,21 **** * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm.c,v 1.9 2007-05-01 15:35:52 zer0 Exp $ * */ --- 15,21 ---- * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * Revision : $Id: pwm.c,v 1.10 2007-05-06 10:45:43 zer0 Exp $ * */ *************** *** 37,47 **** --- 37,56 ---- #include "pwm.h" #include <aversive_timers.h> + #include <aversive_parts.h> #include <pwm_config.h> #include "timers_synch.h" + #if _PWM_CONFIG_VERSION_ != 2 + #warning "You are using an old version of pwm_config.h file" + #warning "_PWM_CONFIG_VERSION_ is != 2" + #warning "Look in modules/base/pwm/config directory to import changes" + #warning "You should now use TIMERx_PRESCALER_DIV_XX from" + #warning "include/aversive_parts.h that is arch specific" + #endif + #ifdef TIMER1_MODE
_______________________________________________ Avr-list mailing list Avr-list@droids-corp.org CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive WIKI : http://wiki.droids-corp.org/index.php/Aversive DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/ BUGZILLA : http://bugzilla.droids-corp.org COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog