You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(50) |
Feb
(137) |
Mar
(84) |
Apr
(36) |
May
(100) |
Jun
(5) |
Jul
|
Aug
(4) |
Sep
(13) |
Oct
(1) |
Nov
(4) |
Dec
(22) |
2011 |
Jan
(4) |
Feb
(9) |
Mar
(113) |
Apr
(76) |
May
(31) |
Jun
(19) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
(6) |
May
(19) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(22) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jason C. <Ba...@us...> - 2011-06-09 13:49:10
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 0c87730d46b7f3cb3d288d7b1da1cb6cbefae993 (commit) via d302e68ad4ae539ee5c0298292169a74334aa866 (commit) from cf636917019a640478508dbfb03699c7dd791485 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0c87730d46b7f3cb3d288d7b1da1cb6cbefae993 Merge: d302e68ad4ae539ee5c0298292169a74334aa866 cf636917019a640478508dbfb03699c7dd791485 Author: jchevrie <jas...@cr...> Date: Thu Jun 9 15:48:12 2011 +0200 Merge branch 'master' of ssh://krobot.git.sourceforge.net/gitroot/krobot/krobot commit d302e68ad4ae539ee5c0298292169a74334aa866 Author: jchevrie <jas...@cr...> Date: Thu Jun 9 15:46:09 2011 +0200 Fix some bugs and refresh the code. ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/controller_motor_stm32.mk b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/controller_motor_stm32.mk index 258c050..614a6e1 100644 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/controller_motor_stm32.mk +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/controller_motor_stm32.mk @@ -9,7 +9,7 @@ Firmware_DEBUG = 1 # Our target application TRG += controller_motor_stm32 -controller_motor_stm32_PREFIX = "/home/justin/opt/arm-i386/bin/arm-none-eabi-" +controller_motor_stm32_PREFIX = "/home/jason/opt/arm-i386/bin/arm-none-eabi-" controller_motor_stm32_SUFFIX = "" diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.c index 50d4b12..eb2d5bc 100644 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.c +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.c @@ -172,7 +172,6 @@ void NORETURN emission_process(void) int i,j; unsigned short word[LENGTH_WORD]={1}; unsigned short state=0; - int emission_time=EMISSION_TIME_HIGH; for(i=0;i<LENGTH_WORD;i++) { @@ -181,69 +180,30 @@ void NORETURN emission_process(void) } initLatch(); - -//sélection de la diode de départ - writeCommande(0); - - writeSDI(1); - wait_clock(100); - - writeCLK(1); - wait_clock(100); - writeCLK(0); - wait_clock(100); - - writeLatch(1); - wait_clock(100); - writeLatch(0); - wait_clock(100); i=0; j=0; while(1) { - - if (state == 0) emission_time = EMISSION_TIME_HIGH; - if (state == 1) emission_time = EMISSION_TIME_LOW; - - timer_setDelay(&timer_emission_process, us_to_ticks((utime_t)(emission_time))); + timer_setDelay(&timer_emission_process, us_to_ticks((utime_t)(EMISSION_PROCESS_TIME))); timer_setEvent(&timer_emission_process); timer_add(&timer_emission_process);// Start process timer if (state == 0 && word[j] == 1) writeCommande(1); else writeCommande(0); - if(state == 1) - { + if(state == 1){ + state=0; j++; - if(j==LENGTH_WORD) - { + if(j==LENGTH_WORD){ j=0; - i++; - if(i==NUM_LEDS) - { - i=0; - writeSDI(1); - } - else writeSDI(0); - - wait_clock(100); - writeCLK(1); - wait_clock(100); - writeCLK(0); - wait_clock(100); - - writeCommande(0); - - wait_clock(100); - writeLatch(1); - wait_clock(100); - writeLatch(0); - wait_clock(100); + nextLed(); } } - else state=1; + else { + state=1; + } timer_waitEvent(&timer_emission_process); // Wait until the end of counting } @@ -251,22 +211,18 @@ void NORETURN emission_process(void) void initLatch(void) { int i=0; - writeCommande(0); - for(i=0; i<NUM_LEDS;i++) { - writeSDI(0); - - //wait_clock(100); + // initialise the shift register + writeSDI(0); + for(i=0; i<NUM_LEDS;i++) { writeCLK(1); - //wait_clock(100); writeCLK(0); - //wait_clock(100); - - writeLatch(1); - //wait_clock(100); - writeLatch(0); - //wait_clock(100); } + // light all LEDs off + writeCommande(0); + writeLatch(1); + writeLatch(0); + return; } @@ -278,6 +234,9 @@ void wait_clock(int nb_clk) void selectLed(int num_led) { int i; + currentLED = num_led; + initLatch(); + writeSDI(1); // and we wait ... writeCLK(1); // on the rising edge writeCLK(0); @@ -287,6 +246,7 @@ void selectLed(int num_led) { writeCLK(0); } // Finally, writting Latch + writeCommande(0); writeLatch(1); writeLatch(0); return; @@ -303,6 +263,7 @@ void nextLed(void) { writeCLK(1); writeCLK(0); } + writeCommande(0); writeLatch(1); writeLatch(0); currentLED++; @@ -313,12 +274,14 @@ void nextLed(void) { void selectDoubleLed(int num_first_led) { int selectLED; int i; + + initLatch(); selectLED = (num_first_led>=NUM_LEDS/2) ? num_first_led - NUM_LEDS/2 : num_first_led; writeSDI(1); // and we wait ... writeCLK(1); // on the rising edge writeCLK(0); writeSDI(0); - for(i=0; i<NUM_LEDS;i++) { // and we go + for(i=0; i<NUM_LEDS/2-1;i++) { // and we go writeCLK(1); writeCLK(0); } @@ -331,6 +294,7 @@ void selectDoubleLed(int num_first_led) { writeCLK(0); } // Finally, writting Latch + writeCommande(0); writeLatch(1); writeLatch(0); return; diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.h index 9c181fd..a39a916 100644 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.h +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/emission.h @@ -11,10 +11,8 @@ #define PWM_56k 1278 #define NUM_LEDS 16 -#define CYCLE_TIME_US 17 #define LENGTH_WORD 10 -#define EMISSION_TIME_HIGH 35*CYCLE_TIME_US -#define EMISSION_TIME_LOW 15*CYCLE_TIME_US +#define EMISSION_PROCESS_TIME 1000 #define CYCLE_WAIT 100 hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-09 13:37:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via cf636917019a640478508dbfb03699c7dd791485 (commit) from 11060127c18065a3b44a5f0bdfbf2ffe33ab6b17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cf636917019a640478508dbfb03699c7dd791485 Author: Justin <jus...@en...> Date: Thu Jun 9 15:36:11 2011 +0200 New functions for control ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c index 5471c5c..f960c90 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c @@ -630,9 +630,12 @@ void generateRampeRobotPlan() { } } - + + // In the case of negative desiredT W = signeT*W; - //Ajout des composantes de déviations + + // If we want to correct our path + // Ajout des composantes de déviations xVirtuel = cos(theta)*holonome.Pprevious; yVirtuel = sin(theta)*holonome.Pprevious; // dans la base de la table @@ -646,206 +649,44 @@ void generateRampeRobotPlan() { w[2] = (-Vx*sqrt(3)/2+Vy/2)/R-W*L3/R; - + // Calculate new variation of rotation for(i=0;i<3;i++) { - Ti[i]=w[i]*T; + Ti[i]=w[i]*T; } - - + + + // Assign next value of position for(i=0;i<NUM_MOTORS-1;i++) { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; + Ti[i]+= holonome.Tprevious[i]; + holonome.Tprevious[i] = Ti[i]; } - + + // Convert rad position in impulsions for(i=1;i<NUM_MOTORS;i++) { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); + //Moteur i + actualPosition = encoders_status[i].startPosition; + position = convertRadInImpulsions(Ti[i-1],i); - position+=actualPosition; + position+=actualPosition; - encoders_status[i].desiredPosition = position; + encoders_status[i].desiredPosition = position; } } - else { + else { // We are avoiding obstacles for(i=0;i<NUM_MOTORS-1;i++) { - Ti[i]= holonome.Tprevious[i]; - //holonome.Tprevious[i] = Ti[i]; + Ti[i]= holonome.Tprevious[i]; + holonome.Tprevious[i] = Ti[i]; } for(i=1;i<NUM_MOTORS;i++) { - //Moteur i - - position = convertRadInImpulsions(Ti[i-1],i); - - encoders_status[i].desiredPosition = position; + //Moteur i + position = convertRadInImpulsions(Ti[i-1],i); + encoders_status[i].desiredPosition = position; } } return; } - -/* -void generateRampeRobotPlan() { - int i,k; - //Def des variables nécessaires à la générations des rampes - float xmax, ymax,vmax,a; - float P,V; - float Vx, Vy, theta; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Xstart, Ystart; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - xmax = holonome.xmax; - ymax = holonome.ymax; - - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - - if((ymax-Ystart)==0) { - if((xmax-Xstart)<0) holonome.theta=M_PI; - else holonome.theta=0; - } - else holonome.theta = 2*atan((ymax-Ystart)/((xmax-Xstart)+sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)))); - - for(i=0; i<3;i++) { - holonome.Tprevious[i]=0; - } - - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - - //Récolte des données - xmax = holonome.xmax; - ymax = holonome.ymax; - vmax = holonome.vitesse; - a = holonome.acceleration; - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - theta = holonome.theta; - - desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - - } - } - - Vx = V*cos(theta); - Vy = V*sin(theta); - - - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; - - - - for(i=0;i<3;i++) { - Ti[i]=w[i]*T; - } - - - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -}*/ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c index f3ad693..359561d 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c @@ -95,7 +95,7 @@ void makePath(void) { //ouvrir_pinces(); holonome.busy=1; holonome.asserPosition=0; - holonome.xmax = -2.5; + holonome.xmax = -1.5; holonome.ymax = signe*0; holonome.vitesse = 0.25; holonome.acceleration=0.5; @@ -105,7 +105,7 @@ void makePath(void) { case 1://recul holonome.busy=1; holonome.asserPosition=0; - holonome.xmax = -0.45; + holonome.xmax = 0; holonome.ymax = signe*0; holonome.vitesse = 0.25; holonome.acceleration=0.5; hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-09 13:34:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 11060127c18065a3b44a5f0bdfbf2ffe33ab6b17 (commit) from 866ad6a203d8944e3e4b2adbc0c6751634f85c35 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 11060127c18065a3b44a5f0bdfbf2ffe33ab6b17 Author: justin <justin@MacBook.(none)> Date: Thu Jun 9 15:33:20 2011 +0200 Delete some files ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/#main.c# b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/#main.c# deleted file mode 100644 index 77b78d4..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/#main.c# +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Firmware for Controller Motor STM32 - * - * Author : Xavier Lagorce <Xav...@cr...> - */ -#include <cpu/irq.h> -#include <cfg/debug.h> -#include <drv/timer.h> -#include <drv/gpio_stm32.h> -#include <kern/proc.h> -#include <kern/monitor.h> -#include <math.h> - -#include "hw/hw_led.h" -#include "motor.h" -#include "encoder.h" -#include "asservissement.h" - - -PROC_DEFINE_STACK(stack_ind, KERN_MINSTACKSIZE * 2); - -static void init(void) -{ - IRQ_ENABLE; - LEDS_INIT(); - - /* Initialize debugging module (allow kprintf(), etc.) */ - kdbg_init(); - /* Initialize system timer */ - timer_init(); - - /* - * Kernel initialization: processes (allow to create and dispatch - * processes using proc_new()). - */ - proc_init(); - - motorsInit(); - encodersInit(); - controlInit(); - - // Blink to say we are ready - for (uint8_t i=0; i < 5; i++) { - LED1_ON(); - LED2_ON(); - LED3_ON(); - LED4_ON(); - timer_delay(100); - LED1_OFF(); - LED2_OFF(); - LED3_OFF(); - LED4_OFF(); - timer_delay(100); - } -} - -static void NORETURN ind_process(void) -{ - while(1) { - LED1_ON(); - timer_delay(500); - LED1_OFF(); - timer_delay(500); - } -} - -int main(void) -{ - init(); - int status=0; - int coder=0; - /* Create a new child process */ - proc_new(ind_process, NULL, sizeof(stack_ind), stack_ind); - - /* - * The main process is kept to periodically report the stack - * utilization of all the processes (1 probe per second). - */ - - - - - while (1) - { - //monitor_report(); - /* if( getEncoderDirection(ENCODER3) == FORWARD_DIRECTION ) - { - if(status==0) - { - status=1; - LED4_ON(); - } - } - else - { - if(status==1) - { - LED4_OFF(); - status=0; - } - LED4_OFF(); - } - coder = getEncoderCount(ENCODER2); - timer_delay(10); - if ( getEncoderCount(ENCODER2)==65535) LED3_ON(); - //else LED3_OFF(); - timer_delay(10);*/ - timer_delay(1000); - } - - return 0; -} - diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.c deleted file mode 100644 index f760aea..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.c +++ /dev/null @@ -1,765 +0,0 @@ -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" -#include "odometry.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - - - - - - -unsigned short def_encoders[4]={ENCODER1, ENCODER2, ENCODER3, ENCODER4}; -float Kp[NUM_MOTORS]={KP1,KP2,KP3,KP4}; - -PROC_DEFINE_STACK(stack_control, KERN_MINSTACKSIZE * 4); - - -void controlInit(void) { - int i; - - - for(i=0;i<NUM_ENCODERS;i++) - { - encoders_status[i].globalCounter=0; - encoders_status[i].direction=0; - encoders_status[i].speed=0; - encoders_status[i].rampePosition=0; - encoders_status[i].desiredPosition=0; - encoders_status[i].startPosition=0; - encoders_status[i].previousCounter=getEncoderCount(1<<i); - encoders_status[i].busy=0; - } - /* Create a new child process */ - - proc_new(control_process, NULL, sizeof(stack_control), stack_control); - - - return; -} - -void NORETURN control_process(void) -{ - Timer timer_control_process; - int64_t desiredImpulsions[NUM_MOTORS]; - int i; - float desiredPositions[NUM_MOTORS]={0,2*M_PI,2*M_PI,2*M_PI}; - timer_setDelay(&timer_control_process, us_to_ticks((utime_t)(control_refresh))); - timer_setEvent(&timer_control_process); - - enableMotors( MOTEUR4|MOTEUR2|MOTEUR3); - //convertRadInImpulsions(desiredPositions, desiredImpulsions); - - - while(1) { - - timer_add(&timer_control_process);// Start process timer - /*for(i=0;i<NUM_MOTORS;i++) - { - desiredPositions[i]+=0.05; - if (desiredPositions[i]>(2*M_PI)) desiredPositions[i]=2*M_PI; - } - convertRadInImpulsions(desiredPositions, desiredImpulsions);*/ - //generateRampeMotor(MOTEUR4|MOTEUR2|MOTEUR3,-20*2*M_PI,10,5); - generateRampeRobotPlan(); - controlMotors(MOTEUR4|MOTEUR2|MOTEUR3); - - timer_waitEvent(&timer_control_process); // Wait until the end of counting - } - - -} - -void refreshEncoderStatus(unsigned short encoder) { - int i; - int64_t difference; - int32_t currentCounter; - for(i=0;i<NUM_ENCODERS;i++) { - if(encoder & (1<<i)) { - /* Def direction*/ - encoders_status[i].direction = getEncoderDirection(def_encoders[i]); - /* Calcul du compteur global*/ - currentCounter =(int32_t)(getEncoderCount(def_encoders[i])); - difference = (int64_t)(currentCounter-encoders_status[i].previousCounter); - - if( encoders_status[i].direction == FORWARD_DIRECTION) - { - if(difference < 0) - { - difference += 65535; - } - } - else if(difference > 0) difference -= 65535; - encoders_status[i].globalCounter += difference; - encoders_status[i].previousCounter = currentCounter; - /* Speed Calcul*/ - } - } - return; -} - - - -void controlMotors(unsigned short motor) { - - int64_t error; - int32_t PWM; - int i; - - //refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - for(i=0;i<NUM_MOTORS;i++) - { - if(motor & (1<<i)) { - //Conversion en de desiredImpulsions en nombre d'impulsions - - - error = encoders_status[i].desiredPosition - encoders_status[i].globalCounter; - PWM = (int32_t)(error*Kp[i]); - - setVelocity(1<<i, PWM); - encoders_status[i].rampePosition+=1; - } - } - holonome.asserPosition+=1; - return; -} - -int64_t convertRadInImpulsions(float actualPosition,int i ) { - int64_t actualImpulsions; - - actualImpulsions = (int64_t)(actualPosition*REDUCTION*GAINENCODER*4/(2*M_PI)); - - return actualImpulsions; -} - -float convertImpulsionsInRad(int64_t actualImpulsions,int i ) { - float actualPosition; - - actualPosition = (float(actualImpulsions)/(REDUCTION*GAINENCODER*4/(2*M_PI))); - - return actualPosition; -} - -void generateRampeMotor(unsigned short motor, float thetaMax, float vmax, float a) { - int i,k; - //Def des variables nécessaires à la générations des rampes - float tmax=0; //Défintion du temps final de fin de rampe - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float tvmax=vmax/a; //Temps où l'on atteint la vitesse max - float thetaVmax=0; - float theta; - float t1, t2; //Temps pour les trapèzes - float thetaDesired; - unsigned short signe; - - int64_t position; - int64_t actualPosition; - - for(i=0;i<NUM_MOTORS;i++) { - if(motor & 1<<i) { - k=encoders_status[i].rampePosition; - if(k==0) encoders_status[i].startPosition=encoders_status[i].globalCounter; - actualPosition=encoders_status[i].startPosition; - thetaDesired = thetaMax - convertImpulsionsInRad(actualPosition,i); - if(thetaDesired<0) { - signe=1; //On désire aller à une position antérieure - thetaDesired = - thetaDesired; - } - - //Choix du profil : triangulaire ou trapézoïdal - thetaVmax = a*tvmax*tvmax; - if(thetaVmax>thetaDesired) { - //On génère un profil triangulaire - tmax = 2*sqrt(thetaDesired/a); - - N=(int)(floorf(tmax/T))+1; - - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - theta=a/2*t*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - theta=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - } - else { - theta = thetaDesired; - } - } - - position=convertRadInImpulsions(theta,i); - - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = thetaDesired/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - theta=a/2*t*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - theta=a/2*t1*t1+vmax*(t-t1); - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - theta=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - } - else { - theta = thetaDesired; - } - } - - } - position=convertRadInImpulsions(theta,i); - - } - - //On doit maintenant convertir et incrémenter vis-à-vis de la position actuelle - - if(signe==1) position*=-1; - position+=actualPosition; - encoders_status[i].desiredPosition = position; - - } - - } - return; -} - -void generateRampeRobot(void) { - int i,k; - //Def des variables nécessaires à la générations des rampes - float Pmax,vmax,a; - float P,V; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Pstart; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - unsigned short signe; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - for(i=0;i<3;i++) { - //Récolte des données - switch (i) { - case 0: - // X - Pmax = holonome.xmax; - vmax = holonome.vXmax; - a = holonome.ax; - Pstart = holonome.Xstart; - break; - case 1: - // Y - Pmax = holonome.ymax; - vmax = holonome.vYmax; - a = holonome.ay; - Pstart = holonome.Ystart; - break; - case 2: - // T - Pmax = holonome.Tmax; - vmax = holonome.vTmax; - a = holonome.aT; - Pstart = holonome.Tstart; - break; - } - desiredP=Pmax-Pstart; - if(desiredP<0) { - signe = 1; - desiredP = -desiredP; - } - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - } - } - - } - } - if(signe==1) V=-V; - switch (i) { - case 0: - // X - w[0] = 0; - Ti[0]+=0; - w[1]=(V*sqrt(3)/2)/R; - Ti[1] += w[1]*T; - w[2]=-w[1]; - Ti[2] += w[2]*T; - break; - case 1: - // Y - w[0] = -V/R; // - - Ti[0] += w[0]*T; - w[1]= +V/(2*R); //+ - Ti[1] += w[1]*T; - w[2]=w[1]; - Ti[2] += w[2]*T; - break; - case 2: - // T - w[0] = -V*L1/R; - Ti[0] += w[0]*T; - w[1]= -V*L2/R; - Ti[1] += w[1]*T; - w[2]=-V*L3/R;; - Ti[2] += w[2]*T; - break; - } - - - - - - } - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -} - -void generateRampeRobotPlan() { - int i,k; - //Def des variables nécessaires à la générations des rampes - float xmax, ymax,vmax,a; - float P,V; - float xVirtuel, yVirtuel; - float Vx, Vy, theta; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Xstart, Ystart, thetaRobot; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - xmax = holonome.xmax; - ymax = holonome.ymax; - - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - - if((ymax-Ystart)==0) { - if((xmax-Xstart)<0) holonome.theta=M_PI; - else holonome.theta=0; - } - else holonome.theta = 2*atan((ymax-Ystart)/((xmax-Xstart)+sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)))); - - for(i=0; i<3;i++) { - holonome.Tprevious[i]=0; - } - - holonome.Pprevious = 0; - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - - //Récolte des données - xmax = holonome.xmax; - ymax = holonome.ymax; - vmax = holonome.vitesse; - a = holonome.acceleration; - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - theta = holonome.theta; - thetaRobot = holonome_odometry.T; - - desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - - } - } - - Vx = V*cos(theta-thetaRobot); - Vy = V*sin(theta-thetaRobot); - - //Ajout des composantes de déviations - - xVirtuel = cos(theta)*holonome.Pprevious; - yVirtuel = sin(theta)*holonome.Pprevious; // dans la base de la table - - //holonome.Pprevious = P; - //Vx += ((xVirtuel+Xstart-holonome_odometry.X)*cos(thetaRobot)-(yVirtuel+Ystart-holonome_odometry.Y)*sin(thetaRobot))/(5*T); - //Vy += ((yVirtuel+Ystart-holonome_odometry.Y)*cos(thetaRobot)+(xVirtuel+Xstart-holonome_odometry.X)*sin(thetaRobot))/(5*T); - - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; - - - - for(i=0;i<3;i++) { - Ti[i]=w[i]*T; - } - - - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -} - -/* -void generateRampeRobotPlan() { - int i,k; - //Def des variables nécessaires à la générations des rampes - float xmax, ymax,vmax,a; - float P,V; - float Vx, Vy, theta; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Xstart, Ystart; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - xmax = holonome.xmax; - ymax = holonome.ymax; - - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - - if((ymax-Ystart)==0) { - if((xmax-Xstart)<0) holonome.theta=M_PI; - else holonome.theta=0; - } - else holonome.theta = 2*atan((ymax-Ystart)/((xmax-Xstart)+sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)))); - - for(i=0; i<3;i++) { - holonome.Tprevious[i]=0; - } - - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - - //Récolte des données - xmax = holonome.xmax; - ymax = holonome.ymax; - vmax = holonome.vitesse; - a = holonome.acceleration; - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - theta = holonome.theta; - - desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - - } - } - - Vx = V*cos(theta); - Vy = V*sin(theta); - - - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; - - - - for(i=0;i<3;i++) { - Ti[i]=w[i]*T; - } - - - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -}*/ diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.h deleted file mode 100644 index 0c01924..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/asservissement.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef HEADER__ASSERVISSEMENT -#define HEADER__ASSERVISSEMENT - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -#define NUM_ENCODERS 4 - -#define MOTOR_CONTROL1 MOTEUR2 -#define MOTOR_CONTROL2 MOTEUR3 -#define MOTOR_CONTROL3 MOTEUR4 - -#define NUM_MOTORS_CONTROL 3 - -//Paramètre de l'asservissement - - #define control_refresh 5000 - -//Modèle du MOTOR1 - - #define TAU 0 - #define KP1 0.22 - #define KP2 0.22 - #define KP3 0.22 - #define KP4 0.22 - -//Paramètres du PID du MOTOR1 - - #define KP 100 - #define KI 0 - #define KD 0 - -//Paramètres des moteurs - - #define REDUCTION 51 //51:1 - - #define GAINENCODER2 100 - #define GAINENCODER 360 - -//Paramètres du robot - - #define R 0.052 - #define L1 0.1774 - #define L2 0.1774 - #define L3 0.1774 - - - -//Def d'une structure encodeur - -typedef struct { - - int64_t globalCounter; //Somme toutes les impulsions pour connaître la position de la roue - uint8_t direction; //Indique le sens et la direction du moteur - float speed; //Indique la vitesse du moteur - int32_t previousCounter; //Indique la valeur précédente du compteur issu de l'hardware - int64_t desiredPosition; //Vector contenant la rampe suivie par la roue - int64_t startPosition; - int rampePosition; - unsigned short busy; - -} encoder_status; - -typedef struct { - - float xmax; - float vXmax; - float ax; - float ymax; - float vYmax; - float ay; - float Tmax; - float vTmax; - float aT; - float vitesse; - float acceleration; - float theta; - int asserPosition; - float Pprevious; - - //Position du robot sur la table - float X; - float Y; - float T; - float Tprevious[3]; - - float Xstart; - float Ystart; - float Tstart; - - int busy; - -} robot_control; - -robot_control holonome; -encoder_status encoders_status[4]; -void NORETURN control_process(void); - -void controlInit(void); -void refreshEncoderStatus(unsigned short encoder); -void controlMotors(unsigned short motors); -int64_t convertRadInImpulsions( float desiredPosition, int i); -float convertImpulsionsInRad(int64_t actualImpulsions,int i ); -void generateRampeMotor(unsigned short motors, float finalThetaDesired, float vmax, float a); -void generateRampeRobot(void); -void generateRampeRobotPlan(void); - -#endif diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.c deleted file mode 100644 index 41705e7..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.c +++ /dev/null @@ -1,187 +0,0 @@ -#include "encoder.h" -#include "motor.h" -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" - - - -void encodersInit(void) { - - TIM_ICInitTypeDef TIM_ICInitStructure; - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - - // Enable clocking on GPIOA, GPIOB, GPIOC and GPIOD - RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOB | RCC_APB2_GPIOC ; - - /* PinOut - Encoder 1 : A1 := PA6 - B1 := PA7 - - Encoder 2 : A2 := PC6 - B2 := PC7 - - Encoder 3 : A3 := PA8 - B3 := PA9 - - Encoder 4 : A4 := PB6 - B4 := PB7*/ - - // TIM3 (A1,B1) ; TIM8 (A2,B2) ; TIM1 (A3,B3) ; TIM4 (A4,B4) - - // TIMx clock enable - - RCC->APB1ENR |= RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4; - RCC->APB2ENR |= RCC_APB2Periph_TIM8 | RCC_APB2Periph_TIM1; - - // Configuring PinOut mode - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(6) | BV(7) | BV(8) | BV(9), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOB_BASE), - BV(6) | BV(7), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOC_BASE), - BV(6) | BV(7), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - // Configuring TIMx base - - TIM_TimeBaseStructure.TIM_Period = 0xFFFF; - TIM_TimeBaseStructure.TIM_Prescaler = 0; - TIM_TimeBaseStructure.TIM_ClockDivision = 0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - TIM_TimeBaseStructure.TIM_RepetitionCounter = 0; - - TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); - - TIM_ICStructInit(&TIM_ICInitStructure); - TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; - TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; - TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; - TIM_ICInitStructure.TIM_ICFilter = 0x0; - - - - // Configuring chanel 1 - TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; - TIM_ICInit(TIM3, &TIM_ICInitStructure); - TIM_ICInit(TIM8, &TIM_ICInitStructure); - TIM_ICInit(TIM1, &TIM_ICInitStructure); - TIM_ICInit(TIM4, &TIM_ICInitStructure); - - // Configuring chanel 2 - TIM_ICInitStructure.TIM_Channel = TIM_Channel_2; - TIM_ICInit(TIM3, &TIM_ICInitStructure); - TIM_ICInit(TIM8, &TIM_ICInitStructure); - TIM_ICInit(TIM1, &TIM_ICInitStructure); - TIM_ICInit(TIM4, &TIM_ICInitStructure); - - // Réglage de la configuration de l'encodeur : quadrature ou non - - TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM8, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM1, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM4, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - - // Enable encoders - - TIM_Cmd(TIM3, ENABLE); - TIM_Cmd(TIM8, ENABLE); - TIM_Cmd(TIM1, ENABLE); - TIM_Cmd(TIM4, ENABLE); - - resetEncoderCount(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4 ); - - return; -} - -// Obtentions des valeurs des compteurs -uint16_t getEncoderCount(unsigned short encoder) { - switch (encoder) { - case ENCODER1 : - return TIM_GetCounter(TIM3); - break; - case ENCODER2 : - return TIM_GetCounter(TIM8); - break; - case ENCODER3 : - return TIM_GetCounter(TIM1); - break; - case ENCODER4 : - return TIM_GetCounter(TIM4); - break; - } - return 0; -} - -// Reset de la valeur des compteurs à O -void resetEncoderCount(unsigned short encoders) { - - if(encoders & ENCODER1) { - TIM_SetCounter(TIM3,0); - } - - if(encoders & ENCODER2) { - TIM_SetCounter(TIM8,0); - } - - if(encoders & ENCODER3) { - TIM_SetCounter(TIM1,0); - } - - if(encoders & ENCODER4) { - TIM_SetCounter(TIM4,0); - } - - return; -} - -uint8_t getEncoderDirection(unsigned short encoder) { - - uint8_t direction; - switch (encoder) { - case ENCODER1 : - if ((TIM3->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER2 : - if ((TIM8->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER3 : - if ((TIM1->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER4 : - if ((TIM4->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - } - return direction; -} - diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.h deleted file mode 100644 index 99c7be0..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/encoder.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef HEADER__ENCODER -#define HEADER__ENCODER - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" - -#define ENCODER1 1 //encoder connected to the motor 1 -#define ENCODER2 2// ... -#define ENCODER3 4 -#define ENCODER4 8 - -void encodersInit(void); - -uint16_t getEncoderCount(unsigned short encoder); - -void resetEncoderCount(unsigned short encoders); - -uint8_t getEncoderDirection(unsigned short encoder); - -#endif diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.c deleted file mode 100644 index e5a10bd..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.c +++ /dev/null @@ -1,168 +0,0 @@ -#include "intelligence.h" -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" -#include "odometry.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - -PROC_DEFINE_STACK(stack_intelligence, KERN_MINSTACKSIZE * 4); - -int etape=0; - -void intelligenceInit(void) { - int i; - - holonome.xmax=0; - holonome.vXmax=0.25; - holonome.ax=0.25; - holonome.ymax=-0; - holonome.vYmax=0.3; - holonome.ay=0.15; - holonome.Tmax=20*M_PI; - holonome.vTmax=3; - holonome.aT=0.5; - holonome.asserPosition=0; - holonome.X=0; - holonome.Y=0; - holonome.T=0; - holonome.Xstart=0; - holonome.Ystart=0; - holonome.Tstart=0; - holonome.acceleration=0; - holonome.vitesse=0; - holonome.busy =0; - - for(i=0;i<NUM_MOTORS-1;i++) - { - holonome.Tprevious[i]=0; - } - - /* Create a new child process */ - - proc_new(intelligence_process, NULL, sizeof(stack_intelligence), stack_intelligence); - - - return; -} - -void NORETURN intelligence_process(void) -{ - Timer timer_intelligence_process; - timer_setDelay(&timer_intelligence_process, us_to_ticks((utime_t)(intelligence_refresh))); - timer_setEvent(&timer_intelligence_process); - - - - while(1) { - - timer_add(&timer_intelligence_process);// Start process timer - - makePath(); - timer_waitEvent(&timer_intelligence_process); // Wait until the end of counting - } - - -} - -void makePath(void) { - int i; - if(holonome.busy==0) { //On peut donc envoyer une nouvelle position - - holonome.X = holonome_odometry.X; - holonome.Y = holonome_odometry.Y; - - //holonome.X = holonome.xmax; - //holonome.Y = holonome.ymax; - /*for(i=0;i<3;i++) { - holonome.Tprevious[i]=0; - }*/ - //holonome.asserPosition=0; - switch(etape) { - case 0: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 1: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 2: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 3: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 4: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 5: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 6: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 7: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape=0; - break; - - - } - - - } - - - return; -} diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.h deleted file mode 100644 index 42f3da2..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/intelligence.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef HEADER__INTELLIGENCE -#define HEADER__INTELLIGENCE - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -//Paramètre de l'asservissement - - #define intelligence_refresh 50000 - -void makePath(void); -void intelligenceInit(void); - -void NORETURN intelligence_process(void); - -#endif diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.c deleted file mode 100644 index 8cbdeb9..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.c +++ /dev/null @@ -1,350 +0,0 @@ -#include "motor.h" -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" - -/*Private variables */ - - TIM_OCInitTypeDef TIM_OCInitStructure; - - unsigned short def_motors[4]={MOTEUR1, MOTEUR2, MOTEUR3, MOTEUR4}; - motor_status motors_status[4]; - -void motorsInit(void) { - - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - - uint32_t SystemClock = 72000000; - uint32_t Tim2DesiredClock = 72000000; - uint16_t PrescalerValue = 0; - - int i; - - // Enable clocking on GPIOA, GPIOB, GPIOC and GPIOD - RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOB | RCC_APB2_GPIOC | RCC_APB2_GPIOD; - - // Enable clocking on TIM2 - RCC->APB1ENR |= RCC_APB1_TIM2; - //Def I/O of motors - //Port A - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(0) | BV(1) | BV(2) | BV(3), GPIO_MODE_AF_PP, - GPIO_SPEED_50MHZ); //TIM2 on PWM Pins - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(5) | BV(10) , GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port B - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOB_BASE), - BV(1) | BV(14) | BV(15) | BV(5) | BV(9), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port C - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOC_BASE), - BV(4) | BV(5) | BV(10) | BV(11) | BV(9), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port D - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOD_BASE), - BV(2), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Init of TIM2 - - - /*Calcul du Prescalar */ - PrescalerValue = (uint16_t) (SystemClock/Tim2DesiredClock)-1; - //PrescalerValue = 0; - - /*Config du timer2 */ - TIM_TimeBaseStructure.TIM_Period = 3600; //Horloge : 20kHz - TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue; - TIM_TimeBaseStructure.TIM_ClockDivision = 0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - - TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); - - /*Initialisation des PWMs*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; - TIM_OCInitStructure.TIM_Pulse = 0; - TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; - - /*Chanel 1*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC1Init(TIM2, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 2*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC2Init(TIM2, &TIM_OCInitStructure); - TIM_OC2PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 3*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC3Init(TIM2, &TIM_OCInitStructure); - TIM_OC3PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 4*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC4Init(TIM2, &TIM_OCInitStructure); - TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable); - - TIM_ARRPreloadConfig(TIM2, ENABLE); - - /* TIM2 enable counter */ - TIM_Cmd(TIM2, ENABLE); - - /* Init motors_status*/ - for(i=0;i<NUM_MOTORS;i++) - { - motors_status[i].currentPWM=0; - motors_status[i].desiredPosition=0; - motors_status[i].currentPosition=0; - motors_status[i].direction=0; - motors_status[i].speed=0; - } - - return; -} - -void setMotors(unsigned short motors, unsigned short direction) { - /*Def le sens de rotation des moteurs : 0 forward - 1 backward */ - if( motors & MOTEUR1 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 1); - break; - } - } - - if( motors & MOTEUR2 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 1); - break; - } - } - - if( motors & MOTEUR3 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 1); - break; - } - } - - if( motors & MOTEUR4 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 1); - break; - } - } - return; -} - -void enableMotors(unsigned short motors) { - /*Active le pont H du MOTEURX */ - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(5), 1); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(15), 1); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(10), 1); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOD_BASE), BV(2), 1); - } - return; -} - -void disableMotors(unsigned short motors) { - /*Active le pont H du MOTEURX */ - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(5), 0); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(15), 0); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(10), 0); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOD_BASE), BV(2), 0); - } - return; -} - -void setVelocity(unsigned short motors, int32_t velocity) { - - if(velocity > MAX_PWM) velocity=MAX_PWM; - if(velocity < -MAX_PWM) velocity=-MAX_PWM; - - if( motors & MOTEUR1 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(0), 1); - if( velocity >= 0) { - setMotors(MOTEUR1, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR1, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED1_ON(); - else LED1_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC1Init(TIM2, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Enable); - - } - - if( motors & MOTEUR2 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(1), 1); - if( velocity >= 0) { - setMotors(MOTEUR2, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR2, BACKWARD_DIRECTION); - velocity = -velocity; - } - //if(velocity==MAX_PWM) LED2_ON(); - //else LED2_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC2Init(TIM2, &TIM_OCInitStructure); - TIM_OC2PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - if( motors & MOTEUR3 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(2), 1); - if( velocity >= 0) { - setMotors(MOTEUR3, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR3, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED3_ON(); - else LED3_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC3Init(TIM2, &TIM_OCInitStructure); - TIM_OC3PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - if( motors & MOTEUR4 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(3), 1); - if( velocity >= 0) { - setMotors(MOTEUR4, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR4, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED4_ON(); - else LED4_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC4Init(TIM2, &TIM_OCInitStructure); - TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - TIM_ARRPreloadConfig(TIM2, ENABLE); - return; -} - -void breakMotors(unsigned short motors) { - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 1); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 1); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 1); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 1); - } - return; -} - -void freeMotors(unsigned short motors) { - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 0); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 0); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 0); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 0); - } - return; -} diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.h deleted file mode 100644 index 8cbcf3e..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/motor.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef HEADER__MOTOR -#define HEADER__MOTOR - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" - -#include <math.h> - -#define NUM_MOTORS 4 - -#define MOTEUR1 1 //Moteur à gauche de l'ascenseur vue de face -#define MOTEUR2 2 //Moteur suivant dans le sens horaire vue de dessus -#define MOTEUR3 4 //Moteur à droite de l'ascenseur vue de dessus -#define MOTEUR4 8 //Moteur de l'ascenceur principal - -#define FORWARD_DIRECTION 0 //Incrémentation du compteur -#define BACKWARD_DIRECTION 1 //Décrémentation du compteur - -#define MAX_PWM 2300 - -//Def d'une structure moteur - -typedef struct { - uint16_t currentPWM; - float desiredPosition; - float currentPosition; - uint8_t direction; //Indique le sens et la direction du moteur - float speed; //Indique la vitesse du moteur - -} motor_status; - -void motorsInit(void); - -//Commande des moteurs 1..4 - void setMotors(unsigned short motors, unsigned short direction); - void enableMotors(unsigned short motors); - void disableMotors(unsigned short motors); - void breakMotors(unsigned short motors); - void freeMotors(unsigned short motors); - void setVelocity(unsigned short motors, int32_t velocity); - - -#endif diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.c deleted file mode 100644 index 0c96734..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "odometry.h" -#include "intelligence.h" -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - -PROC_DEFINE_STACK(stack_odometry, KERN_MINSTACKSIZE * 4); - - -void odometryInit(void) { - int i; - - holonome_odometry.X=0; - holonome_odometry.Y=0; - holonome_odometry.T=0; - - for(i=0;i<NUM_MOTORS-1;i++) - { - holonome_odometry.previousCounter[i]=0; - } - - /* Create a new child process */ - - proc_new(odometry_process, NULL, sizeof(stack_odometry), stack_odometry); - - - return; -} - -void NORETURN odometry_process(void) -{ - Timer timer_odometry_process; - timer_setDelay(&timer_odometry_process, us_to_ticks((utime_t)(odometry_refresh))); - timer_setEvent(&timer_odometry_process); - - - - while(1) { - - timer_add(&timer_odometry_process);// Start process timer - refreshOdometry(); - timer_waitEvent(&timer_odometry_process); // Wait until the end of counting - } - - -} -/* -void refreshOdometry() { - int i; - int64_t dTheta[3]; - - - // Rafraichissement des encodeurs - refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - - // Prise en compte de la variation d'impulsions - for(i=0; i<NUM_MOTORS;i++) { - if(1<<i & MOTOR_CONTROL1) { - dTheta[0] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[0]; - holonome_odometry.previousCounter[0] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL2) { - dTheta[1] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[1]; - holonome_odometry.previousCounter[1] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL3) { - dTheta[2] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[2]; - holonome_odometry.previousCounter[2] = encoders_status[i].globalCounter; - } - } - // T : position angulaire - holonome_odometry.T += -R/(3*L)*(convertImpulsionsInRad( dTheta[0]+dTheta[1]+dTheta[2],0)); - if(holonome_odometry.T >= 0.01) LED2_ON(); - else LED2_OFF(); - // Y - holonome_odometry.Y += R/3*(convertImpulsionsInRad( -2*dTheta[0]+dTheta[1]+dTheta[2],0)); - // X - holonome_odometry.X += R/(sqrt(3))*(convertImpulsionsInRad( dTheta[1]-dTheta[2],0)); - return; - -}*/ - -void refreshOdometry() { - int i; - float dTheta[3]; - float X1, Y1; - - // Rafraichissement des encodeurs - refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - - // Prise en compte de la variation d'impulsions - for(i=0; i<NUM_MOTORS;i++) { - if(1<<i & MOTOR_CONTROL1) { - dTheta[0] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[0],0); - holonome_odometry.previousCounter[0] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL2) { - dTheta[1] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[1],0); - holonome_odometry.previousCounter[1] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL3) { - dTheta[2] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[2],0); - holonome_odometry.previousCounter[2] = encoders_status[i].globalCounter; - } - } - // T : position angulaire - holonome_odometry.T += -R/(3)*( dTheta[0]/L1+dTheta[1]/L2+dTheta[2]/L3); - if(abs(holonome_odometry.T) >= 0.01) LED2_ON(); - else LED2_OFF(); - X1 = R/(sqrt(3))*(dTheta[1]-dTheta[2]); - Y1 = R/3*( -2*dTheta[0]+dTheta[1]+dTheta[2]); - - // Y - - holonome_odometry.Y += sin(holonome_odometry.T)*X1+ cos(holonome_odometry.T)*Y1; - // X - holonome_odometry.X += cos(holonome_odometry.T)*X1- sin(holonome_odometry.T)*Y1; - return; - -} - diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.h deleted file mode 100644 index be665ba..0000000 --- a/elec/boards/Balise_IR/Carte_diodes/Firmware/controller_motor_stm32/odometry.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef HEADER__ODOMETRY -#define HEADER__ODOMETRY - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -//Paramètre de l'asservissement - - #define odometry_refresh 2500 - -typedef struct { - - int64_t previousCounter[3]; - - //Position du robot sur la table - float X; - float Y; - float T; - - -} robot_odometry; - -robot_odometry holonome_odometry; - - -void odometryInit(void); -void refreshOdometry(void); - -void NORETURN odometry_process(void); - -#endif hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-09 13:27:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 866ad6a203d8944e3e4b2adbc0c6751634f85c35 (commit) from 813f014e3d1f1a42fbd0851c3d877e1739d8710a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 866ad6a203d8944e3e4b2adbc0c6751634f85c35 Author: justin <justin@MacBook.(none)> Date: Thu Jun 9 15:26:17 2011 +0200 Modifications on asservissement code ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/#main.c# b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/#main.c# deleted file mode 100644 index 77b78d4..0000000 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/#main.c# +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Firmware for Controller Motor STM32 - * - * Author : Xavier Lagorce <Xav...@cr...> - */ -#include <cpu/irq.h> -#include <cfg/debug.h> -#include <drv/timer.h> -#include <drv/gpio_stm32.h> -#include <kern/proc.h> -#include <kern/monitor.h> -#include <math.h> - -#include "hw/hw_led.h" -#include "motor.h" -#include "encoder.h" -#include "asservissement.h" - - -PROC_DEFINE_STACK(stack_ind, KERN_MINSTACKSIZE * 2); - -static void init(void) -{ - IRQ_ENABLE; - LEDS_INIT(); - - /* Initialize debugging module (allow kprintf(), etc.) */ - kdbg_init(); - /* Initialize system timer */ - timer_init(); - - /* - * Kernel initialization: processes (allow to create and dispatch - * processes using proc_new()). - */ - proc_init(); - - motorsInit(); - encodersInit(); - controlInit(); - - // Blink to say we are ready - for (uint8_t i=0; i < 5; i++) { - LED1_ON(); - LED2_ON(); - LED3_ON(); - LED4_ON(); - timer_delay(100); - LED1_OFF(); - LED2_OFF(); - LED3_OFF(); - LED4_OFF(); - timer_delay(100); - } -} - -static void NORETURN ind_process(void) -{ - while(1) { - LED1_ON(); - timer_delay(500); - LED1_OFF(); - timer_delay(500); - } -} - -int main(void) -{ - init(); - int status=0; - int coder=0; - /* Create a new child process */ - proc_new(ind_process, NULL, sizeof(stack_ind), stack_ind); - - /* - * The main process is kept to periodically report the stack - * utilization of all the processes (1 probe per second). - */ - - - - - while (1) - { - //monitor_report(); - /* if( getEncoderDirection(ENCODER3) == FORWARD_DIRECTION ) - { - if(status==0) - { - status=1; - LED4_ON(); - } - } - else - { - if(status==1) - { - LED4_OFF(); - status=0; - } - LED4_OFF(); - } - coder = getEncoderCount(ENCODER2); - timer_delay(10); - if ( getEncoderCount(ENCODER2)==65535) LED3_ON(); - //else LED3_OFF(); - timer_delay(10);*/ - timer_delay(1000); - } - - return 0; -} - hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-09 00:29:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 813f014e3d1f1a42fbd0851c3d877e1739d8710a (commit) from f36c674021c358ca888dbe3288de075e51f86556 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 813f014e3d1f1a42fbd0851c3d877e1739d8710a Author: justin <justin@MacBook.(none)> Date: Thu Jun 9 02:28:42 2011 +0200 add rotation during the movment ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#emission.c# b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#emission.c# deleted file mode 100644 index e41799f..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#emission.c# +++ /dev/null @@ -1 +0,0 @@ -STM32STM32 \ No newline at end of file diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#main.c# b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#main.c# deleted file mode 100644 index 77b78d4..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/#main.c# +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Firmware for Controller Motor STM32 - * - * Author : Xavier Lagorce <Xav...@cr...> - */ -#include <cpu/irq.h> -#include <cfg/debug.h> -#include <drv/timer.h> -#include <drv/gpio_stm32.h> -#include <kern/proc.h> -#include <kern/monitor.h> -#include <math.h> - -#include "hw/hw_led.h" -#include "motor.h" -#include "encoder.h" -#include "asservissement.h" - - -PROC_DEFINE_STACK(stack_ind, KERN_MINSTACKSIZE * 2); - -static void init(void) -{ - IRQ_ENABLE; - LEDS_INIT(); - - /* Initialize debugging module (allow kprintf(), etc.) */ - kdbg_init(); - /* Initialize system timer */ - timer_init(); - - /* - * Kernel initialization: processes (allow to create and dispatch - * processes using proc_new()). - */ - proc_init(); - - motorsInit(); - encodersInit(); - controlInit(); - - // Blink to say we are ready - for (uint8_t i=0; i < 5; i++) { - LED1_ON(); - LED2_ON(); - LED3_ON(); - LED4_ON(); - timer_delay(100); - LED1_OFF(); - LED2_OFF(); - LED3_OFF(); - LED4_OFF(); - timer_delay(100); - } -} - -static void NORETURN ind_process(void) -{ - while(1) { - LED1_ON(); - timer_delay(500); - LED1_OFF(); - timer_delay(500); - } -} - -int main(void) -{ - init(); - int status=0; - int coder=0; - /* Create a new child process */ - proc_new(ind_process, NULL, sizeof(stack_ind), stack_ind); - - /* - * The main process is kept to periodically report the stack - * utilization of all the processes (1 probe per second). - */ - - - - - while (1) - { - //monitor_report(); - /* if( getEncoderDirection(ENCODER3) == FORWARD_DIRECTION ) - { - if(status==0) - { - status=1; - LED4_ON(); - } - } - else - { - if(status==1) - { - LED4_OFF(); - status=0; - } - LED4_OFF(); - } - coder = getEncoderCount(ENCODER2); - timer_delay(10); - if ( getEncoderCount(ENCODER2)==65535) LED3_ON(); - //else LED3_OFF(); - timer_delay(10);*/ - timer_delay(1000); - } - - return 0; -} - diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c index 9f36a29..8990b3a 100644 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c @@ -182,7 +182,7 @@ uint16_t calculate_weight(uint16_t k){ if((abs(k-i) < 5) & (i!=k)){ - weight += detectionState[i]*pow(3,5-abs(k-i)); + weight += detectionState[i]*((uint16_t)pow(3,5-abs(k-i))); } diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c index e122cd0..5471c5c 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/asservissement.c @@ -435,6 +435,7 @@ void generateRampeRobotPlan() { //Def des variables nécessaires à la générations des rampes float xmax, ymax,vmax,a; float P,V; + float W, thetaMax, vthetaMax,aW; float xVirtuel, yVirtuel; float Vx, Vy, theta; float Pvmax,tvmax,tmax; @@ -442,7 +443,8 @@ void generateRampeRobotPlan() { float t; //Défini le temps discret int N=0; //Nombre de points dans le vecteur de rampe float t1, t2; //Temps pour les trapèzes - float desiredP; + float desiredP, desiredT; + int signeT=1; //suivant la valeur de DTheta = variation de l'angle du robot float Xstart, Ystart, thetaRobot, Tstart; float Ti[3]={0,0,0}; float w[3]={0,0,0}; @@ -486,14 +488,26 @@ void generateRampeRobotPlan() { xmax = holonome.xmax; ymax = holonome.ymax; vmax = holonome.vitesse; + + thetaMax = holonome.Tmax; + vthetaMax = holonome.vTmax; + a = holonome.acceleration; Xstart = holonome.Xstart; Ystart = holonome.Ystart; - theta = holonome.theta; - thetaRobot = holonome_odometry.T; + Tstart = holonome.Tstart; + theta = holonome.theta; //theta de la droite dans le repère de la table + thetaRobot = holonome_odometry.T; //theta du robot dans le repère de la table desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - + desiredT=thetaMax - Tstart; + + if(desiredT<0) { + signeT=-1; + desiredT = -desiredT; + } + + //Calcul de la vitesse linéaire //Choix du profil : triangulaire ou trapézoïdal tvmax = vmax/a; Pvmax = a*tvmax*tvmax; @@ -566,7 +580,58 @@ void generateRampeRobotPlan() { Vx = V*cos(theta-thetaRobot); Vy = V*sin(theta-thetaRobot); - + + //Calcul de la composante de rotation + //Choix du profil : triangulaire ou trapézoïdal + + if(vthetaMax*tmax/2>desiredT) { + //On génère un profil triangulaire + aW = desiredT*4/(tmax*tmax); + if(t<=tmax/2) { + //On est dans la première partie de la courbe + //Calcul de aW : accélération sur theta + W=aW*t; + } + else { + if(t<=tmax) { + //On est dans la deuxième partie de la coube + W=-aW*t+aW*tmax; + } + else { + W=0; + } + } + } + else { + //On génère un profil trapézoïdal + t1=tmax-desiredT/vthetaMax; + t2 = tmax - t1; + + t=k*T; + aW = vthetaMax/t1; + if(t<=t1) { + //On est dans la première partie de la courbe + W=aW*t; + } + else { + if(t<=t2) { + // On est dans la deuxième partie de la courbe + W=vthetaMax; + } + else { + if(t<=tmax) { + //On est dans la troisième partie de la coube + W=-aW*t+aW*tmax; + } + else { + W=0; + } + } + + } + } + + W = signeT*W; //Ajout des composantes de déviations xVirtuel = cos(theta)*holonome.Pprevious; @@ -576,9 +641,9 @@ void generateRampeRobotPlan() { //Vx += ((xVirtuel+Xstart-holonome_odometry.X)*cos(thetaRobot)-(yVirtuel+Ystart-holonome_odometry.Y)*sin(thetaRobot))/(5*T); //Vy += ((yVirtuel+Ystart-holonome_odometry.Y)*cos(thetaRobot)+(xVirtuel+Xstart-holonome_odometry.X)*sin(thetaRobot))/(5*T); - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; + w[0] = (-Vy)/R-W*L1/R; + w[1] = (Vx*sqrt(3)/2+Vy/2)/R-W*L2/R; + w[2] = (-Vx*sqrt(3)/2+Vy/2)/R-W*L3/R; diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/avoid.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/avoid.c index eb6678f..bc3efa8 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/avoid.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/avoid.c @@ -14,7 +14,7 @@ PROC_DEFINE_STACK(stack_avoid, KERN_MINSTACKSIZE * 4); int actual_state; -float xmax, ymax; +float xmax, ymax, Tmax; int num_wait; unsigned short stop_yet; @@ -125,7 +125,7 @@ void make_choice(void) { for(i=0;i<NUM_SENSORS;i++) { if(sharp_sensors.state_trigger[i]==1) { //Trigger is ON - angle = reset_M_PI((sharp_sensors.circle_position[i]-holonome_odometry.T)-holonome.theta); + angle = reset_M_PI((sharp_sensors.circle_position[i]+holonome_odometry.T)-holonome.theta); if(abs(angle)<DETECTION_AREA/2 || abs((sharp_sensors.circle_position[i]-holonome_odometry.T)-holonome.theta-0*M_PI)<DETECTION_AREA/2) { result=1; //LED2_ON(); @@ -139,10 +139,13 @@ void make_choice(void) { holonome.asserPosition=0; xmax = holonome.xmax; ymax = holonome.ymax; + Tmax = holonome.Tmax; holonome.X = holonome_odometry.X; holonome.Y = holonome_odometry.Y; + holonome.T = holonome_odometry.T; holonome.xmax = holonome_odometry.X; holonome.ymax = holonome_odometry.Y; + holonome.Tmax = holonome_odometry.T; if(num_wait>=0) stop_yet=1; num_wait++; obstacle=1; @@ -153,8 +156,10 @@ void make_choice(void) { holonome.asserPosition = 0; holonome.X = holonome_odometry.X; holonome.Y = holonome_odometry.Y; + holonome.T = holonome_odometry.T; holonome.xmax = xmax; holonome.ymax = ymax; + holonome.Tmax = Tmax; stop_yet=0; num_wait=0; obstacle=0; diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c index b75c2ac..f3ad693 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/controller_motor_stm32/intelligence.c @@ -29,8 +29,8 @@ void intelligenceInit(void) { holonome.ymax=-0; holonome.vYmax=0.3; holonome.ay=0.15; - holonome.Tmax=20*M_PI; - holonome.vTmax=3; + holonome.Tmax=M_PI; + holonome.vTmax=5; holonome.aT=0.5; holonome.asserPosition=0; holonome.X=0; @@ -81,6 +81,7 @@ void makePath(void) { holonome.X = holonome_odometry.X; holonome.Y = holonome_odometry.Y; + holonome.T = holonome_odometry.T; //holonome.X = holonome.xmax; //holonome.Y = holonome.ymax; @@ -91,14 +92,14 @@ void makePath(void) { switch(etape) { case 0://avance droit A(1,2) - ouvrir_pinces(); + //ouvrir_pinces(); holonome.busy=1; holonome.asserPosition=0; - holonome.xmax = -0.5; + holonome.xmax = -2.5; holonome.ymax = signe*0; - holonome.vitesse = 0.5; + holonome.vitesse = 0.25; holonome.acceleration=0.5; - ouvrir_pinces(); + //ouvrir_pinces(); etape+=1; break; case 1://recul @@ -106,12 +107,13 @@ void makePath(void) { holonome.asserPosition=0; holonome.xmax = -0.45; holonome.ymax = signe*0; - holonome.vitesse = 0.5; + holonome.vitesse = 0.25; holonome.acceleration=0.5; + holonome.Tmax = 0; //ouvrir_pinces(); etape+=1; break; - case 2://drift sur la droite + /*case 2://drift sur la droite holonome.busy=1; holonome.asserPosition=0; holonome.xmax = -0.45; @@ -237,7 +239,7 @@ void makePath(void) { holonome.acceleration=0.5; etape+=1; break; - /*case 15: + case 15: holonome.busy=1; holonome.asserPosition=0; holonome.xmax = -0.75; hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-08 21:33:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via f36c674021c358ca888dbe3288de075e51f86556 (commit) from 21fa8c7c828a2ab7dbc159e3bc6543597f5a2ddd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f36c674021c358ca888dbe3288de075e51f86556 Author: justin <justin@MacBook.(none)> Date: Wed Jun 8 23:31:26 2011 +0200 add Junior code for the Control Board ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.project b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.project new file mode 100644 index 0000000..8ce8f23 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.project @@ -0,0 +1,955 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Project Name="Firmware" InternalType=""> +<File Name="Makefile"/> +<VirtualDirectory Name="Firmware"> +<File Name="Firmware/main.c"/> +<File Name="Firmware/Firmware_user.mk"/> +<File Name="Firmware/Firmware.mk"/> +<VirtualDirectory Name="cfg"> +<File Name="Firmware/cfg/cfg_xmodem.h"/> +<File Name="Firmware/cfg/cfg_debug.h"/> +<File Name="Firmware/cfg/cfg_wdt.h"/> +<File Name="Firmware/cfg/cfg_i2s.h"/> +<File Name="Firmware/cfg/cfg_lcd_hd44.h"/> +<File Name="Firmware/cfg/cfg_usb.h"/> +<File Name="Firmware/cfg/cfg_context_switch.h"/> +<File Name="Firmware/cfg/cfg_randpool.h"/> +<File Name="Firmware/cfg/cfg_proc.h"/> +<File Name="Firmware/cfg/cfg_fat.h"/> +<File Name="Firmware/cfg/cfg_usbkbd.h"/> +<File Name="Firmware/cfg/cfg_adc.h"/> +<File Name="Firmware/cfg/cfg_stepper.h"/> +<File Name="Firmware/cfg/cfg_formatwr.h"/> +<File Name="Firmware/cfg/cfg_emb_flash.h"/> +<File Name="Firmware/cfg/cfg_md2.h"/> +<File Name="Firmware/cfg/cfg_lcd_32122a.h"/> +<File Name="Firmware/cfg/cfg_phase.h"/> +<File Name="Firmware/cfg/cfg_dataflash.h"/> +<File Name="Firmware/cfg/cfg_ax25.h"/> +<File Name="Firmware/cfg/cfg_i2c.h"/> +<File Name="Firmware/cfg/cfg_ser.h"/> +<File Name="Firmware/cfg/cfg_usbser.h"/> +<File Name="Firmware/cfg/cfg_sem.h"/> +<File Name="Firmware/cfg/cfg_ramp.h"/> +<File Name="Firmware/cfg/cfg_pocketbus.h"/> +<File Name="Firmware/cfg/cfg_parser.h"/> +<File Name="Firmware/cfg/cfg_hashtable.h"/> +<File Name="Firmware/cfg/cfg_ini_reader.h"/> +<File Name="Firmware/cfg/cfg_kbd.h"/> +<File Name="Firmware/cfg/cfg_kfile.h"/> +<File Name="Firmware/cfg/cfg_afsk.h"/> +<File Name="Firmware/cfg/cfg_monitor.h"/> +<File Name="Firmware/cfg/cfg_lm75.h"/> +<File Name="Firmware/cfg/cfg_timer.h"/> +<File Name="Firmware/cfg/cfg_dc_motor.h"/> +<File Name="Firmware/cfg/cfg_usbmouse.h"/> +<File Name="Firmware/cfg/cfg_flash25.h"/> +<File Name="Firmware/cfg/cfg_thermo.h"/> +<File Name="Firmware/cfg/cfg_spi_bitbang.h"/> +<File Name="Firmware/cfg/cfg_battfs.h"/> +<File Name="Firmware/cfg/cfg_keytag.h"/> +<File Name="Firmware/cfg/cfg_sd.h"/> +<File Name="Firmware/cfg/cfg_gfx.h"/> +<File Name="Firmware/cfg/cfg_heap.h"/> +<File Name="Firmware/cfg/cfg_tas5706a.h"/> +<File Name="Firmware/cfg/cfg_signal.h"/> +<File Name="Firmware/cfg/cfg_pwm.h"/> +<File Name="Firmware/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="Firmware/hw/mcp41_map.h"/> +<File Name="Firmware/hw/hw_phase.c"/> +<File Name="Firmware/hw/hw_kbd.h"/> +<File Name="Firmware/hw/hw_dc_motor.h"/> +<File Name="Firmware/hw/phase_map.h"/> +<File Name="Firmware/hw/thermo_map.h"/> +<File Name="Firmware/hw/hw_tlv5618.h"/> +<File Name="Firmware/hw/hw_lm75.h"/> +<File Name="Firmware/hw/hw_mcp41.h"/> +<File Name="Firmware/hw/hw_ntc.h"/> +<File Name="Firmware/hw/pwm_map.h"/> +<File Name="Firmware/hw/hw_dataflash.c"/> +<File Name="Firmware/hw/kbd_map.h"/> +<File Name="Firmware/hw/hw_tas5706a.h"/> +<File Name="Firmware/hw/hw_ili9225.h"/> +<File Name="Firmware/hw/hw_mcp41.c"/> +<File Name="Firmware/hw/hw_sipo.h"/> +<File Name="Firmware/hw/hw_lcd_32122a.h"/> +<File Name="Firmware/hw/hw_sd.h"/> +<File Name="Firmware/hw/hw_tmp123.h"/> +<File Name="Firmware/hw/hw_lcd_hd44.h"/> +<File Name="Firmware/hw/hw_i2c_bitbang.h"/> +<File Name="Firmware/hw/hw_ft245rl.h"/> +<File Name="Firmware/hw/hw_buzzer.h"/> +<File Name="Firmware/hw/ntc_map.h"/> +<File Name="Firmware/hw/hw_led.h"/> +<File Name="Firmware/hw/hw_spi.h"/> +<File Name="Firmware/hw/hw_stepper.h"/> +<File Name="Firmware/hw/hw_ser.h"/> +<File Name="Firmware/hw/hw_ntc.c"/> +<File Name="Firmware/hw/hw_rit128x96.h"/> +<File Name="Firmware/hw/hw_phase.h"/> +<File Name="Firmware/hw/hw_dataflash.h"/> +<File Name="Firmware/hw/hw_thermo.h"/> +<File Name="Firmware/hw/hw_afsk.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="bertos"> +<File Name="bertos/verstag.c"/> +<File Name="bertos/config.mk"/> +<File Name="bertos/verstag.h"/> +<File Name="bertos/rules.mk"/> +<VirtualDirectory Name="struct"> +<File Name="bertos/struct/fifobuf.h"/> +<File Name="bertos/struct/kfile_mem.h"/> +<File Name="bertos/struct/hashtable_test.c"/> +<File Name="bertos/struct/kfile_fifo.h"/> +<File Name="bertos/struct/heap.c"/> +<File Name="bertos/struct/kfile_fifo.c"/> +<File Name="bertos/struct/pool.h"/> +<File Name="bertos/struct/hashtable.c"/> +<File Name="bertos/struct/bitarray.h"/> +<File Name="bertos/struct/list.h"/> +<File Name="bertos/struct/hashtable.h"/> +<File Name="bertos/struct/bitarray_test.c"/> +<File Name="bertos/struct/heap_test.c"/> +<File Name="bertos/struct/heap.h"/> +<File Name="bertos/struct/kfile_mem.c"/> +<File Name="bertos/struct/kfile_fifo_test.c"/> +</VirtualDirectory> +<VirtualDirectory Name="algo"> +<File Name="bertos/algo/tea.c"/> +<File Name="bertos/algo/tea.h"/> +<File Name="bertos/algo/crc.h"/> +<File Name="bertos/algo/crc_ccitt.c"/> +<File Name="bertos/algo/mean.h"/> +<File Name="bertos/algo/rand.h"/> +<File Name="bertos/algo/ramp.h"/> +<File Name="bertos/algo/reverse_test.c"/> +<File Name="bertos/algo/ramp_test.c"/> +<File Name="bertos/algo/randpool.h"/> +<File Name="bertos/algo/crc_ccitt.h"/> +<File Name="bertos/algo/md2.c"/> +<File Name="bertos/algo/ramp.c"/> +<File Name="bertos/algo/randpool.c"/> +<File Name="bertos/algo/md2.h"/> +<File Name="bertos/algo/crc_test.c"/> +<File Name="bertos/algo/rotating_hash.h"/> +<File Name="bertos/algo/pid_control.h"/> +<File Name="bertos/algo/crc.c"/> +<File Name="bertos/algo/rand.c"/> +<File Name="bertos/algo/rle.h"/> +<File Name="bertos/algo/pid_control.c"/> +<File Name="bertos/algo/rle.c"/> +</VirtualDirectory> +<VirtualDirectory Name="icons"> +<File Name="bertos/icons/Makefile"/> +<File Name="bertos/icons/logo.c"/> +<File Name="bertos/icons/logo.h"/> +<File Name="bertos/icons/flipimage.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="benchmark"> +<File Name="bertos/benchmark/context_switch.c"/> +<File Name="bertos/benchmark/context_switch.h"/> +<File Name="bertos/benchmark/kernel_footprint.c"/> +<File Name="bertos/benchmark/kernel_footprint.h"/> +</VirtualDirectory> +<VirtualDirectory Name="gfx"> +<File Name="bertos/gfx/win.c"/> +<File Name="bertos/gfx/text_format.c"/> +<File Name="bertos/gfx/win.h"/> +<File Name="bertos/gfx/text.h"/> +<File Name="bertos/gfx/gfx_p.h"/> +<File Name="bertos/gfx/gfx.h"/> +<File Name="bertos/gfx/line.c"/> +<File Name="bertos/gfx/charts.c"/> +<File Name="bertos/gfx/fillpoly.cpp"/> +<File Name="bertos/gfx/text.c"/> +<File Name="bertos/gfx/font.h"/> +<File Name="bertos/gfx/bitmap.c"/> +<File Name="bertos/gfx/charts.h"/> +<File Name="bertos/gfx/font_10x20.c"/> +</VirtualDirectory> +<VirtualDirectory Name="cfg"> +<File Name="bertos/cfg/depend.h"/> +<File Name="bertos/cfg/cfg_xmodem.h"/> +<File Name="bertos/cfg/cfg_debug.h"/> +<File Name="bertos/cfg/cfg_wdt.h"/> +<File Name="bertos/cfg/cfg_eth.h"/> +<File Name="bertos/cfg/cfg_i2s.h"/> +<File Name="bertos/cfg/cfg_kern.h"/> +<File Name="bertos/cfg/cfg_lcd_hd44.h"/> +<File Name="bertos/cfg/kfile_debug.c"/> +<File Name="bertos/cfg/module.h"/> +<File Name="bertos/cfg/cfg_usb.h"/> +<File Name="bertos/cfg/cfg_context_switch.h"/> +<File Name="bertos/cfg/cfg_randpool.h"/> +<File Name="bertos/cfg/cfg_menu.h"/> +<File Name="bertos/cfg/cfg_proc.h"/> +<File Name="bertos/cfg/cfg_fat.h"/> +<File Name="bertos/cfg/cfg_usbkbd.h"/> +<File Name="bertos/cfg/cfg_pid.h"/> +<File Name="bertos/cfg/compiler.h"/> +<File Name="bertos/cfg/cfg_adc.h"/> +<File Name="bertos/cfg/cfg_stepper.h"/> +<File Name="bertos/cfg/cfg_formatwr.h"/> +<File Name="bertos/cfg/cfg_boot.h"/> +<File Name="bertos/cfg/cfg_arch.h"/> +<File Name="bertos/cfg/debug.h"/> +<File Name="bertos/cfg/cfg_emb_flash.h"/> +<File Name="bertos/cfg/cfg_md2.h"/> +<File Name="bertos/cfg/log.h"/> +<File Name="bertos/cfg/cfg_lcd_32122a.h"/> +<File Name="bertos/cfg/cfg_phase.h"/> +<File Name="bertos/cfg/cfg_dataflash.h"/> +<File Name="bertos/cfg/cfg_ax25.h"/> +<File Name="bertos/cfg/cfg_i2c.h"/> +<File Name="bertos/cfg/cfg_ser.h"/> +<File Name="bertos/cfg/cfg_usbser.h"/> +<File Name="bertos/cfg/cfg_eeprom.h"/> +<File Name="bertos/cfg/cfg_sem.h"/> +<File Name="bertos/cfg/cfg_attr.h"/> +<File Name="bertos/cfg/cfg_ramp.h"/> +<File Name="bertos/cfg/cfg_pocketbus.h"/> +<File Name="bertos/cfg/cfg_parser.h"/> +<File Name="bertos/cfg/cfg_spi_dma.h"/> +<File Name="bertos/cfg/cfg_hashtable.h"/> +<File Name="bertos/cfg/cfg_ini_reader.h"/> +<File Name="bertos/cfg/cfg_kbd.h"/> +<File Name="bertos/cfg/cfg_ntc.h"/> +<File Name="bertos/cfg/cfg_kfile.h"/> +<File Name="bertos/cfg/kfile_debug.h"/> +<File Name="bertos/cfg/cfg_lwip.h"/> +<File Name="bertos/cfg/cfg_afsk.h"/> +<File Name="bertos/cfg/cfg_monitor.h"/> +<File Name="bertos/cfg/cfg_lm75.h"/> +<File Name="bertos/cfg/cfg_timer.h"/> +<File Name="bertos/cfg/cfg_dc_motor.h"/> +<File Name="bertos/cfg/cfg_usbmouse.h"/> +<File Name="bertos/cfg/cfg_flash25.h"/> +<File Name="bertos/cfg/cfg_buzzerled.h"/> +<File Name="bertos/cfg/cfg_thermo.h"/> +<File Name="bertos/cfg/test.h"/> +<File Name="bertos/cfg/cfg_spi_bitbang.h"/> +<File Name="bertos/cfg/cfg_battfs.h"/> +<File Name="bertos/cfg/cfg_keytag.h"/> +<File Name="bertos/cfg/cfg_sd.h"/> +<File Name="bertos/cfg/cfg_gfx.h"/> +<File Name="bertos/cfg/os.h"/> +<File Name="bertos/cfg/cfg_heap.h"/> +<File Name="bertos/cfg/macros.h"/> +<File Name="bertos/cfg/cfg_tas5706a.h"/> +<File Name="bertos/cfg/cfg_signal.h"/> +<File Name="bertos/cfg/cfg_pwm.h"/> +<File Name="bertos/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fs"> +<File Name="bertos/fs/battfs.h"/> +<File Name="bertos/fs/fat.c"/> +<File Name="bertos/fs/battfs_test.c"/> +<File Name="bertos/fs/fat_test.c"/> +<File Name="bertos/fs/battfs.c"/> +<File Name="bertos/fs/fat.h"/> +<VirtualDirectory Name="fatfs"> +<File Name="bertos/fs/fatfs/ff.h"/> +<File Name="bertos/fs/fatfs/integer.h"/> +<File Name="bertos/fs/fatfs/diskio.h"/> +<File Name="bertos/fs/fatfs/ff.c"/> +<File Name="bertos/fs/fatfs/diskio.c"/> +<VirtualDirectory Name="option"> +<File Name="bertos/fs/fatfs/option/cc950.c"/> +<File Name="bertos/fs/fatfs/option/cc949.c"/> +<File Name="bertos/fs/fatfs/option/cc936.c"/> +<File Name="bertos/fs/fatfs/option/ccsbcs.c"/> +<File Name="bertos/fs/fatfs/option/syncobj.c"/> +<File Name="bertos/fs/fatfs/option/cc932.c"/> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/drv/lcd_32122a.c"/> +<File Name="bertos/drv/lcd_text.c"/> +<File Name="bertos/drv/lcd_hd44.c"/> +<File Name="bertos/drv/lcd_hd44.h"/> +<File Name="bertos/drv/spi_bitbang.h"/> +<File Name="bertos/drv/phase.c"/> +<File Name="bertos/drv/usbmouse.c"/> +<File Name="bertos/drv/tas5706a.c"/> +<File Name="bertos/drv/thermo.h"/> +<File Name="bertos/drv/ser.c"/> +<File Name="bertos/drv/ft245rl.c"/> +<File Name="bertos/drv/usb.h"/> +<File Name="bertos/drv/sd.h"/> +<File Name="bertos/drv/pwm.h"/> +<File Name="bertos/drv/tc520.h"/> +<File Name="bertos/drv/ser.h"/> +<File Name="bertos/drv/phase.h"/> +<File Name="bertos/drv/sipo.c"/> +<File Name="bertos/drv/kbd.c"/> +<File Name="bertos/drv/sd.c"/> +<File Name="bertos/drv/pcf8574.c"/> +<File Name="bertos/drv/mcp41.c"/> +<File Name="bertos/drv/kdebug.c"/> +<File Name="bertos/drv/lcd_ili9225.h"/> +<File Name="bertos/drv/lcd_32122a.h"/> +<File Name="bertos/drv/usbkbd.c"/> +<File Name="bertos/drv/lcd_text.h"/> +<File Name="bertos/drv/dataflash.h"/> +<File Name="bertos/drv/ntc.c"/> +<File Name="bertos/drv/flash25_hwtest.c"/> +<File Name="bertos/drv/adc.c"/> +<File Name="bertos/drv/sipo.h"/> +<File Name="bertos/drv/lm75.c"/> +<File Name="bertos/drv/pcf8574.h"/> +<File Name="bertos/drv/timer_test.c"/> +<File Name="bertos/drv/usbkbd.h"/> +<File Name="bertos/drv/wdt.h"/> +<File Name="bertos/drv/tlv5618.c"/> +<File Name="bertos/drv/dataflash.c"/> +<File Name="bertos/drv/stepper.h"/> +<File Name="bertos/drv/usbmouse.h"/> +<File Name="bertos/drv/lcd_ili9225.c"/> +<File Name="bertos/drv/lcd_rit128x96.h"/> +<File Name="bertos/drv/usb_hid.h"/> +<File Name="bertos/drv/thermo.c"/> +<File Name="bertos/drv/i2c.c"/> +<File Name="bertos/drv/tas5706a.h"/> +<File Name="bertos/drv/timer.h"/> +<File Name="bertos/drv/lcd_text_hwtest.c"/> +<File Name="bertos/drv/dataflash_hwtest.c"/> +<File Name="bertos/drv/dc_motor_hwtest.c"/> +<File Name="bertos/drv/ser_p.h"/> +<File Name="bertos/drv/ft245rl.h"/> +<File Name="bertos/drv/i2c_bitbang.c"/> +<File Name="bertos/drv/tlv5618.h"/> +<File Name="bertos/drv/mcp41.h"/> +<File Name="bertos/drv/tmp123.h"/> +<File Name="bertos/drv/tmp123.c"/> +<File Name="bertos/drv/i2c.h"/> +<File Name="bertos/drv/dc_motor.h"/> +<File Name="bertos/drv/lcd_lm44_qt.cpp"/> +<File Name="bertos/drv/lcd_lm44_qt.h"/> +<File Name="bertos/drv/buzzer.h"/> +<File Name="bertos/drv/stepper.c"/> +<File Name="bertos/drv/buzzerled.h"/> +<File Name="bertos/drv/ntc.h"/> +<File Name="bertos/drv/eeprom.h"/> +<File Name="bertos/drv/mpxx6115a.h"/> +<File Name="bertos/drv/dc_motor.c"/> +<File Name="bertos/drv/lcd_gfx_qt.h"/> +<File Name="bertos/drv/pwm.c"/> +<File Name="bertos/drv/usb_endpoint.h"/> +<File Name="bertos/drv/flash25.h"/> +<File Name="bertos/drv/lcd_rit128x96.c"/> +<File Name="bertos/drv/pwm_hwtest.c"/> +<File Name="bertos/drv/flash.h"/> +<File Name="bertos/drv/eeprom.c"/> +<File Name="bertos/drv/adc.h"/> +<File Name="bertos/drv/buzzerled.c"/> +<File Name="bertos/drv/lcd_gfx_hwtest.c"/> +<File Name="bertos/drv/flash25.c"/> +<File Name="bertos/drv/lm75.h"/> +<File Name="bertos/drv/lcd_gfx_qt.cpp"/> +<File Name="bertos/drv/buzzer.c"/> +<File Name="bertos/drv/kbd.h"/> +<File Name="bertos/drv/usbser.c"/> +<File Name="bertos/drv/usbser.h"/> +<File Name="bertos/drv/timer.c"/> +<File Name="bertos/drv/spi_bitbang.c"/> +<File Name="bertos/drv/tc520.c"/> +<File Name="bertos/drv/lcd_hd44_hwtest.c"/> +</VirtualDirectory> +<VirtualDirectory Name="gui"> +<File Name="bertos/gui/menubar.h"/> +<File Name="bertos/gui/menu.h"/> +<File Name="bertos/gui/levelbar.h"/> +<File Name="bertos/gui/levelbar.c"/> +<File Name="bertos/gui/menu.c"/> +<File Name="bertos/gui/menubar.c"/> +<File Name="bertos/gui/leveledit.h"/> +<File Name="bertos/gui/leveledit.c"/> +</VirtualDirectory> +<VirtualDirectory Name="kern"> +<File Name="bertos/kern/proc_p.h"/> +<File Name="bertos/kern/coop.c"/> +<File Name="bertos/kern/preempt.c"/> +<File Name="bertos/kern/signal.h"/> +<File Name="bertos/kern/sem.c"/> +<File Name="bertos/kern/proc_test.c"/> +<File Name="bertos/kern/sem_test.c"/> +<File Name="bertos/kern/proc.c"/> +<File Name="bertos/kern/kfile.h"/> +<File Name="bertos/kern/signal_test.c"/> +<File Name="bertos/kern/irq.c"/> +<File Name="bertos/kern/sem.h"/> +<File Name="bertos/kern/msg.h"/> +<File Name="bertos/kern/monitor.h"/> +<File Name="bertos/kern/msg_test.c"/> +<File Name="bertos/kern/proc.h"/> +<File Name="bertos/kern/signal.c"/> +<File Name="bertos/kern/irq.h"/> +<File Name="bertos/kern/monitor.c"/> +<VirtualDirectory Name="proc_test"> +<File Name="bertos/kern/proc_test/preempt_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_signal_test.c"/> +<File Name="bertos/kern/proc_test/coop_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_signal_test.c"/> +<File Name="bertos/kern/proc_test/preempt_test.c"/> +<File Name="bertos/kern/proc_test/preempt_heap_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_test.c"/> +<File Name="bertos/kern/proc_test/preempt_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_heap_test.c"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="emul"> +<File Name="bertos/emul/switch_ppc.S"/> +<File Name="bertos/emul/emul.h"/> +<File Name="bertos/emul/timer_qt.h"/> +<File Name="bertos/emul/switch.S"/> +<File Name="bertos/emul/emul.cpp"/> +<File Name="bertos/emul/switch_i386.S"/> +<File Name="bertos/emul/kfile_posix.c"/> +<File Name="bertos/emul/timer_posix.c"/> +<File Name="bertos/emul/timer_posix.h"/> +<File Name="bertos/emul/emul.mk"/> +<File Name="bertos/emul/emulwin.h"/> +<File Name="bertos/emul/timer_qt.c"/> +<File Name="bertos/emul/ser_posix.c"/> +<File Name="bertos/emul/switch_ctx_emul.S"/> +<File Name="bertos/emul/kfile_posix.h"/> +<File Name="bertos/emul/emulkbd.h"/> +<File Name="bertos/emul/emulkbd.cpp"/> +<File Name="bertos/emul/diskio_emul.c"/> +<File Name="bertos/emul/emulwin.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/hw/mcp41_map.h"/> +<File Name="bertos/hw/hw_input.h"/> +<File Name="bertos/hw/hw_phase.c"/> +<File Name="bertos/hw/hw_kbd.h"/> +<File Name="bertos/hw/hw_dc_motor.h"/> +<File Name="bertos/hw/phase_map.h"/> +<File Name="bertos/hw/thermo_map.h"/> +<File Name="bertos/hw/hw_tlv5618.h"/> +<File Name="bertos/hw/hw_lm75.h"/> +<File Name="bertos/hw/hw_mcp41.h"/> +<File Name="bertos/hw/hw_timer.h"/> +<File Name="bertos/hw/hw_boot.h"/> +<File Name="bertos/hw/hw_ntc.h"/> +<File Name="bertos/hw/hw_spi_dma.h"/> +<File Name="bertos/hw/pwm_map.h"/> +<File Name="bertos/hw/hw_dataflash.c"/> +<File Name="bertos/hw/kbd_map.h"/> +<File Name="bertos/hw/hw_tas5706a.h"/> +<File Name="bertos/hw/hw_ili9225.h"/> +<File Name="bertos/hw/hw_lcd.h"/> +<File Name="bertos/hw/hw_cpufreq.h"/> +<File Name="bertos/hw/hw_mcp41.c"/> +<File Name="bertos/hw/hw_sipo.h"/> +<File Name="bertos/hw/hw_tc520.h"/> +<File Name="bertos/hw/hw_lcd_32122a.h"/> +<File Name="bertos/hw/hw_sd.h"/> +<File Name="bertos/hw/hw_tmp123.h"/> +<File Name="bertos/hw/hw_lcd_hd44.h"/> +<File Name="bertos/hw/hw_i2c_bitbang.h"/> +<File Name="bertos/hw/hw_ft245rl.h"/> +<File Name="bertos/hw/hw_buzzer.h"/> +<File Name="bertos/hw/ntc_map.h"/> +<File Name="bertos/hw/hw_led.h"/> +<File Name="bertos/hw/hw_spi.h"/> +<File Name="bertos/hw/hw_stepper.h"/> +<File Name="bertos/hw/hw_blanker.h"/> +<File Name="bertos/hw/hw_buzzerled.h"/> +<File Name="bertos/hw/hw_ser.h"/> +<File Name="bertos/hw/hw_sensor.h"/> +<File Name="bertos/hw/hw_ntc.c"/> +<File Name="bertos/hw/hw_rit128x96.h"/> +<File Name="bertos/hw/hw_phase.h"/> +<File Name="bertos/hw/hw_dataflash.h"/> +<File Name="bertos/hw/hw_thermo.h"/> +<File Name="bertos/hw/hw_afsk.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fonts"> +<File Name="bertos/fonts/ncenB18.c"/> +<File Name="bertos/fonts/fixed6x8.c"/> +<File Name="bertos/fonts/helvB10.c"/> +<File Name="bertos/fonts/luBS14.c"/> +<File Name="bertos/fonts/gohu.c"/> +<File Name="bertos/fonts/fonts.mk"/> +</VirtualDirectory> +<VirtualDirectory Name="cpu"> +<File Name="bertos/cpu/power.h"/> +<File Name="bertos/cpu/detect.h"/> +<File Name="bertos/cpu/types.h"/> +<File Name="bertos/cpu/attr.h"/> +<File Name="bertos/cpu/byteorder.h"/> +<File Name="bertos/cpu/frame.h"/> +<File Name="bertos/cpu/irq.h"/> +<File Name="bertos/cpu/pgm.h"/> +<VirtualDirectory Name="avr"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/avr/drv/stepper_avr.h"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.h"/> +<File Name="bertos/cpu/avr/drv/wdt_avr.h"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.c"/> +<File Name="bertos/cpu/avr/drv/adc_avr.h"/> +<File Name="bertos/cpu/avr/drv/adc_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.h"/> +<File Name="bertos/cpu/avr/drv/kdebug_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/stepper_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.c"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.c"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.h"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/avr/hw/switch_ctx_avr.S"/> +<File Name="bertos/cpu/avr/hw/switch_avr.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="arm"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/lpc2378.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/arm/drv/sysirq_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_arm.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2c_arm.h"/> +<File Name="bertos/cpu/arm/drv/flash_arm.h"/> +<File Name="bertos/cpu/arm/drv/adc_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/twi_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.c"/> +<File Name="bertos/cpu/arm/drv/sysirq_at91.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_arm.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.h"/> +<File Name="bertos/cpu/arm/drv/i2c_at91.h"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/adc_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91_hwtest.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/adc_at91.h"/> +<File Name="bertos/cpu/arm/drv/wdt_arm.h"/> +<File Name="bertos/cpu/arm/drv/ser_at91.c"/> +<File Name="bertos/cpu/arm/drv/adc_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_at91.c"/> +<File Name="bertos/cpu/arm/drv/twi_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.h"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_at91.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.h"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.c"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.c"/> +<File Name="bertos/cpu/arm/drv/ser_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_arm.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.c"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/arm/hw/vectors_at91.S"/> +<File Name="bertos/cpu/arm/hw/init_at91.c"/> +<File Name="bertos/cpu/arm/hw/switch_ctx_arm.S"/> +<File Name="bertos/cpu/arm/hw/switch_arm.S"/> +<File Name="bertos/cpu/arm/hw/crtat91sam7_rom.S"/> +<File Name="bertos/cpu/arm/hw/vectors_lpc2.S"/> +<File Name="bertos/cpu/arm/hw/pll_at91.h"/> +<File Name="bertos/cpu/arm/hw/init_lpc2.c"/> +<File Name="bertos/cpu/arm/hw/crt_arm7tdmi.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/arm/io/at91_pwm.h"/> +<File Name="bertos/cpu/arm/io/at91.h"/> +<File Name="bertos/cpu/arm/io/at91_aic.h"/> +<File Name="bertos/cpu/arm/io/at91_twi.h"/> +<File Name="bertos/cpu/arm/io/lpc23xx.h"/> +<File Name="bertos/cpu/arm/io/at91_ssc.h"/> +<File Name="bertos/cpu/arm/io/at91_spi.h"/> +<File Name="bertos/cpu/arm/io/at91_emac.h"/> +<File Name="bertos/cpu/arm/io/at91_dbgu.h"/> +<File Name="bertos/cpu/arm/io/at91_wdt.h"/> +<File Name="bertos/cpu/arm/io/at91_mc.h"/> +<File Name="bertos/cpu/arm/io/at91_adc.h"/> +<File Name="bertos/cpu/arm/io/at91_pio.h"/> +<File Name="bertos/cpu/arm/io/at91_pit.h"/> +<File Name="bertos/cpu/arm/io/at91_pmc.h"/> +<File Name="bertos/cpu/arm/io/at91_tc.h"/> +<File Name="bertos/cpu/arm/io/at91_us.h"/> +<File Name="bertos/cpu/arm/io/arm.h"/> +<File Name="bertos/cpu/arm/io/at91_rstc.h"/> +<File Name="bertos/cpu/arm/io/at91sam7.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="dsp56k"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/dsp56k/drv/kdebug_dsp56k.c"/> +<File Name="bertos/cpu/dsp56k/drv/timer_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/buzzerled_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/dsp56k/hw/switch_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="x86"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="cortex-m3"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/stm32f103rb_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/cortex-m3/hw/crt_cm3.S"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/init_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/vectors_cm3.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/cortex-m3/io/lm3s_pwm.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_wdt.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3.h"/> +<File Name="bertos/cpu/cortex-m3/io/cm3.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_memmap.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3n.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_types.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ssi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_usart.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pio.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_spi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_com.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pmc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_memmap.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="ppc"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="i196"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/i196/drv/timer_i196.h"/> +<File Name="bertos/cpu/i196/drv/ser_i196.c"/> +<File Name="bertos/cpu/i196/drv/kdebug_i196.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="mware"> +<File Name="bertos/mware/readline.h"/> +<File Name="bertos/mware/parser.h"/> +<File Name="bertos/mware/blanker.h"/> +<File Name="bertos/mware/strtol10.h"/> +<File Name="bertos/mware/observer.h"/> +<File Name="bertos/mware/cmd_hunk.h"/> +<File Name="bertos/mware/strtol10.c"/> +<File Name="bertos/mware/sprintf.c"/> +<File Name="bertos/mware/formatwr.h"/> +<File Name="bertos/mware/event.h"/> +<File Name="bertos/mware/event.c"/> +<File Name="bertos/mware/resource.h"/> +<File Name="bertos/mware/parser.c"/> +<File Name="bertos/mware/formatwr.c"/> +<File Name="bertos/mware/observer.c"/> +<File Name="bertos/mware/readline.c"/> +<File Name="bertos/mware/hex.h"/> +<File Name="bertos/mware/resource.c"/> +<File Name="bertos/mware/sprintf_test.c"/> +<File Name="bertos/mware/hex.c"/> +<File Name="bertos/mware/ini_reader_test.c"/> +<File Name="bertos/mware/messages.c"/> +<File Name="bertos/mware/rle.h"/> +<File Name="bertos/mware/ini_reader.h"/> +<File Name="bertos/mware/ini_reader.c"/> +<File Name="bertos/mware/messages.h"/> +<File Name="bertos/mware/blanker.c"/> +<File Name="bertos/mware/byteorder.h"/> +<File Name="bertos/mware/except.h"/> +<File Name="bertos/mware/pgm.h"/> +</VirtualDirectory> +<VirtualDirectory Name="os"> +<File Name="bertos/os/hptime.h"/> +<File Name="bertos/os/hptime.c"/> +</VirtualDirectory> +<VirtualDirectory Name="net"> +<File Name="bertos/net/keytag.h"/> +<File Name="bertos/net/nmea.c"/> +<File Name="bertos/net/xmodem.h"/> +<File Name="bertos/net/pocketcmd.h"/> +<File Name="bertos/net/pocketbus.c"/> +<File Name="bertos/net/ax25_test.c"/> +<File Name="bertos/net/nmea.h"/> +<File Name="bertos/net/afsk_test.c"/> +<File Name="bertos/net/pocketbus.h"/> +<File Name="bertos/net/ax25.c"/> +<File Name="bertos/net/pocketcmd.c"/> +<File Name="bertos/net/nmea_test.c"/> +<File Name="bertos/net/afsk.h"/> +<File Name="bertos/net/afsk.c"/> +<File Name="bertos/net/ax25.h"/> +<File Name="bertos/net/keytag.c"/> +<File Name="bertos/net/xmodem.c"/> +<VirtualDirectory Name="nmeap"> +<File Name="bertos/net/nmeap/Makefile"/> +<VirtualDirectory Name="tst"> +<File Name="bertos/net/nmeap/tst/wingps.c"/> +<File Name="bertos/net/nmeap/tst/test1.c"/> +<File Name="bertos/net/nmeap/tst/Makefile"/> +<File Name="bertos/net/nmeap/tst/test3.c"/> +<File Name="bertos/net/nmeap/tst/test2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="inc"> +<File Name="bertos/net/nmeap/inc/nmeap_def.h"/> +<File Name="bertos/net/nmeap/inc/nmeap.h"/> +</VirtualDirectory> +<VirtualDirectory Name="src"> +<File Name="bertos/net/nmeap/src/nmeap01.c"/> +<File Name="bertos/net/nmeap/src/Makefile"/> +</VirtualDirectory> +<VirtualDirectory Name="lib"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/io/kblock_ram.h"/> +<File Name="bertos/io/kblock_posix.h"/> +<File Name="bertos/io/kblock_posix.c"/> +<File Name="bertos/io/kfile_test.c"/> +<File Name="bertos/io/kblock.h"/> +<File Name="bertos/io/kfile.h"/> +<File Name="bertos/io/kfile_block.h"/> +<File Name="bertos/io/kfile_block.c"/> +<File Name="bertos/io/kblock_ram.c"/> +<File Name="bertos/io/kfile.c"/> +<File Name="bertos/io/kblock.c"/> +</VirtualDirectory> +<VirtualDirectory Name="dt"> +<File Name="bertos/dt/dnotifier.h"/> +<File Name="bertos/dt/dwidget.h"/> +<File Name="bertos/dt/editint.c"/> +<File Name="bertos/dt/editint.h"/> +<File Name="bertos/dt/dwidget.c"/> +<File Name="bertos/dt/dnotifier.c"/> +<File Name="bertos/dt/dtag.h"/> +<File Name="bertos/dt/editbool.h"/> +<File Name="bertos/dt/editbool.c"/> +</VirtualDirectory> +</VirtualDirectory> + <Description></Description> + <Dependencies/> + <Settings Type="Dynamic Library"> + <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Debug" Command="./images/Firmware.elf" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options="-g"> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options=""/> + <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="3333" DebuggerPath="/usr/bin/i686-linux-gnu-gdb-4.5"> + <PostConnectCommands> +source bertos/prg_scripts/arm/openocd/gdbinit-sam7 + </PostConnectCommands> + <StartupCommands> +shell sleep 2 + </StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options=""> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options="-O2"/> + <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath=""> + <PostConnectCommands></PostConnectCommands> + <StartupCommands></StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + </Settings> +</CodeLite_Project> diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.workspace b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.workspace new file mode 100644 index 0000000..3a8d0fa --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Firmware.workspace @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Workspace Name="Firmware" Database="./bertos.tags"> + <Project Name="Firmware" Path="Firmware.project" Active="Yes"/> + <BuildMatrix> + <WorkspaceConfiguration Name="Debug" Selected="yes"> + <Project Name="Firmware" ConfigName="Debug"/> + </WorkspaceConfiguration> + <WorkspaceConfiguration Name="Release" Selected="yes"> + <Project Name="Firmware" ConfigName="Release"/> + </WorkspaceConfiguration> + </BuildMatrix> +</CodeLite_Workspace> diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Makefile b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Makefile new file mode 100644 index 0000000..cb8af58 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni <du...@de...> +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include controller_motor_stm32/controller_motor_stm32.mk + +include bertos/rules.mk diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/VERSION b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/VERSION new file mode 100644 index 0000000..ab7cff5 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/VERSION @@ -0,0 +1 @@ +BeRTOS 2.6.1 [local copy] diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.c new file mode 100644 index 0000000..d4293f9 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.c @@ -0,0 +1,102 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC table and support routines + * + * \author Bernie Innocenti <be...@co...> + */ + +#include "crc.h" + +/* + * The boot on AVR cpu is placed at the end of flash memory, but the avr + * address memory by byte and the pointers are 16bits long, so we are able + * to address 64Kbyte memory max. For this reason we can't read the crctab + * from flash, because it is placed at the end of memory. This is true every + * time we have an AVR cpu with more that 64Kbyte of flash. To fix this problem + * we let the compiler copy the table in RAM at startup. Obviously this solution + * is not efficent, but for now this is the only way. + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define CRC_TABLE const uint16_t PROGMEM crc16tab[256] +#else + #define CRC_TABLE const uint16_t crc16tab[256] +#endif + +/** + * crctab calculated by Mark G. Mendel, Network Systems Corporation + */ +CRC_TABLE = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + +uint16_t crc16(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while(len--) + crc = UPDCRC16(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.h b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.h new file mode 100644 index 0000000..c5c1eef --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief Cyclic Redundancy Check 16 (CRC). This algorithm is the one used by the XMODEM protocol. + * + * \note This algorithm is incompatible with the CCITT-CRC16. + * + * This code is based on the article Copyright 1986 Stephen Satchell. + * + * Programmers may incorporate any or all code into their programs, + * giving proper credit within the source. Publication of the + * source routines is permitted so long as proper credit is given + * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, + * Omen Technology. + * + * \author Bernie Innocenti <be...@co...> + * + * $WIZ$ module_name = "crc16" + */ + +#ifndef ALGO_CRC_H +#define ALGO_CRC_H + +#include "cfg/cfg_arch.h" + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc16tab[256]; + + +/** + * \brief Compute the updated CRC16 value for one octet (macro version) + * + * \note This version is only intended for old/broken compilers. + * Use the inline function in new code. + * + * \param c New octet (range 0-255) + * \param oldcrc Previous CRC16 value (referenced twice, beware of side effects) + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define UPDCRC16(c, oldcrc) (pgm_read_uint16_t(&crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#else + #define UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#endif + +/** CRC-16 init value */ +#define CRC16_INIT_VAL ((uint16_t)0) + +#ifdef INLINE +/** + * \brief Compute the updated CRC16 value for one octet (inline version) + */ +INLINE uint16_t updcrc16(uint8_t c, uint16_t oldcrc) +{ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + return pgm_read_uint16_t(&crc16tab[(oldcrc >> 8) ^ c]) ^ (oldcrc << 8); +#else + return crc16tab[(oldcrc >> 8) ^ c] ^ (oldcrc << 8); +#endif +} +#endif // INLINE + + +/** + * This function implements the CRC 16 calculation on a buffer. + * + * \param crc Current CRC16 value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC16 value. + */ +extern uint16_t crc16(uint16_t crc, const void *buf, size_t len); + +int crc_testSetup(void); +int crc_testRun(void); +int crc_testTearDown(void); + +EXTERN_C_END + +#endif /* ALGO_CRC_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.c new file mode 100644 index 0000000..feaf624 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.c @@ -0,0 +1,83 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" + +const uint16_t PROGMEM crc_ccitt_tab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, +}; + +uint16_t crc_ccitt(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while (len--) + crc = updcrc_ccitt(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.h b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.h new file mode 100644 index 0000000..240e6e1 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_ccitt.h @@ -0,0 +1,78 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CCITT Cyclic Redundancy Check (CRC-CCITT). + * + * \note This algorithm is incompatible with the CRC16. + * + * \author Francesco Sacchi <ba...@de...> + * + * $WIZ$ module_name = "crc-ccitt" + */ + +#ifndef ALGO_CRC_CCITT_H +#define ALGO_CRC_CCITT_H + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc_ccitt_tab[256]; + +/** + * \brief Compute the updated CRC-CCITT value for one octet (inline version) + */ +INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) +{ + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); +} + +/** CRC-CCITT init value */ +#define CRC_CCITT_INIT_VAL ((uint16_t)0xFFFF) + + +/** + * This function implements the CRC-CCITT calculation on a buffer. + * + * \param crc Current CRC-CCITT value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC-CCITT value. + */ +extern uint16_t crc_ccitt(uint16_t crc, const void *buf, size_t len); + +EXTERN_C_END + +#endif /* ALGO_CRC_CCITT_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_test.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_test.c new file mode 100644 index 0000000..1a93e3b --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/crc_test.c @@ -0,0 +1,75 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" +#include "crc.h" + +#include <cfg/debug.h> +#include <cfg/test.h> + + +int crc_testSetup(void) +{ + kdbg_init(); + return 0; +} + +int crc_testTearDown(void) +{ + return 0; +} + +int crc_testRun(void) +{ + char vector[9] = "123456789"; + + uint16_t crc = CRC_CCITT_INIT_VAL; + + crc = crc_ccitt(crc, vector, sizeof(vector)); + kprintf("crc_ccitt [%04X]\n", crc); + ASSERT(crc == 0x6F91); + + crc = CRC16_INIT_VAL; + crc = crc16(crc, vector, sizeof(vector)); + kprintf("crc16 [%04X]\n", crc); + ASSERT(crc == 0x31C3); + + return 0; +} + +TEST_MAIN(crc); diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/md2.c b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/md2.c new file mode 100644 index 0000000..589d989 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Junior_Drive/bertos/algo/md... [truncated message content] |
From: Jason C. <Ba...@us...> - 2011-06-08 20:52:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 21fa8c7c828a2ab7dbc159e3bc6543597f5a2ddd (commit) from f32c0b6cd08a7a7055286d9b17d148a4e0eee4f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 21fa8c7c828a2ab7dbc159e3bc6543597f5a2ddd Author: jchevrie <jas...@cr...> Date: Wed Jun 8 22:51:35 2011 +0200 Ajout du calcul de l'angle ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/controller_motor_stm32.mk b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/controller_motor_stm32.mk index 258c050..614a6e1 100644 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/controller_motor_stm32.mk +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/controller_motor_stm32.mk @@ -9,7 +9,7 @@ Firmware_DEBUG = 1 # Our target application TRG += controller_motor_stm32 -controller_motor_stm32_PREFIX = "/home/justin/opt/arm-i386/bin/arm-none-eabi-" +controller_motor_stm32_PREFIX = "/home/jason/opt/arm-i386/bin/arm-none-eabi-" controller_motor_stm32_SUFFIX = "" diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/main.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/main.c index 3c23c58..5f22f06 100644 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/main.c +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/main.c @@ -53,10 +53,10 @@ static void init(void) static void NORETURN ind_process(void) { while(1) { - LED1_ON(); - timer_delay(500); - LED1_OFF(); - timer_delay(500); + /*LED1_ON(); + timer_delay(250); + LED1_OFF();*/ + timer_delay(250); } } diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c index fe2d17b..9f36a29 100644 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.c @@ -71,7 +71,9 @@ void receptionInit() { //Init readValues for(i=0;i<NUM_SENSORS;i++) { - readValues[i]=0; + readValues[i][0]=0; + readValues[i][1]=0; + detectionState[i]=0; } return; } @@ -80,39 +82,112 @@ void NORETURN reception_process(void) { Timer timer_reception_process; int i; + float theta; + uint16_t control; + uint16_t opponentSensor; + uint16_t maxWeight; + + timer_setDelay(&timer_reception_process, us_to_ticks((utime_t)(reception_refresh))); timer_setEvent(&timer_reception_process); while(1) { + timer_add(&timer_reception_process);// Start process timer - readSensors(); - for(i=0;i<NUM_SENSORS;i++) { - if(readValues[0]==0) LED2_ON(); - else LED2_OFF(); - } + + uint16_t weight_tab[NUM_SENSORS]={0}; + + control=refreshDetection(); + + if (control >= NB_DETECT_MIN){ // process only when enough sensors are enlightened + + maxWeight = 0; + + for(i=0 ; i<NUM_SENSORS ; i++){ + + weight_tab[i] = calculate_weight(i); + + if (weight_tab[i] > maxWeight){ + + maxWeight = weight_tab[i]; + opponentSensor = i; + + } + } + + theta = 2*M_PI - (2*M_PI/32 + opponentSensor * 2*M_PI/16); + + } + + + if (control >= NB_DETECT_MIN) LED2_ON(); + else LED2_OFF(); + if (theta < M_PI/2) LED1_ON(); + else LED1_OFF(); + timer_waitEvent(&timer_reception_process); // Wait until the end of counting } } -void readSensors(void) { +void readSensors(int indice) { //Read all sensors - readValues[0]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(9)); //read PB9 - readValues[1]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(8)); //read PB8 - readValues[2]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(7)); //read PB7 - readValues[3]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(6)); //read PB6 - readValues[4]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOD_BASE), BV(2)); //read PD2 - readValues[5]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(12)); //read PC12 - readValues[6]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(11)); //read PC11 - readValues[7]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(10)); //read PC10 - readValues[8]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(9)); //read PC9 - readValues[9]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(8)); //read PC8 - readValues[10]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(7)); //read PC7 - readValues[11]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(6)); //read PC6 - readValues[12]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(15)); //read PB15 - readValues[13]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(14)); //read PB14 - readValues[14]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(13)); //read PB13 - readValues[15]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(12)); //read PB12 + readValues[0][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(9)); //read PB9 + readValues[1][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(8)); //read PB8 + readValues[2][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(7)); //read PB7 + readValues[3][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(6)); //read PB6 + readValues[4][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOD_BASE), BV(2)); //read PD2 + readValues[5][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(12)); //read PC12 + readValues[6][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(11)); //read PC11 + readValues[7][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(10)); //read PC10 + readValues[8][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(9)); //read PC9 + readValues[9][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(8)); //read PC8 + readValues[10][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(7)); //read PC7 + readValues[11][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOC_BASE), BV(6)); //read PC6 + readValues[12][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(15)); //read PB15 + readValues[13][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(14)); //read PB14 + readValues[14][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(13)); //read PB13 + readValues[15][indice]=stm32_gpioPinRead(((struct stm32_gpio *)GPIOB_BASE), BV(12)); //read PB12 return; } + +uint16_t refreshDetection(void){ + + int i; + uint8_t control_sum=0; + + readSensors(0); + timer_delay(1); + readSensors(1); + + for(i=0 ; i < NUM_SENSORS ; i++){ + + if (readValues[i][0]!=readValues[i][1]) detectionState[i] = 1; + else detectionState[i] = 0; + control_sum += detectionState[i]; + } + + + + return control_sum; +} + +uint16_t calculate_weight(uint16_t k){ + + int i; + uint16_t weight=0; + + for(i=0 ; i<NUM_SENSORS ; i++){ + + if((abs(k-i) < 5) & (i!=k)){ + + weight += detectionState[i]*pow(3,5-abs(k-i)); + + } + + } + + return weight; + +} diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.h index e37ca60..16bb082 100644 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.h +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/reception.h @@ -10,10 +10,11 @@ #define PWM_56k 1286 #define NUM_SENSORS 16 +#define NB_DETECT_MIN 5 +#define reception_refresh 10000 -#define reception_refresh 200 - -uint16_t readValues[NUM_SENSORS]; +uint16_t readValues[NUM_SENSORS][2]; +uint16_t detectionState[NUM_SENSORS]; void receptionInit(void); @@ -22,8 +23,11 @@ void enableClock(void); void disableClock(void); -void readSensors(void); +void readSensors(int); +uint16_t refreshDetection(void); +uint16_t calculate_weight(uint16_t); void NORETURN reception_process(void); + #endif hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-08 15:54:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via f32c0b6cd08a7a7055286d9b17d148a4e0eee4f8 (commit) from b9299bda41b472ccae373271bac0ca570cfece43 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f32c0b6cd08a7a7055286d9b17d148a4e0eee4f8 Author: justin <justin@MacBook.(none)> Date: Wed Jun 8 17:52:36 2011 +0200 Add firmware for balise IR sensor ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.project b/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.project new file mode 100644 index 0000000..8ce8f23 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.project @@ -0,0 +1,955 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Project Name="Firmware" InternalType=""> +<File Name="Makefile"/> +<VirtualDirectory Name="Firmware"> +<File Name="Firmware/main.c"/> +<File Name="Firmware/Firmware_user.mk"/> +<File Name="Firmware/Firmware.mk"/> +<VirtualDirectory Name="cfg"> +<File Name="Firmware/cfg/cfg_xmodem.h"/> +<File Name="Firmware/cfg/cfg_debug.h"/> +<File Name="Firmware/cfg/cfg_wdt.h"/> +<File Name="Firmware/cfg/cfg_i2s.h"/> +<File Name="Firmware/cfg/cfg_lcd_hd44.h"/> +<File Name="Firmware/cfg/cfg_usb.h"/> +<File Name="Firmware/cfg/cfg_context_switch.h"/> +<File Name="Firmware/cfg/cfg_randpool.h"/> +<File Name="Firmware/cfg/cfg_proc.h"/> +<File Name="Firmware/cfg/cfg_fat.h"/> +<File Name="Firmware/cfg/cfg_usbkbd.h"/> +<File Name="Firmware/cfg/cfg_adc.h"/> +<File Name="Firmware/cfg/cfg_stepper.h"/> +<File Name="Firmware/cfg/cfg_formatwr.h"/> +<File Name="Firmware/cfg/cfg_emb_flash.h"/> +<File Name="Firmware/cfg/cfg_md2.h"/> +<File Name="Firmware/cfg/cfg_lcd_32122a.h"/> +<File Name="Firmware/cfg/cfg_phase.h"/> +<File Name="Firmware/cfg/cfg_dataflash.h"/> +<File Name="Firmware/cfg/cfg_ax25.h"/> +<File Name="Firmware/cfg/cfg_i2c.h"/> +<File Name="Firmware/cfg/cfg_ser.h"/> +<File Name="Firmware/cfg/cfg_usbser.h"/> +<File Name="Firmware/cfg/cfg_sem.h"/> +<File Name="Firmware/cfg/cfg_ramp.h"/> +<File Name="Firmware/cfg/cfg_pocketbus.h"/> +<File Name="Firmware/cfg/cfg_parser.h"/> +<File Name="Firmware/cfg/cfg_hashtable.h"/> +<File Name="Firmware/cfg/cfg_ini_reader.h"/> +<File Name="Firmware/cfg/cfg_kbd.h"/> +<File Name="Firmware/cfg/cfg_kfile.h"/> +<File Name="Firmware/cfg/cfg_afsk.h"/> +<File Name="Firmware/cfg/cfg_monitor.h"/> +<File Name="Firmware/cfg/cfg_lm75.h"/> +<File Name="Firmware/cfg/cfg_timer.h"/> +<File Name="Firmware/cfg/cfg_dc_motor.h"/> +<File Name="Firmware/cfg/cfg_usbmouse.h"/> +<File Name="Firmware/cfg/cfg_flash25.h"/> +<File Name="Firmware/cfg/cfg_thermo.h"/> +<File Name="Firmware/cfg/cfg_spi_bitbang.h"/> +<File Name="Firmware/cfg/cfg_battfs.h"/> +<File Name="Firmware/cfg/cfg_keytag.h"/> +<File Name="Firmware/cfg/cfg_sd.h"/> +<File Name="Firmware/cfg/cfg_gfx.h"/> +<File Name="Firmware/cfg/cfg_heap.h"/> +<File Name="Firmware/cfg/cfg_tas5706a.h"/> +<File Name="Firmware/cfg/cfg_signal.h"/> +<File Name="Firmware/cfg/cfg_pwm.h"/> +<File Name="Firmware/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="Firmware/hw/mcp41_map.h"/> +<File Name="Firmware/hw/hw_phase.c"/> +<File Name="Firmware/hw/hw_kbd.h"/> +<File Name="Firmware/hw/hw_dc_motor.h"/> +<File Name="Firmware/hw/phase_map.h"/> +<File Name="Firmware/hw/thermo_map.h"/> +<File Name="Firmware/hw/hw_tlv5618.h"/> +<File Name="Firmware/hw/hw_lm75.h"/> +<File Name="Firmware/hw/hw_mcp41.h"/> +<File Name="Firmware/hw/hw_ntc.h"/> +<File Name="Firmware/hw/pwm_map.h"/> +<File Name="Firmware/hw/hw_dataflash.c"/> +<File Name="Firmware/hw/kbd_map.h"/> +<File Name="Firmware/hw/hw_tas5706a.h"/> +<File Name="Firmware/hw/hw_ili9225.h"/> +<File Name="Firmware/hw/hw_mcp41.c"/> +<File Name="Firmware/hw/hw_sipo.h"/> +<File Name="Firmware/hw/hw_lcd_32122a.h"/> +<File Name="Firmware/hw/hw_sd.h"/> +<File Name="Firmware/hw/hw_tmp123.h"/> +<File Name="Firmware/hw/hw_lcd_hd44.h"/> +<File Name="Firmware/hw/hw_i2c_bitbang.h"/> +<File Name="Firmware/hw/hw_ft245rl.h"/> +<File Name="Firmware/hw/hw_buzzer.h"/> +<File Name="Firmware/hw/ntc_map.h"/> +<File Name="Firmware/hw/hw_led.h"/> +<File Name="Firmware/hw/hw_spi.h"/> +<File Name="Firmware/hw/hw_stepper.h"/> +<File Name="Firmware/hw/hw_ser.h"/> +<File Name="Firmware/hw/hw_ntc.c"/> +<File Name="Firmware/hw/hw_rit128x96.h"/> +<File Name="Firmware/hw/hw_phase.h"/> +<File Name="Firmware/hw/hw_dataflash.h"/> +<File Name="Firmware/hw/hw_thermo.h"/> +<File Name="Firmware/hw/hw_afsk.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="bertos"> +<File Name="bertos/verstag.c"/> +<File Name="bertos/config.mk"/> +<File Name="bertos/verstag.h"/> +<File Name="bertos/rules.mk"/> +<VirtualDirectory Name="struct"> +<File Name="bertos/struct/fifobuf.h"/> +<File Name="bertos/struct/kfile_mem.h"/> +<File Name="bertos/struct/hashtable_test.c"/> +<File Name="bertos/struct/kfile_fifo.h"/> +<File Name="bertos/struct/heap.c"/> +<File Name="bertos/struct/kfile_fifo.c"/> +<File Name="bertos/struct/pool.h"/> +<File Name="bertos/struct/hashtable.c"/> +<File Name="bertos/struct/bitarray.h"/> +<File Name="bertos/struct/list.h"/> +<File Name="bertos/struct/hashtable.h"/> +<File Name="bertos/struct/bitarray_test.c"/> +<File Name="bertos/struct/heap_test.c"/> +<File Name="bertos/struct/heap.h"/> +<File Name="bertos/struct/kfile_mem.c"/> +<File Name="bertos/struct/kfile_fifo_test.c"/> +</VirtualDirectory> +<VirtualDirectory Name="algo"> +<File Name="bertos/algo/tea.c"/> +<File Name="bertos/algo/tea.h"/> +<File Name="bertos/algo/crc.h"/> +<File Name="bertos/algo/crc_ccitt.c"/> +<File Name="bertos/algo/mean.h"/> +<File Name="bertos/algo/rand.h"/> +<File Name="bertos/algo/ramp.h"/> +<File Name="bertos/algo/reverse_test.c"/> +<File Name="bertos/algo/ramp_test.c"/> +<File Name="bertos/algo/randpool.h"/> +<File Name="bertos/algo/crc_ccitt.h"/> +<File Name="bertos/algo/md2.c"/> +<File Name="bertos/algo/ramp.c"/> +<File Name="bertos/algo/randpool.c"/> +<File Name="bertos/algo/md2.h"/> +<File Name="bertos/algo/crc_test.c"/> +<File Name="bertos/algo/rotating_hash.h"/> +<File Name="bertos/algo/pid_control.h"/> +<File Name="bertos/algo/crc.c"/> +<File Name="bertos/algo/rand.c"/> +<File Name="bertos/algo/rle.h"/> +<File Name="bertos/algo/pid_control.c"/> +<File Name="bertos/algo/rle.c"/> +</VirtualDirectory> +<VirtualDirectory Name="icons"> +<File Name="bertos/icons/Makefile"/> +<File Name="bertos/icons/logo.c"/> +<File Name="bertos/icons/logo.h"/> +<File Name="bertos/icons/flipimage.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="benchmark"> +<File Name="bertos/benchmark/context_switch.c"/> +<File Name="bertos/benchmark/context_switch.h"/> +<File Name="bertos/benchmark/kernel_footprint.c"/> +<File Name="bertos/benchmark/kernel_footprint.h"/> +</VirtualDirectory> +<VirtualDirectory Name="gfx"> +<File Name="bertos/gfx/win.c"/> +<File Name="bertos/gfx/text_format.c"/> +<File Name="bertos/gfx/win.h"/> +<File Name="bertos/gfx/text.h"/> +<File Name="bertos/gfx/gfx_p.h"/> +<File Name="bertos/gfx/gfx.h"/> +<File Name="bertos/gfx/line.c"/> +<File Name="bertos/gfx/charts.c"/> +<File Name="bertos/gfx/fillpoly.cpp"/> +<File Name="bertos/gfx/text.c"/> +<File Name="bertos/gfx/font.h"/> +<File Name="bertos/gfx/bitmap.c"/> +<File Name="bertos/gfx/charts.h"/> +<File Name="bertos/gfx/font_10x20.c"/> +</VirtualDirectory> +<VirtualDirectory Name="cfg"> +<File Name="bertos/cfg/depend.h"/> +<File Name="bertos/cfg/cfg_xmodem.h"/> +<File Name="bertos/cfg/cfg_debug.h"/> +<File Name="bertos/cfg/cfg_wdt.h"/> +<File Name="bertos/cfg/cfg_eth.h"/> +<File Name="bertos/cfg/cfg_i2s.h"/> +<File Name="bertos/cfg/cfg_kern.h"/> +<File Name="bertos/cfg/cfg_lcd_hd44.h"/> +<File Name="bertos/cfg/kfile_debug.c"/> +<File Name="bertos/cfg/module.h"/> +<File Name="bertos/cfg/cfg_usb.h"/> +<File Name="bertos/cfg/cfg_context_switch.h"/> +<File Name="bertos/cfg/cfg_randpool.h"/> +<File Name="bertos/cfg/cfg_menu.h"/> +<File Name="bertos/cfg/cfg_proc.h"/> +<File Name="bertos/cfg/cfg_fat.h"/> +<File Name="bertos/cfg/cfg_usbkbd.h"/> +<File Name="bertos/cfg/cfg_pid.h"/> +<File Name="bertos/cfg/compiler.h"/> +<File Name="bertos/cfg/cfg_adc.h"/> +<File Name="bertos/cfg/cfg_stepper.h"/> +<File Name="bertos/cfg/cfg_formatwr.h"/> +<File Name="bertos/cfg/cfg_boot.h"/> +<File Name="bertos/cfg/cfg_arch.h"/> +<File Name="bertos/cfg/debug.h"/> +<File Name="bertos/cfg/cfg_emb_flash.h"/> +<File Name="bertos/cfg/cfg_md2.h"/> +<File Name="bertos/cfg/log.h"/> +<File Name="bertos/cfg/cfg_lcd_32122a.h"/> +<File Name="bertos/cfg/cfg_phase.h"/> +<File Name="bertos/cfg/cfg_dataflash.h"/> +<File Name="bertos/cfg/cfg_ax25.h"/> +<File Name="bertos/cfg/cfg_i2c.h"/> +<File Name="bertos/cfg/cfg_ser.h"/> +<File Name="bertos/cfg/cfg_usbser.h"/> +<File Name="bertos/cfg/cfg_eeprom.h"/> +<File Name="bertos/cfg/cfg_sem.h"/> +<File Name="bertos/cfg/cfg_attr.h"/> +<File Name="bertos/cfg/cfg_ramp.h"/> +<File Name="bertos/cfg/cfg_pocketbus.h"/> +<File Name="bertos/cfg/cfg_parser.h"/> +<File Name="bertos/cfg/cfg_spi_dma.h"/> +<File Name="bertos/cfg/cfg_hashtable.h"/> +<File Name="bertos/cfg/cfg_ini_reader.h"/> +<File Name="bertos/cfg/cfg_kbd.h"/> +<File Name="bertos/cfg/cfg_ntc.h"/> +<File Name="bertos/cfg/cfg_kfile.h"/> +<File Name="bertos/cfg/kfile_debug.h"/> +<File Name="bertos/cfg/cfg_lwip.h"/> +<File Name="bertos/cfg/cfg_afsk.h"/> +<File Name="bertos/cfg/cfg_monitor.h"/> +<File Name="bertos/cfg/cfg_lm75.h"/> +<File Name="bertos/cfg/cfg_timer.h"/> +<File Name="bertos/cfg/cfg_dc_motor.h"/> +<File Name="bertos/cfg/cfg_usbmouse.h"/> +<File Name="bertos/cfg/cfg_flash25.h"/> +<File Name="bertos/cfg/cfg_buzzerled.h"/> +<File Name="bertos/cfg/cfg_thermo.h"/> +<File Name="bertos/cfg/test.h"/> +<File Name="bertos/cfg/cfg_spi_bitbang.h"/> +<File Name="bertos/cfg/cfg_battfs.h"/> +<File Name="bertos/cfg/cfg_keytag.h"/> +<File Name="bertos/cfg/cfg_sd.h"/> +<File Name="bertos/cfg/cfg_gfx.h"/> +<File Name="bertos/cfg/os.h"/> +<File Name="bertos/cfg/cfg_heap.h"/> +<File Name="bertos/cfg/macros.h"/> +<File Name="bertos/cfg/cfg_tas5706a.h"/> +<File Name="bertos/cfg/cfg_signal.h"/> +<File Name="bertos/cfg/cfg_pwm.h"/> +<File Name="bertos/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fs"> +<File Name="bertos/fs/battfs.h"/> +<File Name="bertos/fs/fat.c"/> +<File Name="bertos/fs/battfs_test.c"/> +<File Name="bertos/fs/fat_test.c"/> +<File Name="bertos/fs/battfs.c"/> +<File Name="bertos/fs/fat.h"/> +<VirtualDirectory Name="fatfs"> +<File Name="bertos/fs/fatfs/ff.h"/> +<File Name="bertos/fs/fatfs/integer.h"/> +<File Name="bertos/fs/fatfs/diskio.h"/> +<File Name="bertos/fs/fatfs/ff.c"/> +<File Name="bertos/fs/fatfs/diskio.c"/> +<VirtualDirectory Name="option"> +<File Name="bertos/fs/fatfs/option/cc950.c"/> +<File Name="bertos/fs/fatfs/option/cc949.c"/> +<File Name="bertos/fs/fatfs/option/cc936.c"/> +<File Name="bertos/fs/fatfs/option/ccsbcs.c"/> +<File Name="bertos/fs/fatfs/option/syncobj.c"/> +<File Name="bertos/fs/fatfs/option/cc932.c"/> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/drv/lcd_32122a.c"/> +<File Name="bertos/drv/lcd_text.c"/> +<File Name="bertos/drv/lcd_hd44.c"/> +<File Name="bertos/drv/lcd_hd44.h"/> +<File Name="bertos/drv/spi_bitbang.h"/> +<File Name="bertos/drv/phase.c"/> +<File Name="bertos/drv/usbmouse.c"/> +<File Name="bertos/drv/tas5706a.c"/> +<File Name="bertos/drv/thermo.h"/> +<File Name="bertos/drv/ser.c"/> +<File Name="bertos/drv/ft245rl.c"/> +<File Name="bertos/drv/usb.h"/> +<File Name="bertos/drv/sd.h"/> +<File Name="bertos/drv/pwm.h"/> +<File Name="bertos/drv/tc520.h"/> +<File Name="bertos/drv/ser.h"/> +<File Name="bertos/drv/phase.h"/> +<File Name="bertos/drv/sipo.c"/> +<File Name="bertos/drv/kbd.c"/> +<File Name="bertos/drv/sd.c"/> +<File Name="bertos/drv/pcf8574.c"/> +<File Name="bertos/drv/mcp41.c"/> +<File Name="bertos/drv/kdebug.c"/> +<File Name="bertos/drv/lcd_ili9225.h"/> +<File Name="bertos/drv/lcd_32122a.h"/> +<File Name="bertos/drv/usbkbd.c"/> +<File Name="bertos/drv/lcd_text.h"/> +<File Name="bertos/drv/dataflash.h"/> +<File Name="bertos/drv/ntc.c"/> +<File Name="bertos/drv/flash25_hwtest.c"/> +<File Name="bertos/drv/adc.c"/> +<File Name="bertos/drv/sipo.h"/> +<File Name="bertos/drv/lm75.c"/> +<File Name="bertos/drv/pcf8574.h"/> +<File Name="bertos/drv/timer_test.c"/> +<File Name="bertos/drv/usbkbd.h"/> +<File Name="bertos/drv/wdt.h"/> +<File Name="bertos/drv/tlv5618.c"/> +<File Name="bertos/drv/dataflash.c"/> +<File Name="bertos/drv/stepper.h"/> +<File Name="bertos/drv/usbmouse.h"/> +<File Name="bertos/drv/lcd_ili9225.c"/> +<File Name="bertos/drv/lcd_rit128x96.h"/> +<File Name="bertos/drv/usb_hid.h"/> +<File Name="bertos/drv/thermo.c"/> +<File Name="bertos/drv/i2c.c"/> +<File Name="bertos/drv/tas5706a.h"/> +<File Name="bertos/drv/timer.h"/> +<File Name="bertos/drv/lcd_text_hwtest.c"/> +<File Name="bertos/drv/dataflash_hwtest.c"/> +<File Name="bertos/drv/dc_motor_hwtest.c"/> +<File Name="bertos/drv/ser_p.h"/> +<File Name="bertos/drv/ft245rl.h"/> +<File Name="bertos/drv/i2c_bitbang.c"/> +<File Name="bertos/drv/tlv5618.h"/> +<File Name="bertos/drv/mcp41.h"/> +<File Name="bertos/drv/tmp123.h"/> +<File Name="bertos/drv/tmp123.c"/> +<File Name="bertos/drv/i2c.h"/> +<File Name="bertos/drv/dc_motor.h"/> +<File Name="bertos/drv/lcd_lm44_qt.cpp"/> +<File Name="bertos/drv/lcd_lm44_qt.h"/> +<File Name="bertos/drv/buzzer.h"/> +<File Name="bertos/drv/stepper.c"/> +<File Name="bertos/drv/buzzerled.h"/> +<File Name="bertos/drv/ntc.h"/> +<File Name="bertos/drv/eeprom.h"/> +<File Name="bertos/drv/mpxx6115a.h"/> +<File Name="bertos/drv/dc_motor.c"/> +<File Name="bertos/drv/lcd_gfx_qt.h"/> +<File Name="bertos/drv/pwm.c"/> +<File Name="bertos/drv/usb_endpoint.h"/> +<File Name="bertos/drv/flash25.h"/> +<File Name="bertos/drv/lcd_rit128x96.c"/> +<File Name="bertos/drv/pwm_hwtest.c"/> +<File Name="bertos/drv/flash.h"/> +<File Name="bertos/drv/eeprom.c"/> +<File Name="bertos/drv/adc.h"/> +<File Name="bertos/drv/buzzerled.c"/> +<File Name="bertos/drv/lcd_gfx_hwtest.c"/> +<File Name="bertos/drv/flash25.c"/> +<File Name="bertos/drv/lm75.h"/> +<File Name="bertos/drv/lcd_gfx_qt.cpp"/> +<File Name="bertos/drv/buzzer.c"/> +<File Name="bertos/drv/kbd.h"/> +<File Name="bertos/drv/usbser.c"/> +<File Name="bertos/drv/usbser.h"/> +<File Name="bertos/drv/timer.c"/> +<File Name="bertos/drv/spi_bitbang.c"/> +<File Name="bertos/drv/tc520.c"/> +<File Name="bertos/drv/lcd_hd44_hwtest.c"/> +</VirtualDirectory> +<VirtualDirectory Name="gui"> +<File Name="bertos/gui/menubar.h"/> +<File Name="bertos/gui/menu.h"/> +<File Name="bertos/gui/levelbar.h"/> +<File Name="bertos/gui/levelbar.c"/> +<File Name="bertos/gui/menu.c"/> +<File Name="bertos/gui/menubar.c"/> +<File Name="bertos/gui/leveledit.h"/> +<File Name="bertos/gui/leveledit.c"/> +</VirtualDirectory> +<VirtualDirectory Name="kern"> +<File Name="bertos/kern/proc_p.h"/> +<File Name="bertos/kern/coop.c"/> +<File Name="bertos/kern/preempt.c"/> +<File Name="bertos/kern/signal.h"/> +<File Name="bertos/kern/sem.c"/> +<File Name="bertos/kern/proc_test.c"/> +<File Name="bertos/kern/sem_test.c"/> +<File Name="bertos/kern/proc.c"/> +<File Name="bertos/kern/kfile.h"/> +<File Name="bertos/kern/signal_test.c"/> +<File Name="bertos/kern/irq.c"/> +<File Name="bertos/kern/sem.h"/> +<File Name="bertos/kern/msg.h"/> +<File Name="bertos/kern/monitor.h"/> +<File Name="bertos/kern/msg_test.c"/> +<File Name="bertos/kern/proc.h"/> +<File Name="bertos/kern/signal.c"/> +<File Name="bertos/kern/irq.h"/> +<File Name="bertos/kern/monitor.c"/> +<VirtualDirectory Name="proc_test"> +<File Name="bertos/kern/proc_test/preempt_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_signal_test.c"/> +<File Name="bertos/kern/proc_test/coop_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_signal_test.c"/> +<File Name="bertos/kern/proc_test/preempt_test.c"/> +<File Name="bertos/kern/proc_test/preempt_heap_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_test.c"/> +<File Name="bertos/kern/proc_test/preempt_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_heap_test.c"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="emul"> +<File Name="bertos/emul/switch_ppc.S"/> +<File Name="bertos/emul/emul.h"/> +<File Name="bertos/emul/timer_qt.h"/> +<File Name="bertos/emul/switch.S"/> +<File Name="bertos/emul/emul.cpp"/> +<File Name="bertos/emul/switch_i386.S"/> +<File Name="bertos/emul/kfile_posix.c"/> +<File Name="bertos/emul/timer_posix.c"/> +<File Name="bertos/emul/timer_posix.h"/> +<File Name="bertos/emul/emul.mk"/> +<File Name="bertos/emul/emulwin.h"/> +<File Name="bertos/emul/timer_qt.c"/> +<File Name="bertos/emul/ser_posix.c"/> +<File Name="bertos/emul/switch_ctx_emul.S"/> +<File Name="bertos/emul/kfile_posix.h"/> +<File Name="bertos/emul/emulkbd.h"/> +<File Name="bertos/emul/emulkbd.cpp"/> +<File Name="bertos/emul/diskio_emul.c"/> +<File Name="bertos/emul/emulwin.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/hw/mcp41_map.h"/> +<File Name="bertos/hw/hw_input.h"/> +<File Name="bertos/hw/hw_phase.c"/> +<File Name="bertos/hw/hw_kbd.h"/> +<File Name="bertos/hw/hw_dc_motor.h"/> +<File Name="bertos/hw/phase_map.h"/> +<File Name="bertos/hw/thermo_map.h"/> +<File Name="bertos/hw/hw_tlv5618.h"/> +<File Name="bertos/hw/hw_lm75.h"/> +<File Name="bertos/hw/hw_mcp41.h"/> +<File Name="bertos/hw/hw_timer.h"/> +<File Name="bertos/hw/hw_boot.h"/> +<File Name="bertos/hw/hw_ntc.h"/> +<File Name="bertos/hw/hw_spi_dma.h"/> +<File Name="bertos/hw/pwm_map.h"/> +<File Name="bertos/hw/hw_dataflash.c"/> +<File Name="bertos/hw/kbd_map.h"/> +<File Name="bertos/hw/hw_tas5706a.h"/> +<File Name="bertos/hw/hw_ili9225.h"/> +<File Name="bertos/hw/hw_lcd.h"/> +<File Name="bertos/hw/hw_cpufreq.h"/> +<File Name="bertos/hw/hw_mcp41.c"/> +<File Name="bertos/hw/hw_sipo.h"/> +<File Name="bertos/hw/hw_tc520.h"/> +<File Name="bertos/hw/hw_lcd_32122a.h"/> +<File Name="bertos/hw/hw_sd.h"/> +<File Name="bertos/hw/hw_tmp123.h"/> +<File Name="bertos/hw/hw_lcd_hd44.h"/> +<File Name="bertos/hw/hw_i2c_bitbang.h"/> +<File Name="bertos/hw/hw_ft245rl.h"/> +<File Name="bertos/hw/hw_buzzer.h"/> +<File Name="bertos/hw/ntc_map.h"/> +<File Name="bertos/hw/hw_led.h"/> +<File Name="bertos/hw/hw_spi.h"/> +<File Name="bertos/hw/hw_stepper.h"/> +<File Name="bertos/hw/hw_blanker.h"/> +<File Name="bertos/hw/hw_buzzerled.h"/> +<File Name="bertos/hw/hw_ser.h"/> +<File Name="bertos/hw/hw_sensor.h"/> +<File Name="bertos/hw/hw_ntc.c"/> +<File Name="bertos/hw/hw_rit128x96.h"/> +<File Name="bertos/hw/hw_phase.h"/> +<File Name="bertos/hw/hw_dataflash.h"/> +<File Name="bertos/hw/hw_thermo.h"/> +<File Name="bertos/hw/hw_afsk.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fonts"> +<File Name="bertos/fonts/ncenB18.c"/> +<File Name="bertos/fonts/fixed6x8.c"/> +<File Name="bertos/fonts/helvB10.c"/> +<File Name="bertos/fonts/luBS14.c"/> +<File Name="bertos/fonts/gohu.c"/> +<File Name="bertos/fonts/fonts.mk"/> +</VirtualDirectory> +<VirtualDirectory Name="cpu"> +<File Name="bertos/cpu/power.h"/> +<File Name="bertos/cpu/detect.h"/> +<File Name="bertos/cpu/types.h"/> +<File Name="bertos/cpu/attr.h"/> +<File Name="bertos/cpu/byteorder.h"/> +<File Name="bertos/cpu/frame.h"/> +<File Name="bertos/cpu/irq.h"/> +<File Name="bertos/cpu/pgm.h"/> +<VirtualDirectory Name="avr"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/avr/drv/stepper_avr.h"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.h"/> +<File Name="bertos/cpu/avr/drv/wdt_avr.h"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.c"/> +<File Name="bertos/cpu/avr/drv/adc_avr.h"/> +<File Name="bertos/cpu/avr/drv/adc_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.h"/> +<File Name="bertos/cpu/avr/drv/kdebug_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/stepper_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.c"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.c"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.h"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/avr/hw/switch_ctx_avr.S"/> +<File Name="bertos/cpu/avr/hw/switch_avr.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="arm"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/lpc2378.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/arm/drv/sysirq_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_arm.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2c_arm.h"/> +<File Name="bertos/cpu/arm/drv/flash_arm.h"/> +<File Name="bertos/cpu/arm/drv/adc_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/twi_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.c"/> +<File Name="bertos/cpu/arm/drv/sysirq_at91.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_arm.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.h"/> +<File Name="bertos/cpu/arm/drv/i2c_at91.h"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/adc_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91_hwtest.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/adc_at91.h"/> +<File Name="bertos/cpu/arm/drv/wdt_arm.h"/> +<File Name="bertos/cpu/arm/drv/ser_at91.c"/> +<File Name="bertos/cpu/arm/drv/adc_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_at91.c"/> +<File Name="bertos/cpu/arm/drv/twi_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.h"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_at91.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.h"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.c"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.c"/> +<File Name="bertos/cpu/arm/drv/ser_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_arm.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.c"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/arm/hw/vectors_at91.S"/> +<File Name="bertos/cpu/arm/hw/init_at91.c"/> +<File Name="bertos/cpu/arm/hw/switch_ctx_arm.S"/> +<File Name="bertos/cpu/arm/hw/switch_arm.S"/> +<File Name="bertos/cpu/arm/hw/crtat91sam7_rom.S"/> +<File Name="bertos/cpu/arm/hw/vectors_lpc2.S"/> +<File Name="bertos/cpu/arm/hw/pll_at91.h"/> +<File Name="bertos/cpu/arm/hw/init_lpc2.c"/> +<File Name="bertos/cpu/arm/hw/crt_arm7tdmi.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/arm/io/at91_pwm.h"/> +<File Name="bertos/cpu/arm/io/at91.h"/> +<File Name="bertos/cpu/arm/io/at91_aic.h"/> +<File Name="bertos/cpu/arm/io/at91_twi.h"/> +<File Name="bertos/cpu/arm/io/lpc23xx.h"/> +<File Name="bertos/cpu/arm/io/at91_ssc.h"/> +<File Name="bertos/cpu/arm/io/at91_spi.h"/> +<File Name="bertos/cpu/arm/io/at91_emac.h"/> +<File Name="bertos/cpu/arm/io/at91_dbgu.h"/> +<File Name="bertos/cpu/arm/io/at91_wdt.h"/> +<File Name="bertos/cpu/arm/io/at91_mc.h"/> +<File Name="bertos/cpu/arm/io/at91_adc.h"/> +<File Name="bertos/cpu/arm/io/at91_pio.h"/> +<File Name="bertos/cpu/arm/io/at91_pit.h"/> +<File Name="bertos/cpu/arm/io/at91_pmc.h"/> +<File Name="bertos/cpu/arm/io/at91_tc.h"/> +<File Name="bertos/cpu/arm/io/at91_us.h"/> +<File Name="bertos/cpu/arm/io/arm.h"/> +<File Name="bertos/cpu/arm/io/at91_rstc.h"/> +<File Name="bertos/cpu/arm/io/at91sam7.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="dsp56k"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/dsp56k/drv/kdebug_dsp56k.c"/> +<File Name="bertos/cpu/dsp56k/drv/timer_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/buzzerled_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/dsp56k/hw/switch_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="x86"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="cortex-m3"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/stm32f103rb_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/cortex-m3/hw/crt_cm3.S"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/init_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/vectors_cm3.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/cortex-m3/io/lm3s_pwm.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_wdt.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3.h"/> +<File Name="bertos/cpu/cortex-m3/io/cm3.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_memmap.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3n.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_types.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ssi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_usart.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pio.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_spi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_com.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pmc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_memmap.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="ppc"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="i196"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/i196/drv/timer_i196.h"/> +<File Name="bertos/cpu/i196/drv/ser_i196.c"/> +<File Name="bertos/cpu/i196/drv/kdebug_i196.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="mware"> +<File Name="bertos/mware/readline.h"/> +<File Name="bertos/mware/parser.h"/> +<File Name="bertos/mware/blanker.h"/> +<File Name="bertos/mware/strtol10.h"/> +<File Name="bertos/mware/observer.h"/> +<File Name="bertos/mware/cmd_hunk.h"/> +<File Name="bertos/mware/strtol10.c"/> +<File Name="bertos/mware/sprintf.c"/> +<File Name="bertos/mware/formatwr.h"/> +<File Name="bertos/mware/event.h"/> +<File Name="bertos/mware/event.c"/> +<File Name="bertos/mware/resource.h"/> +<File Name="bertos/mware/parser.c"/> +<File Name="bertos/mware/formatwr.c"/> +<File Name="bertos/mware/observer.c"/> +<File Name="bertos/mware/readline.c"/> +<File Name="bertos/mware/hex.h"/> +<File Name="bertos/mware/resource.c"/> +<File Name="bertos/mware/sprintf_test.c"/> +<File Name="bertos/mware/hex.c"/> +<File Name="bertos/mware/ini_reader_test.c"/> +<File Name="bertos/mware/messages.c"/> +<File Name="bertos/mware/rle.h"/> +<File Name="bertos/mware/ini_reader.h"/> +<File Name="bertos/mware/ini_reader.c"/> +<File Name="bertos/mware/messages.h"/> +<File Name="bertos/mware/blanker.c"/> +<File Name="bertos/mware/byteorder.h"/> +<File Name="bertos/mware/except.h"/> +<File Name="bertos/mware/pgm.h"/> +</VirtualDirectory> +<VirtualDirectory Name="os"> +<File Name="bertos/os/hptime.h"/> +<File Name="bertos/os/hptime.c"/> +</VirtualDirectory> +<VirtualDirectory Name="net"> +<File Name="bertos/net/keytag.h"/> +<File Name="bertos/net/nmea.c"/> +<File Name="bertos/net/xmodem.h"/> +<File Name="bertos/net/pocketcmd.h"/> +<File Name="bertos/net/pocketbus.c"/> +<File Name="bertos/net/ax25_test.c"/> +<File Name="bertos/net/nmea.h"/> +<File Name="bertos/net/afsk_test.c"/> +<File Name="bertos/net/pocketbus.h"/> +<File Name="bertos/net/ax25.c"/> +<File Name="bertos/net/pocketcmd.c"/> +<File Name="bertos/net/nmea_test.c"/> +<File Name="bertos/net/afsk.h"/> +<File Name="bertos/net/afsk.c"/> +<File Name="bertos/net/ax25.h"/> +<File Name="bertos/net/keytag.c"/> +<File Name="bertos/net/xmodem.c"/> +<VirtualDirectory Name="nmeap"> +<File Name="bertos/net/nmeap/Makefile"/> +<VirtualDirectory Name="tst"> +<File Name="bertos/net/nmeap/tst/wingps.c"/> +<File Name="bertos/net/nmeap/tst/test1.c"/> +<File Name="bertos/net/nmeap/tst/Makefile"/> +<File Name="bertos/net/nmeap/tst/test3.c"/> +<File Name="bertos/net/nmeap/tst/test2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="inc"> +<File Name="bertos/net/nmeap/inc/nmeap_def.h"/> +<File Name="bertos/net/nmeap/inc/nmeap.h"/> +</VirtualDirectory> +<VirtualDirectory Name="src"> +<File Name="bertos/net/nmeap/src/nmeap01.c"/> +<File Name="bertos/net/nmeap/src/Makefile"/> +</VirtualDirectory> +<VirtualDirectory Name="lib"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/io/kblock_ram.h"/> +<File Name="bertos/io/kblock_posix.h"/> +<File Name="bertos/io/kblock_posix.c"/> +<File Name="bertos/io/kfile_test.c"/> +<File Name="bertos/io/kblock.h"/> +<File Name="bertos/io/kfile.h"/> +<File Name="bertos/io/kfile_block.h"/> +<File Name="bertos/io/kfile_block.c"/> +<File Name="bertos/io/kblock_ram.c"/> +<File Name="bertos/io/kfile.c"/> +<File Name="bertos/io/kblock.c"/> +</VirtualDirectory> +<VirtualDirectory Name="dt"> +<File Name="bertos/dt/dnotifier.h"/> +<File Name="bertos/dt/dwidget.h"/> +<File Name="bertos/dt/editint.c"/> +<File Name="bertos/dt/editint.h"/> +<File Name="bertos/dt/dwidget.c"/> +<File Name="bertos/dt/dnotifier.c"/> +<File Name="bertos/dt/dtag.h"/> +<File Name="bertos/dt/editbool.h"/> +<File Name="bertos/dt/editbool.c"/> +</VirtualDirectory> +</VirtualDirectory> + <Description></Description> + <Dependencies/> + <Settings Type="Dynamic Library"> + <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Debug" Command="./images/Firmware.elf" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options="-g"> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options=""/> + <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="3333" DebuggerPath="/usr/bin/i686-linux-gnu-gdb-4.5"> + <PostConnectCommands> +source bertos/prg_scripts/arm/openocd/gdbinit-sam7 + </PostConnectCommands> + <StartupCommands> +shell sleep 2 + </StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options=""> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options="-O2"/> + <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath=""> + <PostConnectCommands></PostConnectCommands> + <StartupCommands></StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + </Settings> +</CodeLite_Project> diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.workspace b/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.workspace new file mode 100644 index 0000000..3a8d0fa --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/Firmware.workspace @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Workspace Name="Firmware" Database="./bertos.tags"> + <Project Name="Firmware" Path="Firmware.project" Active="Yes"/> + <BuildMatrix> + <WorkspaceConfiguration Name="Debug" Selected="yes"> + <Project Name="Firmware" ConfigName="Debug"/> + </WorkspaceConfiguration> + <WorkspaceConfiguration Name="Release" Selected="yes"> + <Project Name="Firmware" ConfigName="Release"/> + </WorkspaceConfiguration> + </BuildMatrix> +</CodeLite_Workspace> diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/Makefile b/elec/boards/Balise_IR/Carte_diodes/Firmware/Makefile new file mode 100644 index 0000000..cb8af58 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni <du...@de...> +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include controller_motor_stm32/controller_motor_stm32.mk + +include bertos/rules.mk diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/VERSION b/elec/boards/Balise_IR/Carte_diodes/Firmware/VERSION new file mode 100644 index 0000000..ab7cff5 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/VERSION @@ -0,0 +1 @@ +BeRTOS 2.6.1 [local copy] diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.c new file mode 100644 index 0000000..d4293f9 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.c @@ -0,0 +1,102 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC table and support routines + * + * \author Bernie Innocenti <be...@co...> + */ + +#include "crc.h" + +/* + * The boot on AVR cpu is placed at the end of flash memory, but the avr + * address memory by byte and the pointers are 16bits long, so we are able + * to address 64Kbyte memory max. For this reason we can't read the crctab + * from flash, because it is placed at the end of memory. This is true every + * time we have an AVR cpu with more that 64Kbyte of flash. To fix this problem + * we let the compiler copy the table in RAM at startup. Obviously this solution + * is not efficent, but for now this is the only way. + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define CRC_TABLE const uint16_t PROGMEM crc16tab[256] +#else + #define CRC_TABLE const uint16_t crc16tab[256] +#endif + +/** + * crctab calculated by Mark G. Mendel, Network Systems Corporation + */ +CRC_TABLE = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + +uint16_t crc16(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while(len--) + crc = UPDCRC16(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.h new file mode 100644 index 0000000..c5c1eef --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief Cyclic Redundancy Check 16 (CRC). This algorithm is the one used by the XMODEM protocol. + * + * \note This algorithm is incompatible with the CCITT-CRC16. + * + * This code is based on the article Copyright 1986 Stephen Satchell. + * + * Programmers may incorporate any or all code into their programs, + * giving proper credit within the source. Publication of the + * source routines is permitted so long as proper credit is given + * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, + * Omen Technology. + * + * \author Bernie Innocenti <be...@co...> + * + * $WIZ$ module_name = "crc16" + */ + +#ifndef ALGO_CRC_H +#define ALGO_CRC_H + +#include "cfg/cfg_arch.h" + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc16tab[256]; + + +/** + * \brief Compute the updated CRC16 value for one octet (macro version) + * + * \note This version is only intended for old/broken compilers. + * Use the inline function in new code. + * + * \param c New octet (range 0-255) + * \param oldcrc Previous CRC16 value (referenced twice, beware of side effects) + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define UPDCRC16(c, oldcrc) (pgm_read_uint16_t(&crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#else + #define UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#endif + +/** CRC-16 init value */ +#define CRC16_INIT_VAL ((uint16_t)0) + +#ifdef INLINE +/** + * \brief Compute the updated CRC16 value for one octet (inline version) + */ +INLINE uint16_t updcrc16(uint8_t c, uint16_t oldcrc) +{ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + return pgm_read_uint16_t(&crc16tab[(oldcrc >> 8) ^ c]) ^ (oldcrc << 8); +#else + return crc16tab[(oldcrc >> 8) ^ c] ^ (oldcrc << 8); +#endif +} +#endif // INLINE + + +/** + * This function implements the CRC 16 calculation on a buffer. + * + * \param crc Current CRC16 value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC16 value. + */ +extern uint16_t crc16(uint16_t crc, const void *buf, size_t len); + +int crc_testSetup(void); +int crc_testRun(void); +int crc_testTearDown(void); + +EXTERN_C_END + +#endif /* ALGO_CRC_H */ diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.c new file mode 100644 index 0000000..feaf624 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.c @@ -0,0 +1,83 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" + +const uint16_t PROGMEM crc_ccitt_tab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, +}; + +uint16_t crc_ccitt(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while (len--) + crc = updcrc_ccitt(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.h b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.h new file mode 100644 index 0000000..240e6e1 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_ccitt.h @@ -0,0 +1,78 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CCITT Cyclic Redundancy Check (CRC-CCITT). + * + * \note This algorithm is incompatible with the CRC16. + * + * \author Francesco Sacchi <ba...@de...> + * + * $WIZ$ module_name = "crc-ccitt" + */ + +#ifndef ALGO_CRC_CCITT_H +#define ALGO_CRC_CCITT_H + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc_ccitt_tab[256]; + +/** + * \brief Compute the updated CRC-CCITT value for one octet (inline version) + */ +INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) +{ + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); +} + +/** CRC-CCITT init value */ +#define CRC_CCITT_INIT_VAL ((uint16_t)0xFFFF) + + +/** + * This function implements the CRC-CCITT calculation on a buffer. + * + * \param crc Current CRC-CCITT value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC-CCITT value. + */ +extern uint16_t crc_ccitt(uint16_t crc, const void *buf, size_t len); + +EXTERN_C_END + +#endif /* ALGO_CRC_CCITT_H */ diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_test.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_test.c new file mode 100644 index 0000000..1a93e3b --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/crc_test.c @@ -0,0 +1,75 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" +#include "crc.h" + +#include <cfg/debug.h> +#include <cfg/test.h> + + +int crc_testSetup(void) +{ + kdbg_init(); + return 0; +} + +int crc_testTearDown(void) +{ + return 0; +} + +int crc_testRun(void) +{ + char vector[9] = "123456789"; + + uint16_t crc = CRC_CCITT_INIT_VAL; + + crc = crc_ccitt(crc, vector, sizeof(vector)); + kprintf("crc_ccitt [%04X]\n", crc); + ASSERT(crc == 0x6F91); + + crc = CRC16_INIT_VAL; + crc = crc16(crc, vector, sizeof(vector)); + kprintf("crc16 [%04X]\n", crc); + ASSERT(crc == 0x31C3); + + return 0; +} + +TEST_MAIN(crc); diff --git a/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/md2.c b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/md2.c new file mode 100644 index 0000000..589d989 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_diodes/Firmware/bertos/algo/md2.c @@ -0,0 +1,336 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY... [truncated message content] |
From: Justin <Ba...@us...> - 2011-06-08 14:43:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via b9299bda41b472ccae373271bac0ca570cfece43 (commit) from e2f20d045bee49b75db46177cf3c28103bfee276 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b9299bda41b472ccae373271bac0ca570cfece43 Author: justin <justin@MacBook.(none)> Date: Wed Jun 8 16:34:23 2011 +0200 Delete some files ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.c deleted file mode 100644 index f760aea..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.c +++ /dev/null @@ -1,765 +0,0 @@ -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" -#include "odometry.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - - - - - - -unsigned short def_encoders[4]={ENCODER1, ENCODER2, ENCODER3, ENCODER4}; -float Kp[NUM_MOTORS]={KP1,KP2,KP3,KP4}; - -PROC_DEFINE_STACK(stack_control, KERN_MINSTACKSIZE * 4); - - -void controlInit(void) { - int i; - - - for(i=0;i<NUM_ENCODERS;i++) - { - encoders_status[i].globalCounter=0; - encoders_status[i].direction=0; - encoders_status[i].speed=0; - encoders_status[i].rampePosition=0; - encoders_status[i].desiredPosition=0; - encoders_status[i].startPosition=0; - encoders_status[i].previousCounter=getEncoderCount(1<<i); - encoders_status[i].busy=0; - } - /* Create a new child process */ - - proc_new(control_process, NULL, sizeof(stack_control), stack_control); - - - return; -} - -void NORETURN control_process(void) -{ - Timer timer_control_process; - int64_t desiredImpulsions[NUM_MOTORS]; - int i; - float desiredPositions[NUM_MOTORS]={0,2*M_PI,2*M_PI,2*M_PI}; - timer_setDelay(&timer_control_process, us_to_ticks((utime_t)(control_refresh))); - timer_setEvent(&timer_control_process); - - enableMotors( MOTEUR4|MOTEUR2|MOTEUR3); - //convertRadInImpulsions(desiredPositions, desiredImpulsions); - - - while(1) { - - timer_add(&timer_control_process);// Start process timer - /*for(i=0;i<NUM_MOTORS;i++) - { - desiredPositions[i]+=0.05; - if (desiredPositions[i]>(2*M_PI)) desiredPositions[i]=2*M_PI; - } - convertRadInImpulsions(desiredPositions, desiredImpulsions);*/ - //generateRampeMotor(MOTEUR4|MOTEUR2|MOTEUR3,-20*2*M_PI,10,5); - generateRampeRobotPlan(); - controlMotors(MOTEUR4|MOTEUR2|MOTEUR3); - - timer_waitEvent(&timer_control_process); // Wait until the end of counting - } - - -} - -void refreshEncoderStatus(unsigned short encoder) { - int i; - int64_t difference; - int32_t currentCounter; - for(i=0;i<NUM_ENCODERS;i++) { - if(encoder & (1<<i)) { - /* Def direction*/ - encoders_status[i].direction = getEncoderDirection(def_encoders[i]); - /* Calcul du compteur global*/ - currentCounter =(int32_t)(getEncoderCount(def_encoders[i])); - difference = (int64_t)(currentCounter-encoders_status[i].previousCounter); - - if( encoders_status[i].direction == FORWARD_DIRECTION) - { - if(difference < 0) - { - difference += 65535; - } - } - else if(difference > 0) difference -= 65535; - encoders_status[i].globalCounter += difference; - encoders_status[i].previousCounter = currentCounter; - /* Speed Calcul*/ - } - } - return; -} - - - -void controlMotors(unsigned short motor) { - - int64_t error; - int32_t PWM; - int i; - - //refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - for(i=0;i<NUM_MOTORS;i++) - { - if(motor & (1<<i)) { - //Conversion en de desiredImpulsions en nombre d'impulsions - - - error = encoders_status[i].desiredPosition - encoders_status[i].globalCounter; - PWM = (int32_t)(error*Kp[i]); - - setVelocity(1<<i, PWM); - encoders_status[i].rampePosition+=1; - } - } - holonome.asserPosition+=1; - return; -} - -int64_t convertRadInImpulsions(float actualPosition,int i ) { - int64_t actualImpulsions; - - actualImpulsions = (int64_t)(actualPosition*REDUCTION*GAINENCODER*4/(2*M_PI)); - - return actualImpulsions; -} - -float convertImpulsionsInRad(int64_t actualImpulsions,int i ) { - float actualPosition; - - actualPosition = (float(actualImpulsions)/(REDUCTION*GAINENCODER*4/(2*M_PI))); - - return actualPosition; -} - -void generateRampeMotor(unsigned short motor, float thetaMax, float vmax, float a) { - int i,k; - //Def des variables nécessaires à la générations des rampes - float tmax=0; //Défintion du temps final de fin de rampe - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float tvmax=vmax/a; //Temps où l'on atteint la vitesse max - float thetaVmax=0; - float theta; - float t1, t2; //Temps pour les trapèzes - float thetaDesired; - unsigned short signe; - - int64_t position; - int64_t actualPosition; - - for(i=0;i<NUM_MOTORS;i++) { - if(motor & 1<<i) { - k=encoders_status[i].rampePosition; - if(k==0) encoders_status[i].startPosition=encoders_status[i].globalCounter; - actualPosition=encoders_status[i].startPosition; - thetaDesired = thetaMax - convertImpulsionsInRad(actualPosition,i); - if(thetaDesired<0) { - signe=1; //On désire aller à une position antérieure - thetaDesired = - thetaDesired; - } - - //Choix du profil : triangulaire ou trapézoïdal - thetaVmax = a*tvmax*tvmax; - if(thetaVmax>thetaDesired) { - //On génère un profil triangulaire - tmax = 2*sqrt(thetaDesired/a); - - N=(int)(floorf(tmax/T))+1; - - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - theta=a/2*t*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - theta=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - } - else { - theta = thetaDesired; - } - } - - position=convertRadInImpulsions(theta,i); - - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = thetaDesired/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - theta=a/2*t*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - theta=a/2*t1*t1+vmax*(t-t1); - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - theta=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - } - else { - theta = thetaDesired; - } - } - - } - position=convertRadInImpulsions(theta,i); - - } - - //On doit maintenant convertir et incrémenter vis-à-vis de la position actuelle - - if(signe==1) position*=-1; - position+=actualPosition; - encoders_status[i].desiredPosition = position; - - } - - } - return; -} - -void generateRampeRobot(void) { - int i,k; - //Def des variables nécessaires à la générations des rampes - float Pmax,vmax,a; - float P,V; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Pstart; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - unsigned short signe; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - for(i=0;i<3;i++) { - //Récolte des données - switch (i) { - case 0: - // X - Pmax = holonome.xmax; - vmax = holonome.vXmax; - a = holonome.ax; - Pstart = holonome.Xstart; - break; - case 1: - // Y - Pmax = holonome.ymax; - vmax = holonome.vYmax; - a = holonome.ay; - Pstart = holonome.Ystart; - break; - case 2: - // T - Pmax = holonome.Tmax; - vmax = holonome.vTmax; - a = holonome.aT; - Pstart = holonome.Tstart; - break; - } - desiredP=Pmax-Pstart; - if(desiredP<0) { - signe = 1; - desiredP = -desiredP; - } - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - } - } - - } - } - if(signe==1) V=-V; - switch (i) { - case 0: - // X - w[0] = 0; - Ti[0]+=0; - w[1]=(V*sqrt(3)/2)/R; - Ti[1] += w[1]*T; - w[2]=-w[1]; - Ti[2] += w[2]*T; - break; - case 1: - // Y - w[0] = -V/R; // - - Ti[0] += w[0]*T; - w[1]= +V/(2*R); //+ - Ti[1] += w[1]*T; - w[2]=w[1]; - Ti[2] += w[2]*T; - break; - case 2: - // T - w[0] = -V*L1/R; - Ti[0] += w[0]*T; - w[1]= -V*L2/R; - Ti[1] += w[1]*T; - w[2]=-V*L3/R;; - Ti[2] += w[2]*T; - break; - } - - - - - - } - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -} - -void generateRampeRobotPlan() { - int i,k; - //Def des variables nécessaires à la générations des rampes - float xmax, ymax,vmax,a; - float P,V; - float xVirtuel, yVirtuel; - float Vx, Vy, theta; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Xstart, Ystart, thetaRobot; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - xmax = holonome.xmax; - ymax = holonome.ymax; - - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - - if((ymax-Ystart)==0) { - if((xmax-Xstart)<0) holonome.theta=M_PI; - else holonome.theta=0; - } - else holonome.theta = 2*atan((ymax-Ystart)/((xmax-Xstart)+sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)))); - - for(i=0; i<3;i++) { - holonome.Tprevious[i]=0; - } - - holonome.Pprevious = 0; - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - - //Récolte des données - xmax = holonome.xmax; - ymax = holonome.ymax; - vmax = holonome.vitesse; - a = holonome.acceleration; - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - theta = holonome.theta; - thetaRobot = holonome_odometry.T; - - desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - - } - } - - Vx = V*cos(theta-thetaRobot); - Vy = V*sin(theta-thetaRobot); - - //Ajout des composantes de déviations - - xVirtuel = cos(theta)*holonome.Pprevious; - yVirtuel = sin(theta)*holonome.Pprevious; // dans la base de la table - - //holonome.Pprevious = P; - //Vx += ((xVirtuel+Xstart-holonome_odometry.X)*cos(thetaRobot)-(yVirtuel+Ystart-holonome_odometry.Y)*sin(thetaRobot))/(5*T); - //Vy += ((yVirtuel+Ystart-holonome_odometry.Y)*cos(thetaRobot)+(xVirtuel+Xstart-holonome_odometry.X)*sin(thetaRobot))/(5*T); - - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; - - - - for(i=0;i<3;i++) { - Ti[i]=w[i]*T; - } - - - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -} - -/* -void generateRampeRobotPlan() { - int i,k; - //Def des variables nécessaires à la générations des rampes - float xmax, ymax,vmax,a; - float P,V; - float Vx, Vy, theta; - float Pvmax,tvmax,tmax; - float T = control_refresh/1000000.0; //Défintion de la période d'échantillonnage - float t; //Défini le temps discret - int N=0; //Nombre de points dans le vecteur de rampe - float t1, t2; //Temps pour les trapèzes - float desiredP; - float Xstart, Ystart; - float Ti[3]={0,0,0}; - float w[3]={0,0,0}; - - int64_t position; - int64_t actualPosition; - - k=holonome.asserPosition; - - - if(k==0) { - holonome.Xstart = holonome.X; - holonome.Ystart = holonome.Y; - holonome.Tstart = holonome.T; - xmax = holonome.xmax; - ymax = holonome.ymax; - - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - - if((ymax-Ystart)==0) { - if((xmax-Xstart)<0) holonome.theta=M_PI; - else holonome.theta=0; - } - else holonome.theta = 2*atan((ymax-Ystart)/((xmax-Xstart)+sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)))); - - for(i=0; i<3;i++) { - holonome.Tprevious[i]=0; - } - - - for(i=1;i<NUM_MOTORS;i++) - { - encoders_status[i].startPosition=encoders_status[i].globalCounter; - } - } - - - //Récolte des données - xmax = holonome.xmax; - ymax = holonome.ymax; - vmax = holonome.vitesse; - a = holonome.acceleration; - Xstart = holonome.Xstart; - Ystart = holonome.Ystart; - theta = holonome.theta; - - desiredP=sqrt((xmax-Xstart)*(xmax-Xstart)+(ymax-Ystart)*(ymax-Ystart)); - - //Choix du profil : triangulaire ou trapézoïdal - tvmax = vmax/a; - Pvmax = a*tvmax*tvmax; - if(Pvmax>desiredP) { - //On génère un profil triangulaire - tmax = 2*sqrt(desiredP/a); - N=(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; //On oublie forcément le point final - //Définition des CI et CF - t=(float)(k)*T; - - if(t<=tmax/2) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=tmax) { - //On est dans la deuxième partie de la coube - P=-a/2*t*t+a*tmax*t+a*(tmax/2)*(tmax/2)-a/2*tmax*tmax; - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - } - else { - //On génère un profil trapézoïdal - t1=vmax/a; - tmax = desiredP/vmax+t1; - t2 = tmax - t1; - N =(int)(floorf(tmax/T))+1; - if(N*T < tmax) N+=1; - - t=k*T; - - if(t<=t1) { - //On est dans la première partie de la courbe - P=a/2*t*t; - V=a*t; - } - else { - if(t<=t2) { - // On est dans la deuxième partie de la courbe - P=a/2*t1*t1+vmax*(t-t1); - V=vmax; - } - else { - if(t<=tmax) { - //On est dans la troisième partie de la coube - P=-a/2*t*t+a*tmax*(t-t2)+a/2*(t1*t1+t2*t2)+vmax*(t2-t1); - V=-a*t+a*tmax; - } - else { - P = desiredP; - V=0; - holonome.busy=0; - } - } - - } - } - - Vx = V*cos(theta); - Vy = V*sin(theta); - - - w[0] = (-Vy)/R; - w[1] = (Vx*sqrt(3)/2+Vy/2)/R; - w[2] = (-Vx*sqrt(3)/2+Vy/2)/R; - - - - for(i=0;i<3;i++) { - Ti[i]=w[i]*T; - } - - - for(i=0;i<NUM_MOTORS-1;i++) - { - Ti[i]+= holonome.Tprevious[i]; - holonome.Tprevious[i] = Ti[i]; - } - - for(i=1;i<NUM_MOTORS;i++) - { - //Moteur i - actualPosition = encoders_status[i].startPosition; - position = convertRadInImpulsions(Ti[i-1],i); - - position+=actualPosition; - - encoders_status[i].desiredPosition = position; - } - return; -}*/ diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.h deleted file mode 100644 index 0c01924..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/asservissement.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef HEADER__ASSERVISSEMENT -#define HEADER__ASSERVISSEMENT - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -#define NUM_ENCODERS 4 - -#define MOTOR_CONTROL1 MOTEUR2 -#define MOTOR_CONTROL2 MOTEUR3 -#define MOTOR_CONTROL3 MOTEUR4 - -#define NUM_MOTORS_CONTROL 3 - -//Paramètre de l'asservissement - - #define control_refresh 5000 - -//Modèle du MOTOR1 - - #define TAU 0 - #define KP1 0.22 - #define KP2 0.22 - #define KP3 0.22 - #define KP4 0.22 - -//Paramètres du PID du MOTOR1 - - #define KP 100 - #define KI 0 - #define KD 0 - -//Paramètres des moteurs - - #define REDUCTION 51 //51:1 - - #define GAINENCODER2 100 - #define GAINENCODER 360 - -//Paramètres du robot - - #define R 0.052 - #define L1 0.1774 - #define L2 0.1774 - #define L3 0.1774 - - - -//Def d'une structure encodeur - -typedef struct { - - int64_t globalCounter; //Somme toutes les impulsions pour connaître la position de la roue - uint8_t direction; //Indique le sens et la direction du moteur - float speed; //Indique la vitesse du moteur - int32_t previousCounter; //Indique la valeur précédente du compteur issu de l'hardware - int64_t desiredPosition; //Vector contenant la rampe suivie par la roue - int64_t startPosition; - int rampePosition; - unsigned short busy; - -} encoder_status; - -typedef struct { - - float xmax; - float vXmax; - float ax; - float ymax; - float vYmax; - float ay; - float Tmax; - float vTmax; - float aT; - float vitesse; - float acceleration; - float theta; - int asserPosition; - float Pprevious; - - //Position du robot sur la table - float X; - float Y; - float T; - float Tprevious[3]; - - float Xstart; - float Ystart; - float Tstart; - - int busy; - -} robot_control; - -robot_control holonome; -encoder_status encoders_status[4]; -void NORETURN control_process(void); - -void controlInit(void); -void refreshEncoderStatus(unsigned short encoder); -void controlMotors(unsigned short motors); -int64_t convertRadInImpulsions( float desiredPosition, int i); -float convertImpulsionsInRad(int64_t actualImpulsions,int i ); -void generateRampeMotor(unsigned short motors, float finalThetaDesired, float vmax, float a); -void generateRampeRobot(void); -void generateRampeRobotPlan(void); - -#endif diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.c deleted file mode 100644 index 41705e7..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.c +++ /dev/null @@ -1,187 +0,0 @@ -#include "encoder.h" -#include "motor.h" -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" - - - -void encodersInit(void) { - - TIM_ICInitTypeDef TIM_ICInitStructure; - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - - // Enable clocking on GPIOA, GPIOB, GPIOC and GPIOD - RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOB | RCC_APB2_GPIOC ; - - /* PinOut - Encoder 1 : A1 := PA6 - B1 := PA7 - - Encoder 2 : A2 := PC6 - B2 := PC7 - - Encoder 3 : A3 := PA8 - B3 := PA9 - - Encoder 4 : A4 := PB6 - B4 := PB7*/ - - // TIM3 (A1,B1) ; TIM8 (A2,B2) ; TIM1 (A3,B3) ; TIM4 (A4,B4) - - // TIMx clock enable - - RCC->APB1ENR |= RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4; - RCC->APB2ENR |= RCC_APB2Periph_TIM8 | RCC_APB2Periph_TIM1; - - // Configuring PinOut mode - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(6) | BV(7) | BV(8) | BV(9), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOB_BASE), - BV(6) | BV(7), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOC_BASE), - BV(6) | BV(7), GPIO_MODE_IN_FLOATING, - GPIO_SPEED_50MHZ); - - // Configuring TIMx base - - TIM_TimeBaseStructure.TIM_Period = 0xFFFF; - TIM_TimeBaseStructure.TIM_Prescaler = 0; - TIM_TimeBaseStructure.TIM_ClockDivision = 0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - TIM_TimeBaseStructure.TIM_RepetitionCounter = 0; - - TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure); - TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); - - TIM_ICStructInit(&TIM_ICInitStructure); - TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; - TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; - TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; - TIM_ICInitStructure.TIM_ICFilter = 0x0; - - - - // Configuring chanel 1 - TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; - TIM_ICInit(TIM3, &TIM_ICInitStructure); - TIM_ICInit(TIM8, &TIM_ICInitStructure); - TIM_ICInit(TIM1, &TIM_ICInitStructure); - TIM_ICInit(TIM4, &TIM_ICInitStructure); - - // Configuring chanel 2 - TIM_ICInitStructure.TIM_Channel = TIM_Channel_2; - TIM_ICInit(TIM3, &TIM_ICInitStructure); - TIM_ICInit(TIM8, &TIM_ICInitStructure); - TIM_ICInit(TIM1, &TIM_ICInitStructure); - TIM_ICInit(TIM4, &TIM_ICInitStructure); - - // Réglage de la configuration de l'encodeur : quadrature ou non - - TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM8, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM1, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - TIM_EncoderInterfaceConfig(TIM4, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); - - // Enable encoders - - TIM_Cmd(TIM3, ENABLE); - TIM_Cmd(TIM8, ENABLE); - TIM_Cmd(TIM1, ENABLE); - TIM_Cmd(TIM4, ENABLE); - - resetEncoderCount(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4 ); - - return; -} - -// Obtentions des valeurs des compteurs -uint16_t getEncoderCount(unsigned short encoder) { - switch (encoder) { - case ENCODER1 : - return TIM_GetCounter(TIM3); - break; - case ENCODER2 : - return TIM_GetCounter(TIM8); - break; - case ENCODER3 : - return TIM_GetCounter(TIM1); - break; - case ENCODER4 : - return TIM_GetCounter(TIM4); - break; - } - return 0; -} - -// Reset de la valeur des compteurs à O -void resetEncoderCount(unsigned short encoders) { - - if(encoders & ENCODER1) { - TIM_SetCounter(TIM3,0); - } - - if(encoders & ENCODER2) { - TIM_SetCounter(TIM8,0); - } - - if(encoders & ENCODER3) { - TIM_SetCounter(TIM1,0); - } - - if(encoders & ENCODER4) { - TIM_SetCounter(TIM4,0); - } - - return; -} - -uint8_t getEncoderDirection(unsigned short encoder) { - - uint8_t direction; - switch (encoder) { - case ENCODER1 : - if ((TIM3->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER2 : - if ((TIM8->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER3 : - if ((TIM1->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - case ENCODER4 : - if ((TIM4->CR1 & TIM_CR1_DIR)!=0) { - direction = BACKWARD_DIRECTION; - } - else { - direction = FORWARD_DIRECTION; - } - break; - } - return direction; -} - diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.h deleted file mode 100644 index 99c7be0..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/encoder.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef HEADER__ENCODER -#define HEADER__ENCODER - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" - -#define ENCODER1 1 //encoder connected to the motor 1 -#define ENCODER2 2// ... -#define ENCODER3 4 -#define ENCODER4 8 - -void encodersInit(void); - -uint16_t getEncoderCount(unsigned short encoder); - -void resetEncoderCount(unsigned short encoders); - -uint8_t getEncoderDirection(unsigned short encoder); - -#endif diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.c deleted file mode 100644 index e5a10bd..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.c +++ /dev/null @@ -1,168 +0,0 @@ -#include "intelligence.h" -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" -#include "odometry.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - -PROC_DEFINE_STACK(stack_intelligence, KERN_MINSTACKSIZE * 4); - -int etape=0; - -void intelligenceInit(void) { - int i; - - holonome.xmax=0; - holonome.vXmax=0.25; - holonome.ax=0.25; - holonome.ymax=-0; - holonome.vYmax=0.3; - holonome.ay=0.15; - holonome.Tmax=20*M_PI; - holonome.vTmax=3; - holonome.aT=0.5; - holonome.asserPosition=0; - holonome.X=0; - holonome.Y=0; - holonome.T=0; - holonome.Xstart=0; - holonome.Ystart=0; - holonome.Tstart=0; - holonome.acceleration=0; - holonome.vitesse=0; - holonome.busy =0; - - for(i=0;i<NUM_MOTORS-1;i++) - { - holonome.Tprevious[i]=0; - } - - /* Create a new child process */ - - proc_new(intelligence_process, NULL, sizeof(stack_intelligence), stack_intelligence); - - - return; -} - -void NORETURN intelligence_process(void) -{ - Timer timer_intelligence_process; - timer_setDelay(&timer_intelligence_process, us_to_ticks((utime_t)(intelligence_refresh))); - timer_setEvent(&timer_intelligence_process); - - - - while(1) { - - timer_add(&timer_intelligence_process);// Start process timer - - makePath(); - timer_waitEvent(&timer_intelligence_process); // Wait until the end of counting - } - - -} - -void makePath(void) { - int i; - if(holonome.busy==0) { //On peut donc envoyer une nouvelle position - - holonome.X = holonome_odometry.X; - holonome.Y = holonome_odometry.Y; - - //holonome.X = holonome.xmax; - //holonome.Y = holonome.ymax; - /*for(i=0;i<3;i++) { - holonome.Tprevious[i]=0; - }*/ - //holonome.asserPosition=0; - switch(etape) { - case 0: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 1: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 2: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 3: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = -0.5; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 4: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 5: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = -0.5; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 6: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape+=1; - break; - case 7: - holonome.busy=1; - holonome.asserPosition=0; - holonome.xmax = 0; - holonome.ymax = 0; - holonome.vitesse = 0.5; - holonome.acceleration=0.5; - etape=0; - break; - - - } - - - } - - - return; -} diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.h deleted file mode 100644 index 42f3da2..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/intelligence.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef HEADER__INTELLIGENCE -#define HEADER__INTELLIGENCE - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -//Paramètre de l'asservissement - - #define intelligence_refresh 50000 - -void makePath(void); -void intelligenceInit(void); - -void NORETURN intelligence_process(void); - -#endif diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.c deleted file mode 100644 index 8cbdeb9..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.c +++ /dev/null @@ -1,350 +0,0 @@ -#include "motor.h" -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" - -/*Private variables */ - - TIM_OCInitTypeDef TIM_OCInitStructure; - - unsigned short def_motors[4]={MOTEUR1, MOTEUR2, MOTEUR3, MOTEUR4}; - motor_status motors_status[4]; - -void motorsInit(void) { - - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - - uint32_t SystemClock = 72000000; - uint32_t Tim2DesiredClock = 72000000; - uint16_t PrescalerValue = 0; - - int i; - - // Enable clocking on GPIOA, GPIOB, GPIOC and GPIOD - RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOB | RCC_APB2_GPIOC | RCC_APB2_GPIOD; - - // Enable clocking on TIM2 - RCC->APB1ENR |= RCC_APB1_TIM2; - //Def I/O of motors - //Port A - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(0) | BV(1) | BV(2) | BV(3), GPIO_MODE_AF_PP, - GPIO_SPEED_50MHZ); //TIM2 on PWM Pins - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOA_BASE), - BV(5) | BV(10) , GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port B - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOB_BASE), - BV(1) | BV(14) | BV(15) | BV(5) | BV(9), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port C - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOC_BASE), - BV(4) | BV(5) | BV(10) | BV(11) | BV(9), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Port D - stm32_gpioPinConfig(((struct stm32_gpio *)GPIOD_BASE), - BV(2), GPIO_MODE_OUT_PP, - GPIO_SPEED_50MHZ); - - //Init of TIM2 - - - /*Calcul du Prescalar */ - PrescalerValue = (uint16_t) (SystemClock/Tim2DesiredClock)-1; - //PrescalerValue = 0; - - /*Config du timer2 */ - TIM_TimeBaseStructure.TIM_Period = 3600; //Horloge : 20kHz - TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue; - TIM_TimeBaseStructure.TIM_ClockDivision = 0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - - TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); - - /*Initialisation des PWMs*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; - TIM_OCInitStructure.TIM_Pulse = 0; - TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; - - /*Chanel 1*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC1Init(TIM2, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 2*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC2Init(TIM2, &TIM_OCInitStructure); - TIM_OC2PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 3*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC3Init(TIM2, &TIM_OCInitStructure); - TIM_OC3PreloadConfig(TIM2, TIM_OCPreload_Enable); - - /*Chanel 4*/ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OC4Init(TIM2, &TIM_OCInitStructure); - TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable); - - TIM_ARRPreloadConfig(TIM2, ENABLE); - - /* TIM2 enable counter */ - TIM_Cmd(TIM2, ENABLE); - - /* Init motors_status*/ - for(i=0;i<NUM_MOTORS;i++) - { - motors_status[i].currentPWM=0; - motors_status[i].desiredPosition=0; - motors_status[i].currentPosition=0; - motors_status[i].direction=0; - motors_status[i].speed=0; - } - - return; -} - -void setMotors(unsigned short motors, unsigned short direction) { - /*Def le sens de rotation des moteurs : 0 forward - 1 backward */ - if( motors & MOTEUR1 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 1); - break; - } - } - - if( motors & MOTEUR2 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 1); - break; - } - } - - if( motors & MOTEUR3 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 1); - break; - } - } - - if( motors & MOTEUR4 ) - { - switch (direction) { - case FORWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 0); - break; - case BACKWARD_DIRECTION : - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 1); - break; - } - } - return; -} - -void enableMotors(unsigned short motors) { - /*Active le pont H du MOTEURX */ - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(5), 1); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(15), 1); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(10), 1); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOD_BASE), BV(2), 1); - } - return; -} - -void disableMotors(unsigned short motors) { - /*Active le pont H du MOTEURX */ - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(5), 0); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(15), 0); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(10), 0); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOD_BASE), BV(2), 0); - } - return; -} - -void setVelocity(unsigned short motors, int32_t velocity) { - - if(velocity > MAX_PWM) velocity=MAX_PWM; - if(velocity < -MAX_PWM) velocity=-MAX_PWM; - - if( motors & MOTEUR1 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(0), 1); - if( velocity >= 0) { - setMotors(MOTEUR1, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR1, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED1_ON(); - else LED1_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC1Init(TIM2, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM2, TIM_OCPreload_Enable); - - } - - if( motors & MOTEUR2 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(1), 1); - if( velocity >= 0) { - setMotors(MOTEUR2, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR2, BACKWARD_DIRECTION); - velocity = -velocity; - } - //if(velocity==MAX_PWM) LED2_ON(); - //else LED2_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC2Init(TIM2, &TIM_OCInitStructure); - TIM_OC2PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - if( motors & MOTEUR3 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(2), 1); - if( velocity >= 0) { - setMotors(MOTEUR3, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR3, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED3_ON(); - else LED3_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC3Init(TIM2, &TIM_OCInitStructure); - TIM_OC3PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - if( motors & MOTEUR4 ) - { - //stm32_gpioPinWrite(((struct stm32_gpio *)GPIOA_BASE), BV(3), 1); - if( velocity >= 0) { - setMotors(MOTEUR4, FORWARD_DIRECTION); - } - else { - setMotors(MOTEUR4, BACKWARD_DIRECTION); - velocity = -velocity; - } - if(velocity==MAX_PWM) LED4_ON(); - else LED4_OFF(); - TIM_OCInitStructure.TIM_Pulse = (uint16_t)velocity; - TIM_OC4Init(TIM2, &TIM_OCInitStructure); - TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable); - } - - TIM_ARRPreloadConfig(TIM2, ENABLE); - return; -} - -void breakMotors(unsigned short motors) { - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 1); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 1); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 1); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 1); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 1); - } - return; -} - -void freeMotors(unsigned short motors) { - if( motors & MOTEUR1 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(4), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(5), 0); - } - - if( motors & MOTEUR2 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(1), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(14), 0); - } - - if( motors & MOTEUR3 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(10), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOC_BASE), BV(11), 0); - } - - if( motors & MOTEUR4 ) - { - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(5), 0); - stm32_gpioPinWrite(((struct stm32_gpio *)GPIOB_BASE), BV(9), 0); - } - return; -} diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.h deleted file mode 100644 index 8cbcf3e..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/motor.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef HEADER__MOTOR -#define HEADER__MOTOR - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" - -#include <math.h> - -#define NUM_MOTORS 4 - -#define MOTEUR1 1 //Moteur à gauche de l'ascenseur vue de face -#define MOTEUR2 2 //Moteur suivant dans le sens horaire vue de dessus -#define MOTEUR3 4 //Moteur à droite de l'ascenseur vue de dessus -#define MOTEUR4 8 //Moteur de l'ascenceur principal - -#define FORWARD_DIRECTION 0 //Incrémentation du compteur -#define BACKWARD_DIRECTION 1 //Décrémentation du compteur - -#define MAX_PWM 2300 - -//Def d'une structure moteur - -typedef struct { - uint16_t currentPWM; - float desiredPosition; - float currentPosition; - uint8_t direction; //Indique le sens et la direction du moteur - float speed; //Indique la vitesse du moteur - -} motor_status; - -void motorsInit(void); - -//Commande des moteurs 1..4 - void setMotors(unsigned short motors, unsigned short direction); - void enableMotors(unsigned short motors); - void disableMotors(unsigned short motors); - void breakMotors(unsigned short motors); - void freeMotors(unsigned short motors); - void setVelocity(unsigned short motors, int32_t velocity); - - -#endif diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.c deleted file mode 100644 index 0c96734..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "odometry.h" -#include "intelligence.h" -#include "asservissement.h" -#include "encoder.h" -#include "motor.h" - -#include <cfg/macros.h> -#include <drv/gpio_stm32.h> -#include "stm32lib/stm32f10x_tim.h" -#include "stm32lib/stm32f10x_rcc.h" -#include "stm32lib/stm32f10x.h" -#include <math.h> - -PROC_DEFINE_STACK(stack_odometry, KERN_MINSTACKSIZE * 4); - - -void odometryInit(void) { - int i; - - holonome_odometry.X=0; - holonome_odometry.Y=0; - holonome_odometry.T=0; - - for(i=0;i<NUM_MOTORS-1;i++) - { - holonome_odometry.previousCounter[i]=0; - } - - /* Create a new child process */ - - proc_new(odometry_process, NULL, sizeof(stack_odometry), stack_odometry); - - - return; -} - -void NORETURN odometry_process(void) -{ - Timer timer_odometry_process; - timer_setDelay(&timer_odometry_process, us_to_ticks((utime_t)(odometry_refresh))); - timer_setEvent(&timer_odometry_process); - - - - while(1) { - - timer_add(&timer_odometry_process);// Start process timer - refreshOdometry(); - timer_waitEvent(&timer_odometry_process); // Wait until the end of counting - } - - -} -/* -void refreshOdometry() { - int i; - int64_t dTheta[3]; - - - // Rafraichissement des encodeurs - refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - - // Prise en compte de la variation d'impulsions - for(i=0; i<NUM_MOTORS;i++) { - if(1<<i & MOTOR_CONTROL1) { - dTheta[0] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[0]; - holonome_odometry.previousCounter[0] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL2) { - dTheta[1] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[1]; - holonome_odometry.previousCounter[1] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL3) { - dTheta[2] = encoders_status[i].globalCounter - holonome_odometry.previousCounter[2]; - holonome_odometry.previousCounter[2] = encoders_status[i].globalCounter; - } - } - // T : position angulaire - holonome_odometry.T += -R/(3*L)*(convertImpulsionsInRad( dTheta[0]+dTheta[1]+dTheta[2],0)); - if(holonome_odometry.T >= 0.01) LED2_ON(); - else LED2_OFF(); - // Y - holonome_odometry.Y += R/3*(convertImpulsionsInRad( -2*dTheta[0]+dTheta[1]+dTheta[2],0)); - // X - holonome_odometry.X += R/(sqrt(3))*(convertImpulsionsInRad( dTheta[1]-dTheta[2],0)); - return; - -}*/ - -void refreshOdometry() { - int i; - float dTheta[3]; - float X1, Y1; - - // Rafraichissement des encodeurs - refreshEncoderStatus(ENCODER1 | ENCODER2 | ENCODER3 | ENCODER4); - - // Prise en compte de la variation d'impulsions - for(i=0; i<NUM_MOTORS;i++) { - if(1<<i & MOTOR_CONTROL1) { - dTheta[0] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[0],0); - holonome_odometry.previousCounter[0] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL2) { - dTheta[1] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[1],0); - holonome_odometry.previousCounter[1] = encoders_status[i].globalCounter; - } - - if(1<<i & MOTOR_CONTROL3) { - dTheta[2] = convertImpulsionsInRad(encoders_status[i].globalCounter,0) - convertImpulsionsInRad(holonome_odometry.previousCounter[2],0); - holonome_odometry.previousCounter[2] = encoders_status[i].globalCounter; - } - } - // T : position angulaire - holonome_odometry.T += -R/(3)*( dTheta[0]/L1+dTheta[1]/L2+dTheta[2]/L3); - if(abs(holonome_odometry.T) >= 0.01) LED2_ON(); - else LED2_OFF(); - X1 = R/(sqrt(3))*(dTheta[1]-dTheta[2]); - Y1 = R/3*( -2*dTheta[0]+dTheta[1]+dTheta[2]); - - // Y - - holonome_odometry.Y += sin(holonome_odometry.T)*X1+ cos(holonome_odometry.T)*Y1; - // X - holonome_odometry.X += cos(holonome_odometry.T)*X1- sin(holonome_odometry.T)*Y1; - return; - -} - diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.h deleted file mode 100644 index be665ba..0000000 --- a/elec/boards/Balise_IR/Carte_capteurs/Firmware/controller_motor_stm32/odometry.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef HEADER__ODOMETRY -#define HEADER__ODOMETRY - -#include <drv/gpio_stm32.h> -#include <drv/clock_stm32.h> -#include "hw/hw_led.h" -#include <drv/timer.h> - -#include <stdlib.h> - -//Paramètre de l'asservissement - - #define odometry_refresh 2500 - -typedef struct { - - int64_t previousCounter[3]; - - //Position du robot sur la table - float X; - float Y; - float T; - - -} robot_odometry; - -robot_odometry holonome_odometry; - - -void odometryInit(void); -void refreshOdometry(void); - -void NORETURN odometry_process(void); - -#endif hooks/post-receive -- krobot |
From: Justin <Ba...@us...> - 2011-06-08 14:31:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via e2f20d045bee49b75db46177cf3c28103bfee276 (commit) from 5448c6c59e14ca827106721dd5da9bc189952a6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e2f20d045bee49b75db46177cf3c28103bfee276 Author: justin <justin@MacBook.(none)> Date: Wed Jun 8 16:28:50 2011 +0200 Add Firmaware Sensor Card ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.project b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.project new file mode 100644 index 0000000..8ce8f23 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.project @@ -0,0 +1,955 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Project Name="Firmware" InternalType=""> +<File Name="Makefile"/> +<VirtualDirectory Name="Firmware"> +<File Name="Firmware/main.c"/> +<File Name="Firmware/Firmware_user.mk"/> +<File Name="Firmware/Firmware.mk"/> +<VirtualDirectory Name="cfg"> +<File Name="Firmware/cfg/cfg_xmodem.h"/> +<File Name="Firmware/cfg/cfg_debug.h"/> +<File Name="Firmware/cfg/cfg_wdt.h"/> +<File Name="Firmware/cfg/cfg_i2s.h"/> +<File Name="Firmware/cfg/cfg_lcd_hd44.h"/> +<File Name="Firmware/cfg/cfg_usb.h"/> +<File Name="Firmware/cfg/cfg_context_switch.h"/> +<File Name="Firmware/cfg/cfg_randpool.h"/> +<File Name="Firmware/cfg/cfg_proc.h"/> +<File Name="Firmware/cfg/cfg_fat.h"/> +<File Name="Firmware/cfg/cfg_usbkbd.h"/> +<File Name="Firmware/cfg/cfg_adc.h"/> +<File Name="Firmware/cfg/cfg_stepper.h"/> +<File Name="Firmware/cfg/cfg_formatwr.h"/> +<File Name="Firmware/cfg/cfg_emb_flash.h"/> +<File Name="Firmware/cfg/cfg_md2.h"/> +<File Name="Firmware/cfg/cfg_lcd_32122a.h"/> +<File Name="Firmware/cfg/cfg_phase.h"/> +<File Name="Firmware/cfg/cfg_dataflash.h"/> +<File Name="Firmware/cfg/cfg_ax25.h"/> +<File Name="Firmware/cfg/cfg_i2c.h"/> +<File Name="Firmware/cfg/cfg_ser.h"/> +<File Name="Firmware/cfg/cfg_usbser.h"/> +<File Name="Firmware/cfg/cfg_sem.h"/> +<File Name="Firmware/cfg/cfg_ramp.h"/> +<File Name="Firmware/cfg/cfg_pocketbus.h"/> +<File Name="Firmware/cfg/cfg_parser.h"/> +<File Name="Firmware/cfg/cfg_hashtable.h"/> +<File Name="Firmware/cfg/cfg_ini_reader.h"/> +<File Name="Firmware/cfg/cfg_kbd.h"/> +<File Name="Firmware/cfg/cfg_kfile.h"/> +<File Name="Firmware/cfg/cfg_afsk.h"/> +<File Name="Firmware/cfg/cfg_monitor.h"/> +<File Name="Firmware/cfg/cfg_lm75.h"/> +<File Name="Firmware/cfg/cfg_timer.h"/> +<File Name="Firmware/cfg/cfg_dc_motor.h"/> +<File Name="Firmware/cfg/cfg_usbmouse.h"/> +<File Name="Firmware/cfg/cfg_flash25.h"/> +<File Name="Firmware/cfg/cfg_thermo.h"/> +<File Name="Firmware/cfg/cfg_spi_bitbang.h"/> +<File Name="Firmware/cfg/cfg_battfs.h"/> +<File Name="Firmware/cfg/cfg_keytag.h"/> +<File Name="Firmware/cfg/cfg_sd.h"/> +<File Name="Firmware/cfg/cfg_gfx.h"/> +<File Name="Firmware/cfg/cfg_heap.h"/> +<File Name="Firmware/cfg/cfg_tas5706a.h"/> +<File Name="Firmware/cfg/cfg_signal.h"/> +<File Name="Firmware/cfg/cfg_pwm.h"/> +<File Name="Firmware/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="Firmware/hw/mcp41_map.h"/> +<File Name="Firmware/hw/hw_phase.c"/> +<File Name="Firmware/hw/hw_kbd.h"/> +<File Name="Firmware/hw/hw_dc_motor.h"/> +<File Name="Firmware/hw/phase_map.h"/> +<File Name="Firmware/hw/thermo_map.h"/> +<File Name="Firmware/hw/hw_tlv5618.h"/> +<File Name="Firmware/hw/hw_lm75.h"/> +<File Name="Firmware/hw/hw_mcp41.h"/> +<File Name="Firmware/hw/hw_ntc.h"/> +<File Name="Firmware/hw/pwm_map.h"/> +<File Name="Firmware/hw/hw_dataflash.c"/> +<File Name="Firmware/hw/kbd_map.h"/> +<File Name="Firmware/hw/hw_tas5706a.h"/> +<File Name="Firmware/hw/hw_ili9225.h"/> +<File Name="Firmware/hw/hw_mcp41.c"/> +<File Name="Firmware/hw/hw_sipo.h"/> +<File Name="Firmware/hw/hw_lcd_32122a.h"/> +<File Name="Firmware/hw/hw_sd.h"/> +<File Name="Firmware/hw/hw_tmp123.h"/> +<File Name="Firmware/hw/hw_lcd_hd44.h"/> +<File Name="Firmware/hw/hw_i2c_bitbang.h"/> +<File Name="Firmware/hw/hw_ft245rl.h"/> +<File Name="Firmware/hw/hw_buzzer.h"/> +<File Name="Firmware/hw/ntc_map.h"/> +<File Name="Firmware/hw/hw_led.h"/> +<File Name="Firmware/hw/hw_spi.h"/> +<File Name="Firmware/hw/hw_stepper.h"/> +<File Name="Firmware/hw/hw_ser.h"/> +<File Name="Firmware/hw/hw_ntc.c"/> +<File Name="Firmware/hw/hw_rit128x96.h"/> +<File Name="Firmware/hw/hw_phase.h"/> +<File Name="Firmware/hw/hw_dataflash.h"/> +<File Name="Firmware/hw/hw_thermo.h"/> +<File Name="Firmware/hw/hw_afsk.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="bertos"> +<File Name="bertos/verstag.c"/> +<File Name="bertos/config.mk"/> +<File Name="bertos/verstag.h"/> +<File Name="bertos/rules.mk"/> +<VirtualDirectory Name="struct"> +<File Name="bertos/struct/fifobuf.h"/> +<File Name="bertos/struct/kfile_mem.h"/> +<File Name="bertos/struct/hashtable_test.c"/> +<File Name="bertos/struct/kfile_fifo.h"/> +<File Name="bertos/struct/heap.c"/> +<File Name="bertos/struct/kfile_fifo.c"/> +<File Name="bertos/struct/pool.h"/> +<File Name="bertos/struct/hashtable.c"/> +<File Name="bertos/struct/bitarray.h"/> +<File Name="bertos/struct/list.h"/> +<File Name="bertos/struct/hashtable.h"/> +<File Name="bertos/struct/bitarray_test.c"/> +<File Name="bertos/struct/heap_test.c"/> +<File Name="bertos/struct/heap.h"/> +<File Name="bertos/struct/kfile_mem.c"/> +<File Name="bertos/struct/kfile_fifo_test.c"/> +</VirtualDirectory> +<VirtualDirectory Name="algo"> +<File Name="bertos/algo/tea.c"/> +<File Name="bertos/algo/tea.h"/> +<File Name="bertos/algo/crc.h"/> +<File Name="bertos/algo/crc_ccitt.c"/> +<File Name="bertos/algo/mean.h"/> +<File Name="bertos/algo/rand.h"/> +<File Name="bertos/algo/ramp.h"/> +<File Name="bertos/algo/reverse_test.c"/> +<File Name="bertos/algo/ramp_test.c"/> +<File Name="bertos/algo/randpool.h"/> +<File Name="bertos/algo/crc_ccitt.h"/> +<File Name="bertos/algo/md2.c"/> +<File Name="bertos/algo/ramp.c"/> +<File Name="bertos/algo/randpool.c"/> +<File Name="bertos/algo/md2.h"/> +<File Name="bertos/algo/crc_test.c"/> +<File Name="bertos/algo/rotating_hash.h"/> +<File Name="bertos/algo/pid_control.h"/> +<File Name="bertos/algo/crc.c"/> +<File Name="bertos/algo/rand.c"/> +<File Name="bertos/algo/rle.h"/> +<File Name="bertos/algo/pid_control.c"/> +<File Name="bertos/algo/rle.c"/> +</VirtualDirectory> +<VirtualDirectory Name="icons"> +<File Name="bertos/icons/Makefile"/> +<File Name="bertos/icons/logo.c"/> +<File Name="bertos/icons/logo.h"/> +<File Name="bertos/icons/flipimage.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="benchmark"> +<File Name="bertos/benchmark/context_switch.c"/> +<File Name="bertos/benchmark/context_switch.h"/> +<File Name="bertos/benchmark/kernel_footprint.c"/> +<File Name="bertos/benchmark/kernel_footprint.h"/> +</VirtualDirectory> +<VirtualDirectory Name="gfx"> +<File Name="bertos/gfx/win.c"/> +<File Name="bertos/gfx/text_format.c"/> +<File Name="bertos/gfx/win.h"/> +<File Name="bertos/gfx/text.h"/> +<File Name="bertos/gfx/gfx_p.h"/> +<File Name="bertos/gfx/gfx.h"/> +<File Name="bertos/gfx/line.c"/> +<File Name="bertos/gfx/charts.c"/> +<File Name="bertos/gfx/fillpoly.cpp"/> +<File Name="bertos/gfx/text.c"/> +<File Name="bertos/gfx/font.h"/> +<File Name="bertos/gfx/bitmap.c"/> +<File Name="bertos/gfx/charts.h"/> +<File Name="bertos/gfx/font_10x20.c"/> +</VirtualDirectory> +<VirtualDirectory Name="cfg"> +<File Name="bertos/cfg/depend.h"/> +<File Name="bertos/cfg/cfg_xmodem.h"/> +<File Name="bertos/cfg/cfg_debug.h"/> +<File Name="bertos/cfg/cfg_wdt.h"/> +<File Name="bertos/cfg/cfg_eth.h"/> +<File Name="bertos/cfg/cfg_i2s.h"/> +<File Name="bertos/cfg/cfg_kern.h"/> +<File Name="bertos/cfg/cfg_lcd_hd44.h"/> +<File Name="bertos/cfg/kfile_debug.c"/> +<File Name="bertos/cfg/module.h"/> +<File Name="bertos/cfg/cfg_usb.h"/> +<File Name="bertos/cfg/cfg_context_switch.h"/> +<File Name="bertos/cfg/cfg_randpool.h"/> +<File Name="bertos/cfg/cfg_menu.h"/> +<File Name="bertos/cfg/cfg_proc.h"/> +<File Name="bertos/cfg/cfg_fat.h"/> +<File Name="bertos/cfg/cfg_usbkbd.h"/> +<File Name="bertos/cfg/cfg_pid.h"/> +<File Name="bertos/cfg/compiler.h"/> +<File Name="bertos/cfg/cfg_adc.h"/> +<File Name="bertos/cfg/cfg_stepper.h"/> +<File Name="bertos/cfg/cfg_formatwr.h"/> +<File Name="bertos/cfg/cfg_boot.h"/> +<File Name="bertos/cfg/cfg_arch.h"/> +<File Name="bertos/cfg/debug.h"/> +<File Name="bertos/cfg/cfg_emb_flash.h"/> +<File Name="bertos/cfg/cfg_md2.h"/> +<File Name="bertos/cfg/log.h"/> +<File Name="bertos/cfg/cfg_lcd_32122a.h"/> +<File Name="bertos/cfg/cfg_phase.h"/> +<File Name="bertos/cfg/cfg_dataflash.h"/> +<File Name="bertos/cfg/cfg_ax25.h"/> +<File Name="bertos/cfg/cfg_i2c.h"/> +<File Name="bertos/cfg/cfg_ser.h"/> +<File Name="bertos/cfg/cfg_usbser.h"/> +<File Name="bertos/cfg/cfg_eeprom.h"/> +<File Name="bertos/cfg/cfg_sem.h"/> +<File Name="bertos/cfg/cfg_attr.h"/> +<File Name="bertos/cfg/cfg_ramp.h"/> +<File Name="bertos/cfg/cfg_pocketbus.h"/> +<File Name="bertos/cfg/cfg_parser.h"/> +<File Name="bertos/cfg/cfg_spi_dma.h"/> +<File Name="bertos/cfg/cfg_hashtable.h"/> +<File Name="bertos/cfg/cfg_ini_reader.h"/> +<File Name="bertos/cfg/cfg_kbd.h"/> +<File Name="bertos/cfg/cfg_ntc.h"/> +<File Name="bertos/cfg/cfg_kfile.h"/> +<File Name="bertos/cfg/kfile_debug.h"/> +<File Name="bertos/cfg/cfg_lwip.h"/> +<File Name="bertos/cfg/cfg_afsk.h"/> +<File Name="bertos/cfg/cfg_monitor.h"/> +<File Name="bertos/cfg/cfg_lm75.h"/> +<File Name="bertos/cfg/cfg_timer.h"/> +<File Name="bertos/cfg/cfg_dc_motor.h"/> +<File Name="bertos/cfg/cfg_usbmouse.h"/> +<File Name="bertos/cfg/cfg_flash25.h"/> +<File Name="bertos/cfg/cfg_buzzerled.h"/> +<File Name="bertos/cfg/cfg_thermo.h"/> +<File Name="bertos/cfg/test.h"/> +<File Name="bertos/cfg/cfg_spi_bitbang.h"/> +<File Name="bertos/cfg/cfg_battfs.h"/> +<File Name="bertos/cfg/cfg_keytag.h"/> +<File Name="bertos/cfg/cfg_sd.h"/> +<File Name="bertos/cfg/cfg_gfx.h"/> +<File Name="bertos/cfg/os.h"/> +<File Name="bertos/cfg/cfg_heap.h"/> +<File Name="bertos/cfg/macros.h"/> +<File Name="bertos/cfg/cfg_tas5706a.h"/> +<File Name="bertos/cfg/cfg_signal.h"/> +<File Name="bertos/cfg/cfg_pwm.h"/> +<File Name="bertos/cfg/cfg_nmea.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fs"> +<File Name="bertos/fs/battfs.h"/> +<File Name="bertos/fs/fat.c"/> +<File Name="bertos/fs/battfs_test.c"/> +<File Name="bertos/fs/fat_test.c"/> +<File Name="bertos/fs/battfs.c"/> +<File Name="bertos/fs/fat.h"/> +<VirtualDirectory Name="fatfs"> +<File Name="bertos/fs/fatfs/ff.h"/> +<File Name="bertos/fs/fatfs/integer.h"/> +<File Name="bertos/fs/fatfs/diskio.h"/> +<File Name="bertos/fs/fatfs/ff.c"/> +<File Name="bertos/fs/fatfs/diskio.c"/> +<VirtualDirectory Name="option"> +<File Name="bertos/fs/fatfs/option/cc950.c"/> +<File Name="bertos/fs/fatfs/option/cc949.c"/> +<File Name="bertos/fs/fatfs/option/cc936.c"/> +<File Name="bertos/fs/fatfs/option/ccsbcs.c"/> +<File Name="bertos/fs/fatfs/option/syncobj.c"/> +<File Name="bertos/fs/fatfs/option/cc932.c"/> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/drv/lcd_32122a.c"/> +<File Name="bertos/drv/lcd_text.c"/> +<File Name="bertos/drv/lcd_hd44.c"/> +<File Name="bertos/drv/lcd_hd44.h"/> +<File Name="bertos/drv/spi_bitbang.h"/> +<File Name="bertos/drv/phase.c"/> +<File Name="bertos/drv/usbmouse.c"/> +<File Name="bertos/drv/tas5706a.c"/> +<File Name="bertos/drv/thermo.h"/> +<File Name="bertos/drv/ser.c"/> +<File Name="bertos/drv/ft245rl.c"/> +<File Name="bertos/drv/usb.h"/> +<File Name="bertos/drv/sd.h"/> +<File Name="bertos/drv/pwm.h"/> +<File Name="bertos/drv/tc520.h"/> +<File Name="bertos/drv/ser.h"/> +<File Name="bertos/drv/phase.h"/> +<File Name="bertos/drv/sipo.c"/> +<File Name="bertos/drv/kbd.c"/> +<File Name="bertos/drv/sd.c"/> +<File Name="bertos/drv/pcf8574.c"/> +<File Name="bertos/drv/mcp41.c"/> +<File Name="bertos/drv/kdebug.c"/> +<File Name="bertos/drv/lcd_ili9225.h"/> +<File Name="bertos/drv/lcd_32122a.h"/> +<File Name="bertos/drv/usbkbd.c"/> +<File Name="bertos/drv/lcd_text.h"/> +<File Name="bertos/drv/dataflash.h"/> +<File Name="bertos/drv/ntc.c"/> +<File Name="bertos/drv/flash25_hwtest.c"/> +<File Name="bertos/drv/adc.c"/> +<File Name="bertos/drv/sipo.h"/> +<File Name="bertos/drv/lm75.c"/> +<File Name="bertos/drv/pcf8574.h"/> +<File Name="bertos/drv/timer_test.c"/> +<File Name="bertos/drv/usbkbd.h"/> +<File Name="bertos/drv/wdt.h"/> +<File Name="bertos/drv/tlv5618.c"/> +<File Name="bertos/drv/dataflash.c"/> +<File Name="bertos/drv/stepper.h"/> +<File Name="bertos/drv/usbmouse.h"/> +<File Name="bertos/drv/lcd_ili9225.c"/> +<File Name="bertos/drv/lcd_rit128x96.h"/> +<File Name="bertos/drv/usb_hid.h"/> +<File Name="bertos/drv/thermo.c"/> +<File Name="bertos/drv/i2c.c"/> +<File Name="bertos/drv/tas5706a.h"/> +<File Name="bertos/drv/timer.h"/> +<File Name="bertos/drv/lcd_text_hwtest.c"/> +<File Name="bertos/drv/dataflash_hwtest.c"/> +<File Name="bertos/drv/dc_motor_hwtest.c"/> +<File Name="bertos/drv/ser_p.h"/> +<File Name="bertos/drv/ft245rl.h"/> +<File Name="bertos/drv/i2c_bitbang.c"/> +<File Name="bertos/drv/tlv5618.h"/> +<File Name="bertos/drv/mcp41.h"/> +<File Name="bertos/drv/tmp123.h"/> +<File Name="bertos/drv/tmp123.c"/> +<File Name="bertos/drv/i2c.h"/> +<File Name="bertos/drv/dc_motor.h"/> +<File Name="bertos/drv/lcd_lm44_qt.cpp"/> +<File Name="bertos/drv/lcd_lm44_qt.h"/> +<File Name="bertos/drv/buzzer.h"/> +<File Name="bertos/drv/stepper.c"/> +<File Name="bertos/drv/buzzerled.h"/> +<File Name="bertos/drv/ntc.h"/> +<File Name="bertos/drv/eeprom.h"/> +<File Name="bertos/drv/mpxx6115a.h"/> +<File Name="bertos/drv/dc_motor.c"/> +<File Name="bertos/drv/lcd_gfx_qt.h"/> +<File Name="bertos/drv/pwm.c"/> +<File Name="bertos/drv/usb_endpoint.h"/> +<File Name="bertos/drv/flash25.h"/> +<File Name="bertos/drv/lcd_rit128x96.c"/> +<File Name="bertos/drv/pwm_hwtest.c"/> +<File Name="bertos/drv/flash.h"/> +<File Name="bertos/drv/eeprom.c"/> +<File Name="bertos/drv/adc.h"/> +<File Name="bertos/drv/buzzerled.c"/> +<File Name="bertos/drv/lcd_gfx_hwtest.c"/> +<File Name="bertos/drv/flash25.c"/> +<File Name="bertos/drv/lm75.h"/> +<File Name="bertos/drv/lcd_gfx_qt.cpp"/> +<File Name="bertos/drv/buzzer.c"/> +<File Name="bertos/drv/kbd.h"/> +<File Name="bertos/drv/usbser.c"/> +<File Name="bertos/drv/usbser.h"/> +<File Name="bertos/drv/timer.c"/> +<File Name="bertos/drv/spi_bitbang.c"/> +<File Name="bertos/drv/tc520.c"/> +<File Name="bertos/drv/lcd_hd44_hwtest.c"/> +</VirtualDirectory> +<VirtualDirectory Name="gui"> +<File Name="bertos/gui/menubar.h"/> +<File Name="bertos/gui/menu.h"/> +<File Name="bertos/gui/levelbar.h"/> +<File Name="bertos/gui/levelbar.c"/> +<File Name="bertos/gui/menu.c"/> +<File Name="bertos/gui/menubar.c"/> +<File Name="bertos/gui/leveledit.h"/> +<File Name="bertos/gui/leveledit.c"/> +</VirtualDirectory> +<VirtualDirectory Name="kern"> +<File Name="bertos/kern/proc_p.h"/> +<File Name="bertos/kern/coop.c"/> +<File Name="bertos/kern/preempt.c"/> +<File Name="bertos/kern/signal.h"/> +<File Name="bertos/kern/sem.c"/> +<File Name="bertos/kern/proc_test.c"/> +<File Name="bertos/kern/sem_test.c"/> +<File Name="bertos/kern/proc.c"/> +<File Name="bertos/kern/kfile.h"/> +<File Name="bertos/kern/signal_test.c"/> +<File Name="bertos/kern/irq.c"/> +<File Name="bertos/kern/sem.h"/> +<File Name="bertos/kern/msg.h"/> +<File Name="bertos/kern/monitor.h"/> +<File Name="bertos/kern/msg_test.c"/> +<File Name="bertos/kern/proc.h"/> +<File Name="bertos/kern/signal.c"/> +<File Name="bertos/kern/irq.h"/> +<File Name="bertos/kern/monitor.c"/> +<VirtualDirectory Name="proc_test"> +<File Name="bertos/kern/proc_test/preempt_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_signal_test.c"/> +<File Name="bertos/kern/proc_test/coop_msg_test.c"/> +<File Name="bertos/kern/proc_test/preempt_signal_test.c"/> +<File Name="bertos/kern/proc_test/preempt_test.c"/> +<File Name="bertos/kern/proc_test/preempt_heap_test.c"/> +<File Name="bertos/kern/proc_test/preempt_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_heap_test.c"/> +<File Name="bertos/kern/proc_test/coop_test.c"/> +<File Name="bertos/kern/proc_test/preempt_sem_test.c"/> +<File Name="bertos/kern/proc_test/coop_pri_test.c"/> +<File Name="bertos/kern/proc_test/coop_heap_test.c"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="emul"> +<File Name="bertos/emul/switch_ppc.S"/> +<File Name="bertos/emul/emul.h"/> +<File Name="bertos/emul/timer_qt.h"/> +<File Name="bertos/emul/switch.S"/> +<File Name="bertos/emul/emul.cpp"/> +<File Name="bertos/emul/switch_i386.S"/> +<File Name="bertos/emul/kfile_posix.c"/> +<File Name="bertos/emul/timer_posix.c"/> +<File Name="bertos/emul/timer_posix.h"/> +<File Name="bertos/emul/emul.mk"/> +<File Name="bertos/emul/emulwin.h"/> +<File Name="bertos/emul/timer_qt.c"/> +<File Name="bertos/emul/ser_posix.c"/> +<File Name="bertos/emul/switch_ctx_emul.S"/> +<File Name="bertos/emul/kfile_posix.h"/> +<File Name="bertos/emul/emulkbd.h"/> +<File Name="bertos/emul/emulkbd.cpp"/> +<File Name="bertos/emul/diskio_emul.c"/> +<File Name="bertos/emul/emulwin.cpp"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/hw/mcp41_map.h"/> +<File Name="bertos/hw/hw_input.h"/> +<File Name="bertos/hw/hw_phase.c"/> +<File Name="bertos/hw/hw_kbd.h"/> +<File Name="bertos/hw/hw_dc_motor.h"/> +<File Name="bertos/hw/phase_map.h"/> +<File Name="bertos/hw/thermo_map.h"/> +<File Name="bertos/hw/hw_tlv5618.h"/> +<File Name="bertos/hw/hw_lm75.h"/> +<File Name="bertos/hw/hw_mcp41.h"/> +<File Name="bertos/hw/hw_timer.h"/> +<File Name="bertos/hw/hw_boot.h"/> +<File Name="bertos/hw/hw_ntc.h"/> +<File Name="bertos/hw/hw_spi_dma.h"/> +<File Name="bertos/hw/pwm_map.h"/> +<File Name="bertos/hw/hw_dataflash.c"/> +<File Name="bertos/hw/kbd_map.h"/> +<File Name="bertos/hw/hw_tas5706a.h"/> +<File Name="bertos/hw/hw_ili9225.h"/> +<File Name="bertos/hw/hw_lcd.h"/> +<File Name="bertos/hw/hw_cpufreq.h"/> +<File Name="bertos/hw/hw_mcp41.c"/> +<File Name="bertos/hw/hw_sipo.h"/> +<File Name="bertos/hw/hw_tc520.h"/> +<File Name="bertos/hw/hw_lcd_32122a.h"/> +<File Name="bertos/hw/hw_sd.h"/> +<File Name="bertos/hw/hw_tmp123.h"/> +<File Name="bertos/hw/hw_lcd_hd44.h"/> +<File Name="bertos/hw/hw_i2c_bitbang.h"/> +<File Name="bertos/hw/hw_ft245rl.h"/> +<File Name="bertos/hw/hw_buzzer.h"/> +<File Name="bertos/hw/ntc_map.h"/> +<File Name="bertos/hw/hw_led.h"/> +<File Name="bertos/hw/hw_spi.h"/> +<File Name="bertos/hw/hw_stepper.h"/> +<File Name="bertos/hw/hw_blanker.h"/> +<File Name="bertos/hw/hw_buzzerled.h"/> +<File Name="bertos/hw/hw_ser.h"/> +<File Name="bertos/hw/hw_sensor.h"/> +<File Name="bertos/hw/hw_ntc.c"/> +<File Name="bertos/hw/hw_rit128x96.h"/> +<File Name="bertos/hw/hw_phase.h"/> +<File Name="bertos/hw/hw_dataflash.h"/> +<File Name="bertos/hw/hw_thermo.h"/> +<File Name="bertos/hw/hw_afsk.h"/> +</VirtualDirectory> +<VirtualDirectory Name="fonts"> +<File Name="bertos/fonts/ncenB18.c"/> +<File Name="bertos/fonts/fixed6x8.c"/> +<File Name="bertos/fonts/helvB10.c"/> +<File Name="bertos/fonts/luBS14.c"/> +<File Name="bertos/fonts/gohu.c"/> +<File Name="bertos/fonts/fonts.mk"/> +</VirtualDirectory> +<VirtualDirectory Name="cpu"> +<File Name="bertos/cpu/power.h"/> +<File Name="bertos/cpu/detect.h"/> +<File Name="bertos/cpu/types.h"/> +<File Name="bertos/cpu/attr.h"/> +<File Name="bertos/cpu/byteorder.h"/> +<File Name="bertos/cpu/frame.h"/> +<File Name="bertos/cpu/irq.h"/> +<File Name="bertos/cpu/pgm.h"/> +<VirtualDirectory Name="avr"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/avr/drv/stepper_avr.h"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.c"/> +<File Name="bertos/cpu/avr/drv/flash_avr.h"/> +<File Name="bertos/cpu/avr/drv/wdt_avr.h"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.c"/> +<File Name="bertos/cpu/avr/drv/adc_avr.h"/> +<File Name="bertos/cpu/avr/drv/adc_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.h"/> +<File Name="bertos/cpu/avr/drv/kdebug_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.c"/> +<File Name="bertos/cpu/avr/drv/ser_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/timer_simple_avr.h"/> +<File Name="bertos/cpu/avr/drv/stepper_avr.c"/> +<File Name="bertos/cpu/avr/drv/timer_avr.c"/> +<File Name="bertos/cpu/avr/drv/i2c_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.c"/> +<File Name="bertos/cpu/avr/drv/pwm_avr.h"/> +<File Name="bertos/cpu/avr/drv/ser_avr.h"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/avr/hw/switch_ctx_avr.S"/> +<File Name="bertos/cpu/avr/hw/switch_avr.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="arm"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/lpc2378.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_128_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/arm7tdmi_ram.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_64_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_512_rom.ld"/> +<File Name="bertos/cpu/arm/scripts/at91sam7_256_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/arm/drv/sysirq_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_arm.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2c_arm.h"/> +<File Name="bertos/cpu/arm/drv/flash_arm.h"/> +<File Name="bertos/cpu/arm/drv/adc_at91.c"/> +<File Name="bertos/cpu/arm/drv/timer_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/twi_at91.h"/> +<File Name="bertos/cpu/arm/drv/ser_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.c"/> +<File Name="bertos/cpu/arm/drv/sysirq_at91.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_arm.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_arm.c"/> +<File Name="bertos/cpu/arm/drv/eth_at91.h"/> +<File Name="bertos/cpu/arm/drv/i2c_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.h"/> +<File Name="bertos/cpu/arm/drv/i2c_at91.h"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/adc_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91_hwtest.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.h"/> +<File Name="bertos/cpu/arm/drv/kdebug_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/pwm_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/adc_at91.h"/> +<File Name="bertos/cpu/arm/drv/wdt_arm.h"/> +<File Name="bertos/cpu/arm/drv/ser_at91.c"/> +<File Name="bertos/cpu/arm/drv/adc_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_at91.c"/> +<File Name="bertos/cpu/arm/drv/twi_arm.c"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.h"/> +<File Name="bertos/cpu/arm/drv/stepper_arm.c"/> +<File Name="bertos/cpu/arm/drv/ser_at91.h"/> +<File Name="bertos/cpu/arm/drv/spi_dma_at91.h"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.c"/> +<File Name="bertos/cpu/arm/drv/kdebug_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.h"/> +<File Name="bertos/cpu/arm/drv/flash_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/stepper_at91.h"/> +<File Name="bertos/cpu/arm/drv/twi_at91.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.c"/> +<File Name="bertos/cpu/arm/drv/ser_arm.h"/> +<File Name="bertos/cpu/arm/drv/timer_arm.c"/> +<File Name="bertos/cpu/arm/drv/i2s_at91.h"/> +<File Name="bertos/cpu/arm/drv/pwm_at91.c"/> +<File Name="bertos/cpu/arm/drv/flash_at91.c"/> +<File Name="bertos/cpu/arm/drv/vic_lpc2.c"/> +<File Name="bertos/cpu/arm/drv/timer_lpc2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/arm/hw/vectors_at91.S"/> +<File Name="bertos/cpu/arm/hw/init_at91.c"/> +<File Name="bertos/cpu/arm/hw/switch_ctx_arm.S"/> +<File Name="bertos/cpu/arm/hw/switch_arm.S"/> +<File Name="bertos/cpu/arm/hw/crtat91sam7_rom.S"/> +<File Name="bertos/cpu/arm/hw/vectors_lpc2.S"/> +<File Name="bertos/cpu/arm/hw/pll_at91.h"/> +<File Name="bertos/cpu/arm/hw/init_lpc2.c"/> +<File Name="bertos/cpu/arm/hw/crt_arm7tdmi.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/arm/io/at91_pwm.h"/> +<File Name="bertos/cpu/arm/io/at91.h"/> +<File Name="bertos/cpu/arm/io/at91_aic.h"/> +<File Name="bertos/cpu/arm/io/at91_twi.h"/> +<File Name="bertos/cpu/arm/io/lpc23xx.h"/> +<File Name="bertos/cpu/arm/io/at91_ssc.h"/> +<File Name="bertos/cpu/arm/io/at91_spi.h"/> +<File Name="bertos/cpu/arm/io/at91_emac.h"/> +<File Name="bertos/cpu/arm/io/at91_dbgu.h"/> +<File Name="bertos/cpu/arm/io/at91_wdt.h"/> +<File Name="bertos/cpu/arm/io/at91_mc.h"/> +<File Name="bertos/cpu/arm/io/at91_adc.h"/> +<File Name="bertos/cpu/arm/io/at91_pio.h"/> +<File Name="bertos/cpu/arm/io/at91_pit.h"/> +<File Name="bertos/cpu/arm/io/at91_pmc.h"/> +<File Name="bertos/cpu/arm/io/at91_tc.h"/> +<File Name="bertos/cpu/arm/io/at91_us.h"/> +<File Name="bertos/cpu/arm/io/arm.h"/> +<File Name="bertos/cpu/arm/io/at91_rstc.h"/> +<File Name="bertos/cpu/arm/io/at91sam7.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="dsp56k"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/dsp56k/drv/kdebug_dsp56k.c"/> +<File Name="bertos/cpu/dsp56k/drv/timer_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/buzzerled_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.h"/> +<File Name="bertos/cpu/dsp56k/drv/ser_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/dsp56k/hw/switch_dsp56k.c"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="x86"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="cortex-m3"> +<VirtualDirectory Name="scripts"> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/stm32f103rb_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/sam3n4_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/cortex-m3_rom.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s1968_ram.ld"/> +<File Name="bertos/cpu/cortex-m3/scripts/lm3s8962_ram.ld"/> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/usb_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/i2c_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/irq_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_stm32.h"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/random_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/flash_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/adc_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_sam3.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_sam3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ser_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/gpio_stm32.c"/> +<File Name="bertos/cpu/cortex-m3/drv/kdebug_lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/timer_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/drv/clock_lm3s.c"/> +<File Name="bertos/cpu/cortex-m3/drv/ssi_lm3s.c"/> +</VirtualDirectory> +<VirtualDirectory Name="info"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +<File Name="bertos/cpu/cortex-m3/hw/crt_cm3.S"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.h"/> +<File Name="bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/init_cm3.c"/> +<File Name="bertos/cpu/cortex-m3/hw/vectors_cm3.S"/> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/cpu/cortex-m3/io/lm3s_pwm.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_wdt.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3.h"/> +<File Name="bertos/cpu/cortex-m3/io/cm3.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_memmap.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3n.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_types.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ssi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_i2c.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_sysctl.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_nvic.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_usart.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pio.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_uart.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_adc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_flash.h"/> +<File Name="bertos/cpu/cortex-m3/io/stm32_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_spi.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_com.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_pmc.h"/> +<File Name="bertos/cpu/cortex-m3/io/sam3_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_ints.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_gpio.h"/> +<File Name="bertos/cpu/cortex-m3/io/lm3s_memmap.h"/> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="ppc"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="i196"> +<VirtualDirectory Name="scripts"> +</VirtualDirectory> +<VirtualDirectory Name="drv"> +<File Name="bertos/cpu/i196/drv/timer_i196.h"/> +<File Name="bertos/cpu/i196/drv/ser_i196.c"/> +<File Name="bertos/cpu/i196/drv/kdebug_i196.c"/> +</VirtualDirectory> +<VirtualDirectory Name="hw"> +</VirtualDirectory> +<VirtualDirectory Name="io"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="mware"> +<File Name="bertos/mware/readline.h"/> +<File Name="bertos/mware/parser.h"/> +<File Name="bertos/mware/blanker.h"/> +<File Name="bertos/mware/strtol10.h"/> +<File Name="bertos/mware/observer.h"/> +<File Name="bertos/mware/cmd_hunk.h"/> +<File Name="bertos/mware/strtol10.c"/> +<File Name="bertos/mware/sprintf.c"/> +<File Name="bertos/mware/formatwr.h"/> +<File Name="bertos/mware/event.h"/> +<File Name="bertos/mware/event.c"/> +<File Name="bertos/mware/resource.h"/> +<File Name="bertos/mware/parser.c"/> +<File Name="bertos/mware/formatwr.c"/> +<File Name="bertos/mware/observer.c"/> +<File Name="bertos/mware/readline.c"/> +<File Name="bertos/mware/hex.h"/> +<File Name="bertos/mware/resource.c"/> +<File Name="bertos/mware/sprintf_test.c"/> +<File Name="bertos/mware/hex.c"/> +<File Name="bertos/mware/ini_reader_test.c"/> +<File Name="bertos/mware/messages.c"/> +<File Name="bertos/mware/rle.h"/> +<File Name="bertos/mware/ini_reader.h"/> +<File Name="bertos/mware/ini_reader.c"/> +<File Name="bertos/mware/messages.h"/> +<File Name="bertos/mware/blanker.c"/> +<File Name="bertos/mware/byteorder.h"/> +<File Name="bertos/mware/except.h"/> +<File Name="bertos/mware/pgm.h"/> +</VirtualDirectory> +<VirtualDirectory Name="os"> +<File Name="bertos/os/hptime.h"/> +<File Name="bertos/os/hptime.c"/> +</VirtualDirectory> +<VirtualDirectory Name="net"> +<File Name="bertos/net/keytag.h"/> +<File Name="bertos/net/nmea.c"/> +<File Name="bertos/net/xmodem.h"/> +<File Name="bertos/net/pocketcmd.h"/> +<File Name="bertos/net/pocketbus.c"/> +<File Name="bertos/net/ax25_test.c"/> +<File Name="bertos/net/nmea.h"/> +<File Name="bertos/net/afsk_test.c"/> +<File Name="bertos/net/pocketbus.h"/> +<File Name="bertos/net/ax25.c"/> +<File Name="bertos/net/pocketcmd.c"/> +<File Name="bertos/net/nmea_test.c"/> +<File Name="bertos/net/afsk.h"/> +<File Name="bertos/net/afsk.c"/> +<File Name="bertos/net/ax25.h"/> +<File Name="bertos/net/keytag.c"/> +<File Name="bertos/net/xmodem.c"/> +<VirtualDirectory Name="nmeap"> +<File Name="bertos/net/nmeap/Makefile"/> +<VirtualDirectory Name="tst"> +<File Name="bertos/net/nmeap/tst/wingps.c"/> +<File Name="bertos/net/nmeap/tst/test1.c"/> +<File Name="bertos/net/nmeap/tst/Makefile"/> +<File Name="bertos/net/nmeap/tst/test3.c"/> +<File Name="bertos/net/nmeap/tst/test2.c"/> +</VirtualDirectory> +<VirtualDirectory Name="inc"> +<File Name="bertos/net/nmeap/inc/nmeap_def.h"/> +<File Name="bertos/net/nmeap/inc/nmeap.h"/> +</VirtualDirectory> +<VirtualDirectory Name="src"> +<File Name="bertos/net/nmeap/src/nmeap01.c"/> +<File Name="bertos/net/nmeap/src/Makefile"/> +</VirtualDirectory> +<VirtualDirectory Name="lib"> +</VirtualDirectory> +</VirtualDirectory> +</VirtualDirectory> +<VirtualDirectory Name="io"> +<File Name="bertos/io/kblock_ram.h"/> +<File Name="bertos/io/kblock_posix.h"/> +<File Name="bertos/io/kblock_posix.c"/> +<File Name="bertos/io/kfile_test.c"/> +<File Name="bertos/io/kblock.h"/> +<File Name="bertos/io/kfile.h"/> +<File Name="bertos/io/kfile_block.h"/> +<File Name="bertos/io/kfile_block.c"/> +<File Name="bertos/io/kblock_ram.c"/> +<File Name="bertos/io/kfile.c"/> +<File Name="bertos/io/kblock.c"/> +</VirtualDirectory> +<VirtualDirectory Name="dt"> +<File Name="bertos/dt/dnotifier.h"/> +<File Name="bertos/dt/dwidget.h"/> +<File Name="bertos/dt/editint.c"/> +<File Name="bertos/dt/editint.h"/> +<File Name="bertos/dt/dwidget.c"/> +<File Name="bertos/dt/dnotifier.c"/> +<File Name="bertos/dt/dtag.h"/> +<File Name="bertos/dt/editbool.h"/> +<File Name="bertos/dt/editbool.c"/> +</VirtualDirectory> +</VirtualDirectory> + <Description></Description> + <Dependencies/> + <Settings Type="Dynamic Library"> + <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Debug" Command="./images/Firmware.elf" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options="-g"> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options=""/> + <Debugger IsRemote="yes" RemoteHostName="localhost" RemoteHostPort="3333" DebuggerPath="/usr/bin/i686-linux-gnu-gdb-4.5"> + <PostConnectCommands> +source bertos/prg_scripts/arm/openocd/gdbinit-sam7 + </PostConnectCommands> + <StartupCommands> +shell sleep 2 + </StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> + <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/> + <Compiler Required="yes" Options=""> + <IncludePath Value="."/> + </Compiler> + <Linker Required="yes" Options="-O2"/> + <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath=""> + <PostConnectCommands></PostConnectCommands> + <StartupCommands></StartupCommands> + </Debugger> + <ResourceCompiler Required="no" Options=""/> + <PreBuild/> + <PostBuild/> + <CustomBuild Enabled="yes"> + <CleanCommand>make clean</CleanCommand> + <BuildCommand>make</BuildCommand> + <PreprocessFileCommand></PreprocessFileCommand> + <SingleFileCommand></SingleFileCommand> + <MakefileGenerationCommand></MakefileGenerationCommand> + <ThirdPartyToolName>None</ThirdPartyToolName> + <WorkingDirectory>$(WorkspacePath)</WorkingDirectory> + </CustomBuild> + <AdditionalRules> + <CustomPostBuild></CustomPostBuild> + <CustomPreBuild></CustomPreBuild> + </AdditionalRules> + </Configuration> + </Settings> +</CodeLite_Project> diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.workspace b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.workspace new file mode 100644 index 0000000..3a8d0fa --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Firmware.workspace @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<CodeLite_Workspace Name="Firmware" Database="./bertos.tags"> + <Project Name="Firmware" Path="Firmware.project" Active="Yes"/> + <BuildMatrix> + <WorkspaceConfiguration Name="Debug" Selected="yes"> + <Project Name="Firmware" ConfigName="Debug"/> + </WorkspaceConfiguration> + <WorkspaceConfiguration Name="Release" Selected="yes"> + <Project Name="Firmware" ConfigName="Release"/> + </WorkspaceConfiguration> + </BuildMatrix> +</CodeLite_Workspace> diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/Makefile b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Makefile new file mode 100644 index 0000000..cb8af58 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni <du...@de...> +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include controller_motor_stm32/controller_motor_stm32.mk + +include bertos/rules.mk diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/VERSION b/elec/boards/Balise_IR/Carte_capteurs/Firmware/VERSION new file mode 100644 index 0000000..ab7cff5 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/VERSION @@ -0,0 +1 @@ +BeRTOS 2.6.1 [local copy] diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.c new file mode 100644 index 0000000..d4293f9 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.c @@ -0,0 +1,102 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC table and support routines + * + * \author Bernie Innocenti <be...@co...> + */ + +#include "crc.h" + +/* + * The boot on AVR cpu is placed at the end of flash memory, but the avr + * address memory by byte and the pointers are 16bits long, so we are able + * to address 64Kbyte memory max. For this reason we can't read the crctab + * from flash, because it is placed at the end of memory. This is true every + * time we have an AVR cpu with more that 64Kbyte of flash. To fix this problem + * we let the compiler copy the table in RAM at startup. Obviously this solution + * is not efficent, but for now this is the only way. + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define CRC_TABLE const uint16_t PROGMEM crc16tab[256] +#else + #define CRC_TABLE const uint16_t crc16tab[256] +#endif + +/** + * crctab calculated by Mark G. Mendel, Network Systems Corporation + */ +CRC_TABLE = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + +uint16_t crc16(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while(len--) + crc = UPDCRC16(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.h new file mode 100644 index 0000000..c5c1eef --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief Cyclic Redundancy Check 16 (CRC). This algorithm is the one used by the XMODEM protocol. + * + * \note This algorithm is incompatible with the CCITT-CRC16. + * + * This code is based on the article Copyright 1986 Stephen Satchell. + * + * Programmers may incorporate any or all code into their programs, + * giving proper credit within the source. Publication of the + * source routines is permitted so long as proper credit is given + * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, + * Omen Technology. + * + * \author Bernie Innocenti <be...@co...> + * + * $WIZ$ module_name = "crc16" + */ + +#ifndef ALGO_CRC_H +#define ALGO_CRC_H + +#include "cfg/cfg_arch.h" + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc16tab[256]; + + +/** + * \brief Compute the updated CRC16 value for one octet (macro version) + * + * \note This version is only intended for old/broken compilers. + * Use the inline function in new code. + * + * \param c New octet (range 0-255) + * \param oldcrc Previous CRC16 value (referenced twice, beware of side effects) + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define UPDCRC16(c, oldcrc) (pgm_read_uint16_t(&crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#else + #define UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#endif + +/** CRC-16 init value */ +#define CRC16_INIT_VAL ((uint16_t)0) + +#ifdef INLINE +/** + * \brief Compute the updated CRC16 value for one octet (inline version) + */ +INLINE uint16_t updcrc16(uint8_t c, uint16_t oldcrc) +{ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + return pgm_read_uint16_t(&crc16tab[(oldcrc >> 8) ^ c]) ^ (oldcrc << 8); +#else + return crc16tab[(oldcrc >> 8) ^ c] ^ (oldcrc << 8); +#endif +} +#endif // INLINE + + +/** + * This function implements the CRC 16 calculation on a buffer. + * + * \param crc Current CRC16 value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC16 value. + */ +extern uint16_t crc16(uint16_t crc, const void *buf, size_t len); + +int crc_testSetup(void); +int crc_testRun(void); +int crc_testTearDown(void); + +EXTERN_C_END + +#endif /* ALGO_CRC_H */ diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.c new file mode 100644 index 0000000..feaf624 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.c @@ -0,0 +1,83 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" + +const uint16_t PROGMEM crc_ccitt_tab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, +}; + +uint16_t crc_ccitt(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while (len--) + crc = updcrc_ccitt(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.h b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.h new file mode 100644 index 0000000..240e6e1 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_ccitt.h @@ -0,0 +1,78 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CCITT Cyclic Redundancy Check (CRC-CCITT). + * + * \note This algorithm is incompatible with the CRC16. + * + * \author Francesco Sacchi <ba...@de...> + * + * $WIZ$ module_name = "crc-ccitt" + */ + +#ifndef ALGO_CRC_CCITT_H +#define ALGO_CRC_CCITT_H + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc_ccitt_tab[256]; + +/** + * \brief Compute the updated CRC-CCITT value for one octet (inline version) + */ +INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) +{ + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); +} + +/** CRC-CCITT init value */ +#define CRC_CCITT_INIT_VAL ((uint16_t)0xFFFF) + + +/** + * This function implements the CRC-CCITT calculation on a buffer. + * + * \param crc Current CRC-CCITT value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC-CCITT value. + */ +extern uint16_t crc_ccitt(uint16_t crc, const void *buf, size_t len); + +EXTERN_C_END + +#endif /* ALGO_CRC_CCITT_H */ diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_test.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_test.c new file mode 100644 index 0000000..1a93e3b --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/crc_test.c @@ -0,0 +1,75 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" +#include "crc.h" + +#include <cfg/debug.h> +#include <cfg/test.h> + + +int crc_testSetup(void) +{ + kdbg_init(); + return 0; +} + +int crc_testTearDown(void) +{ + return 0; +} + +int crc_testRun(void) +{ + char vector[9] = "123456789"; + + uint16_t crc = CRC_CCITT_INIT_VAL; + + crc = crc_ccitt(crc, vector, sizeof(vector)); + kprintf("crc_ccitt [%04X]\n", crc); + ASSERT(crc == 0x6F91); + + crc = CRC16_INIT_VAL; + crc = crc16(crc, vector, sizeof(vector)); + kprintf("crc16 [%04X]\n", crc); + ASSERT(crc == 0x31C3); + + return 0; +} + +TEST_MAIN(crc); diff --git a/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/md2.c b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/md2.c new file mode 100644 index 0000000..589d989 --- /dev/null +++ b/elec/boards/Balise_IR/Carte_capteurs/Firmware/bertos/algo/md2.c @@ -0,0 +1,336 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in ... [truncated message content] |
From: Jérémie D. <Ba...@us...> - 2011-06-06 17:16:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 5448c6c59e14ca827106721dd5da9bc189952a6a (commit) via 1f60ccac92bf4c5f4597967b7e9d773334a90f63 (commit) via f380ee8973895face4d5b2295fb0a4e135eda780 (commit) via ea1a197d8eeec4d917b127bdba6742423df9cab7 (commit) via 9da6a855b7370e34be331b77e0d6760349b5e18a (commit) via 9dbb59a3e7a35fe6c6f64ddf17916b6274ec2517 (commit) via 1a049cd04a302b1113d8f5adf4107a1547103a12 (commit) via 58fb6c64e33a183f0b6028fbe244a0452e70458c (commit) via 9ec7d0af2555087d2114180cdb3a3bc04266660d (commit) via 49f90e1ad727f5aa40a543f013b533f010e86c2b (commit) via c500a6d35431f4d3eb8ae13350acb8840ffdcc62 (commit) via 6a58ff4e127d43b98d4c1f234d85aeea2ba8bd76 (commit) via 14b0879b2e34bfd343d1a069e680190bdae2953f (commit) via 293297b22b18781349744a0ac794ab8445a81779 (commit) via 8620279d6c6599c37ae0e51e9b85457495ea8dde (commit) via 8b6cca05ed5c410de10241fb12bf87e73321f5b2 (commit) via 51a2b998f311f37d80faa1a6e3154ec59fb78fd8 (commit) via f996695c754fadf4a5ab183549f73e8d7adeaf1d (commit) via a60c1722847b46333113b4824b7776aa87936a9a (commit) via 06dc02a7d39cd1bbef4d6841097135f41a064971 (commit) via b95e2ac49537041b9fe76bf1db69a2c26ccc7cfe (commit) via 2c975f20991be791d7e86dced5fc182c4287d7f0 (commit) via c28241399972b072537bae9c73a19b999ace17be (commit) via 06392258468fa1238e3555db960cd75b09a28e81 (commit) via e349d8f7e8a74cb7436f9e292180c7b12c210f69 (commit) via 752ea3cb1fbadd518d490e725a127eff6ead49f2 (commit) via fdf21325685b6d202aa167d559ae502d76bb65e1 (commit) via 59373c990c400c44f3214d1ff2e43b3a5b01a708 (commit) via 1d95af89a718001da9a730643476e8215b2548c9 (commit) via d7edbd72e9edfd86072f4ea657ed95cca0c816ee (commit) via 6e293aee63a51caa184477fa263a876bafa1f71f (commit) via 5be42dcf5fd15446cbaea97c894117afe32d6f33 (commit) via 276b192e754122dbc1b84c2b80ca0290b8901d84 (commit) via 3d7abff0b47dfc753b022e807926319c234f60d2 (commit) via 2eba87a8645c11f9aad9c4605f7ebe63dfc3ad4d (commit) via 62378cac5d536830654e5d132b0581ddf680de46 (commit) via b3f3a19d35c2e91ada6035f1cf7c77fa45948c6a (commit) via c19e9d21d23a0a7102db38745c8673a718a9a9bc (commit) from 617b3078e3af5ed2d37e4a380167ef65d924f3ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5448c6c59e14ca827106721dd5da9bc189952a6a Author: Nicolas Dandrimont <Nic...@cr...> Date: Fri Jun 3 08:56:52 2011 +0200 [Sensor_Actuator] Fix AX-12 Torque Enable commit 1f60ccac92bf4c5f4597967b7e9d773334a90f63 Author: chambart <cha...@cr...> Date: Fri Jun 3 07:04:19 2011 +0200 [info] start of krobot_run commit f380ee8973895face4d5b2295fb0a4e135eda780 Author: chambart <cha...@cr...> Date: Thu Jun 2 22:34:29 2011 +0200 [control] correct some factors in beacon, hack to stop when seeing beacon commit ea1a197d8eeec4d917b127bdba6742423df9cab7 Author: Nicolas Dandrimont <Nic...@cr...> Date: Fri Jun 3 02:21:47 2011 +0200 [info/control2011] Disable AX-12 reset and enable AX-12 set torque enable commit 9da6a855b7370e34be331b77e0d6760349b5e18a Author: Nicolas Dandrimont <Nic...@cr...> Date: Fri Jun 3 02:09:42 2011 +0200 [Sensor_Actuator] Add an AX-12 torque enable CAN message. commit 9dbb59a3e7a35fe6c6f64ddf17916b6274ec2517 Author: Olivier BICHLER <oli...@gm...> Date: Thu Jun 2 22:25:14 2011 +0200 [Sensor Actuator] New calibration data commit 1a049cd04a302b1113d8f5adf4107a1547103a12 Author: chambart <cha...@cr...> Date: Thu Jun 2 20:43:54 2011 +0200 [info] correct successive back curves commit 58fb6c64e33a183f0b6028fbe244a0452e70458c Author: Olivier BICHLER <oli...@gm...> Date: Thu Jun 2 17:51:58 2011 +0200 [Sensor Actuator] Enable buzzer alarm in Battery Monitoring commit 9ec7d0af2555087d2114180cdb3a3bc04266660d Author: Nicolas Dandrimont <Nic...@cr...> Date: Thu Jun 2 17:26:18 2011 +0200 [Sensor_Actuator] Add a firmware allowing AX12 resets on the STM32-P103 board Plug the AX12 data wire on the 3rd pin of the UEXT1 port commit 49f90e1ad727f5aa40a543f013b533f010e86c2b Author: Nicolas Dandrimont <Nic...@cr...> Date: Thu Jun 2 17:25:46 2011 +0200 [Sensor_Actuator] Working AX12 protocol commit c500a6d35431f4d3eb8ae13350acb8840ffdcc62 Author: chambart <cha...@cr...> Date: Thu Jun 2 17:32:21 2011 +0200 [vision] detect imbricated ellipses commit 6a58ff4e127d43b98d4c1f234d85aeea2ba8bd76 Author: chambart <cha...@cr...> Date: Thu Jun 2 14:55:33 2011 +0200 [vision] add camfilter_edge commit 14b0879b2e34bfd343d1a069e680190bdae2953f Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 14:34:21 2011 +0200 [krobot_pathfinding] fix check_point commit 293297b22b18781349744a0ac794ab8445a81779 Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 12:29:05 2011 +0200 [krobot_homo] handle the jack commit 8620279d6c6599c37ae0e51e9b85457495ea8dde Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 12:18:49 2011 +0200 [info] fix smart goto commit 8b6cca05ed5c410de10241fb12bf87e73321f5b2 Author: chambart <cha...@cr...> Date: Thu Jun 2 11:43:37 2011 +0200 [info] pathfinding don't give nan when it is in invalid situation commit 51a2b998f311f37d80faa1a6e3154ec59fb78fd8 Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 09:52:10 2011 +0200 [krobot_hub] better handling of errors commit f996695c754fadf4a5ab183549f73e8d7adeaf1d Author: Nicolas Dandrimont <Nic...@cr...> Date: Thu Jun 2 09:48:48 2011 +0200 [control2011] Update the Sensor_Actuator board messages commit a60c1722847b46333113b4824b7776aa87936a9a Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 08:31:36 2011 +0200 [info] add commands for the elevators commit 06dc02a7d39cd1bbef4d6841097135f41a064971 Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 08:02:07 2011 +0200 [info] start homologuation program commit b95e2ac49537041b9fe76bf1db69a2c26ccc7cfe Author: Nicolas Dandrimont <Nic...@cr...> Date: Thu Jun 2 09:28:03 2011 +0200 [Sensor_Actuator] Add AX-12 processing commit 2c975f20991be791d7e86dced5fc182c4287d7f0 Author: Nicolas Dandrimont <Nic...@cr...> Date: Thu Jun 2 05:25:56 2011 +0200 [meca] Support de balise plus épais commit c28241399972b072537bae9c73a19b999ace17be Author: Xavier Lagorce <Xav...@cr...> Date: Thu Jun 2 08:28:34 2011 +0200 [Controller_Motor_STM32/Effectors] Added can messages for lift command commit 06392258468fa1238e3555db960cd75b09a28e81 Author: Xavier Lagorce <Xav...@cr...> Date: Thu Jun 2 04:20:10 2011 +0200 [Controller_Motor_STM32/Effectors] Refactored lift_controller code. Now uses homing for bottom and up. commit e349d8f7e8a74cb7436f9e292180c7b12c210f69 Merge: 6e293aee63a51caa184477fa263a876bafa1f71f 752ea3cb1fbadd518d490e725a127eff6ead49f2 Author: Stephane Glondu <st...@gl...> Date: Thu Jun 2 03:43:20 2011 +0200 Merge remote-tracking branch 'eeepc/master' commit 752ea3cb1fbadd518d490e725a127eff6ead49f2 Author: Olivier BICHLER <oli...@gm...> Date: Thu Jun 2 03:24:22 2011 +0200 [Sensor_Actuator] Fixes and additions by bibiche. commit fdf21325685b6d202aa167d559ae502d76bb65e1 Author: Nicolas Dandrimont <Nic...@cr...> Date: Wed Jun 1 17:42:12 2011 +0200 [Sensor_Actuator] Update switch config commit 59373c990c400c44f3214d1ff2e43b3a5b01a708 Author: Nicolas Dandrimont <Nic...@cr...> Date: Wed Jun 1 17:41:34 2011 +0200 [Sensor_Actuator] CAN configuration commit 1d95af89a718001da9a730643476e8215b2548c9 Author: Xavier Lagorce <Xav...@cr...> Date: Thu Jun 2 03:06:48 2011 +0200 [Controller_Motor_STM32/Effectors] Initial import of working lift controller code commit d7edbd72e9edfd86072f4ea657ed95cca0c816ee Author: Xavier Lagorce <Xav...@cr...> Date: Thu Jun 2 02:41:49 2011 +0200 [Controller_Motor_STM32/Propulsion_Drive] Prevent Bezier curve parameter to be bigger than 1 commit 6e293aee63a51caa184477fa263a876bafa1f71f Author: chambart <cha...@cr...> Date: Thu Jun 2 00:45:39 2011 +0200 [vision] beginning opencv ocaml binding commit 5be42dcf5fd15446cbaea97c894117afe32d6f33 Author: Jérémie Dimino <je...@di...> Date: Thu Jun 2 00:08:12 2011 +0200 [info] add Krobot_path commit 276b192e754122dbc1b84c2b80ca0290b8901d84 Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 22:56:13 2011 +0200 [krobot_webcam] add a fourth parameter to krobot-find-objects commit 3d7abff0b47dfc753b022e807926319c234f60d2 Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 22:55:04 2011 +0200 [vision] add parsing of the homography matrix commit 2eba87a8645c11f9aad9c4605f7ebe63dfc3ad4d Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 22:37:04 2011 +0200 [info] add a service to convert raw sharps data commit 62378cac5d536830654e5d132b0581ddf680de46 Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 22:18:00 2011 +0200 [info] add a program to calibrate the sharps commit b3f3a19d35c2e91ada6035f1cf7c77fa45948c6a Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 19:52:08 2011 +0200 [krobot_planner] fix smart goto commit c19e9d21d23a0a7102db38745c8673a718a9a9bc Author: Jérémie Dimino <je...@di...> Date: Wed Jun 1 18:25:01 2011 +0200 [krobot_planner] handle the beacon in trajectory planning ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages.h b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages.h index 81a44c2..3fe2b50 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages.h +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages.h @@ -32,6 +32,7 @@ #define CAN_MSG_CONTROLLER_MODE 205 // controller_mode_can_msg_t #define CAN_MSG_BEZIER_ADD 206 // bezier_can_msg_t +#define CAN_MSG_LIFT_CMD 231 // lift_cmd_msg_t /* +-----------------------------------------------------------------+ | CAN messages data structures | +-----------------------------------------------------------------+ */ @@ -107,6 +108,11 @@ typedef struct { uint8_t mode; } controller_mode_msg_t; +// Lift command position, a value is ignored if < 0 +typedef struct { + float front_lift __attribute__((__packed__)); + float back_lift __attribute__((__packed__)); +} lift_cmd_msg_t; /* +-----------------------------------------------------------------+ | CAN messages unions for data representation | @@ -162,5 +168,9 @@ typedef union { uint32_t data32[2]; } controller_mode_can_msg_t; +typedef union { + lift_cmd_msg_t data; + uint32_t data32[2]; +} lift_cmd_can_msg_t; #endif /* __CAN_MESSAGES_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages_sensors.h b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages_sensors.h new file mode 100644 index 0000000..512077e --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_messages_sensors.h @@ -0,0 +1,154 @@ +/** + * Sensor-Actuator board messages + * + * Header file for the Sensor and Actuator CAN messages + * + * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> + * Authors: Nicolas Dandrimont <ol...@cr...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef CAN_MESSAGES_H__ +#define CAN_MESSAGES_H__ + +/** + * Message IDs + */ + +// Beacon + +#define CAN_BEACON_POSITION 301 // beacon_position +#define CAN_BEACON_LOWLEVEL_POSITION 302 // beacon_lowlevel_position +#define CAN_BEACON_CALIBRATION 303 // beacon_calibration + +// Switches + +#define CAN_SWITCH_STATUS_1 311 // switch_status +#define CAN_SWITCH_STATUS_2 312 // switch_status +#define CAN_SWITCH_SET 313 // switch_request + + +// ADC + +#define CAN_ADC_VALUES_1 321 // adc_values +#define CAN_ADC_VALUES_2 322 // adc_values + + +/****************************************************************************/ + +/** + * Message Packets + */ + +/** + * Beacon messages + */ + +// Position of the opponent +struct beacon_position_pkt { + uint16_t angle; // in 1/10000th of radians [0; 2*Pi[ + uint16_t distance; // in mm [0; 65536[ + uint16_t period; // in 1/10000th of seconds [0; 1[ +} __attribute__((packed)); + + + +// Beacon low-level position +struct beacon_lowlevel_position_pkt { + uint16_t angle; // in 1/10000th of radians [0; 2*Pi[ + uint16_t width; // in 1/100000th of radians [0; Pi/5[ + uint32_t period; // in timer ticks +} __attribute__((packed)); + + + +// Beacon calibration +struct beacon_calibration_pkt { + uint16_t width; // in 1/100000th of radians [0; Pi/5[ + uint16_t distance; // in mm [0; 65536[ +} __attribute__((packed)); + + +/** + * Switch messages + */ + +// Switch status +struct switch_status_pkt { + uint8_t sw1; + uint8_t sw2; + uint8_t sw3; + uint8_t sw4; + uint8_t sw5; + uint8_t sw6; + uint8_t sw7; + uint8_t sw8; +}; + +// Switch request +struct switch_request_pkt { + uint8_t num; + uint8_t state; +}; + +/** + * ADC messages + */ +// ADC Values +struct adc_values_pkt { + uint16_t val1; + uint16_t val2; + uint16_t val3; + uint16_t val4; +} __attribute__((packed)); + +/****************************************************************************/ + +/** + * Typedefs + */ + +typedef union { + struct beacon_position_pkt p; + uint32_t d[2]; +} beacon_position; + +typedef union { + struct beacon_lowlevel_position_pkt p; + uint32_t d[2]; +} beacon_lowlevel_position; + +typedef union { + struct beacon_calibration_pkt p; + uint32_t d[2]; +} beacon_calibration; + +typedef union { + struct switch_status_pkt p; + uint32_t d[2]; +} switch_status; + +typedef union { + struct switch_request_pkt p; + uint32_t d[2]; +} switch_request; + +typedef union { + struct adc_values_pkt p; + uint32_t d[2]; +} adc_values; + +#endif diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.c b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.c index c8bcb2b..43913c8 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.c @@ -45,13 +45,7 @@ void canMonitorInit(void) { static void NORETURN canMonitor_process(void) { encoder_can_msg_t msg_enc; - motor_can_msg_t msg_mot; - odometry_can_msg_t msg_odo; - ghost_can_msg_t msg_ghost; - status_can_msg_t status_msg; can_tx_frame txm; - robot_state_t odometry; - float u; Timer timer_can; // Initialize constant parameters of TX frame @@ -77,63 +71,6 @@ static void NORETURN canMonitor_process(void) { txm.eid = CAN_MSG_ENCODERS34; can_transmit(CAND1, &txm, ms_to_ticks(10)); - // Sending odometry data if not in HIL mode or motor commands if in HIL mode - /*if (mode != ROBOT_MODE_HIL) { - odo_getState(&odometry); - msg_odo.data.x = (int16_t)(odometry.x * 1000.0); - msg_odo.data.y = (int16_t)(odometry.y * 1000.0); - odometry.theta = fmodf(odometry.theta, 2*M_PI); - if (odometry.theta > M_PI) - odometry.theta -= 2*M_PI; - if (odometry.theta < -M_PI) - odometry.theta += 2*M_PI; - msg_odo.data.theta = (int16_t)(odometry.theta * 10000.0); - - txm.data32[0] = msg_odo.data32[0]; - txm.data32[1] = msg_odo.data32[1]; - txm.eid = CAN_MSG_ODOMETRY; - can_transmit(CAND1, &txm, ms_to_ticks(10)); - } else { - // Sending MOTOR3 data - msg_mot.data.position = mc_getPosition(MOTOR3); - msg_mot.data.speed = mc_getSpeed(MOTOR3); - - txm.data32[0] = msg_mot.data32[0]; - txm.data32[1] = msg_mot.data32[1]; - txm.eid = CAN_MSG_MOTOR3; - can_transmit(CAND1, &txm, ms_to_ticks(10)); - - // Sending MOTOR4 data - msg_mot.data.position = mc_getPosition(MOTOR4); - msg_mot.data.speed = mc_getSpeed(MOTOR4); - - txm.data32[0] = msg_mot.data32[0]; - txm.data32[1] = msg_mot.data32[1]; - txm.eid = CAN_MSG_MOTOR4; - can_transmit(CAND1, &txm, ms_to_ticks(10)); - } - - // Wait before sending the other packets - timer_waitEvent(&timer_can); - timer_add(&timer_can);*/ - - // Sending ghost state - /*msg_ghost.data.state = dd_get_ghost_state(&odometry, &u); - msg_ghost.data.x = (int16_t)(odometry.x * 1000.0); - msg_ghost.data.y = (int16_t)(odometry.y * 1000.0); - msg_ghost.data.theta = (int16_t)(odometry.theta * 10000.0); - msg_ghost.data.u = (uint8_t)(u * 255); - txm.data32[0] = msg_ghost.data32[0]; - txm.data32[1] = msg_ghost.data32[1]; - txm.eid = CAN_MSG_GHOST; - can_transmit(CAND1, &txm, ms_to_ticks(10)); - - status_msg.data.is_moving = tc_is_working(MOTOR1 | MOTOR2 | MOTOR3 | MOTOR4); - txm.data32[0] = status_msg.data32[0]; - txm.data32[1] = status_msg.data32[1]; - txm.eid = CAN_MSG_STATUS; - can_transmit(CAND1, &txm, ms_to_ticks(10));*/ - // Wait for the next transmission timer timer_waitEvent(&timer_can); } @@ -144,14 +81,12 @@ static void NORETURN canMonitorListen_process(void) { can_rx_frame frame; bool received = false; can_tx_frame txm; - robot_state_t odometry; + uint8_t end_stops; - move_can_msg_t move_msg; - turn_can_msg_t turn_msg; - odometry_can_msg_t odometry_msg; - stop_can_msg_t stop_msg; - controller_mode_can_msg_t controller_mode_msg; - bezier_can_msg_t bezier_msg; + //controller_mode_can_msg_t controller_mode_msg; + + switch_status end_courses_msg; + lift_cmd_can_msg_t lift_cmd_msg; // Initialize constant parameters of TX frame txm.dlc = 8; @@ -171,50 +106,7 @@ static void NORETURN canMonitorListen_process(void) { } else { // Handle commands and other informations switch (frame.eid) { - case CAN_MSG_MOVE: - move_msg.data32[0] = frame.data32[0]; - move_msg.data32[1] = frame.data32[1]; - if (!tc_is_working(TC_MASK(DD_LINEAR_SPEED_TC) | TC_MASK(DD_ROTATIONAL_SPEED_TC))) - dd_move(move_msg.data.distance / 1000.0, move_msg.data.speed / 1000.0, move_msg.data.acceleration / 1000.0); - break; - case CAN_MSG_TURN: - turn_msg.data32[0] = frame.data32[0]; - turn_msg.data32[1] = frame.data32[1]; - if (!tc_is_working(TC_MASK(DD_LINEAR_SPEED_TC) | TC_MASK(DD_ROTATIONAL_SPEED_TC))) - dd_turn(turn_msg.data.angle / 10000.0, turn_msg.data.speed / 1000.0, turn_msg.data.acceleration / 1000.0); - break; - case CAN_MSG_BEZIER_ADD: - bezier_msg.data32[0] = frame.data32[0]; - bezier_msg.data32[1] = frame.data32[1]; - dd_add_bezier(bezier_msg.data.x_end/1000.0, bezier_msg.data.y_end/1000.0, - bezier_msg.data.d1/100.0, bezier_msg.data.d2/100.0, - bezier_msg.data.theta_end/100.0, bezier_msg.data.v_end/1000.0); - break; - case CAN_MSG_STOP: - stop_msg.data32[0] = frame.data32[0]; - stop_msg.data32[1] = frame.data32[1]; - dd_interrupt_trajectory(stop_msg.data.rot_acc, stop_msg.data.lin_acc); - break; - case CAN_MSG_ODOMETRY_SET: - odometry_msg.data32[0] = frame.data32[0]; - odometry_msg.data32[1] = frame.data32[1]; - odometry.x = ((float)odometry_msg.data.x) / 1000.0; - odometry.y = ((float)odometry_msg.data.y) / 1000.0; - odometry.theta = ((float)odometry_msg.data.theta) / 10000.0; - odo_setState(&odometry); - break; - case CAN_MSG_ODOMETRY: - // We should only receive such message in HIL mode - if (mode == ROBOT_MODE_HIL) { - odometry_msg.data32[0] = frame.data32[0]; - odometry_msg.data32[1] = frame.data32[1]; - odometry.x = ((float)odometry_msg.data.x) / 1000.0; - odometry.y = ((float)odometry_msg.data.y) / 1000.0; - odometry.theta = ((float)odometry_msg.data.theta) / 10000.0; - odo_setState(&odometry); - } - break; - case CAN_MSG_CONTROLLER_MODE: + /*case CAN_MSG_CONTROLLER_MODE: controller_mode_msg.data32[0] = frame.data32[0]; controller_mode_msg.data32[1] = frame.data32[0]; if (controller_mode_msg.data.mode == 1) { @@ -228,6 +120,27 @@ static void NORETURN canMonitorListen_process(void) { odo_restart(); mode = ROBOT_MODE_NORMAL; } + break;*/ + case CAN_SWITCH_STATUS_1: + end_courses_msg.d[0] = frame.data32[0]; + end_courses_msg.d[1] = frame.data32[1]; + end_stops = 0; + if (!end_courses_msg.p.sw3) + end_stops |= LC_BACK_BOTTOM; + if (!end_courses_msg.p.sw4) + end_stops |= LC_BACK_UP; + lc_end_stop_reached(end_stops); + //if (end_courses_msg.p.sw1) { + // lc_release(); + // motorSetSpeed(MOTOR2,0); + break; + case CAN_MSG_LIFT_CMD: + lift_cmd_msg.data32[0] = frame.data32[0]; + lift_cmd_msg.data32[1] = frame.data32[1]; + if (lift_cmd_msg.data.front_lift >= 0) + lc_goto_position(LC_FRONT_LIFT, lift_cmd_msg.data.front_lift); + if (lift_cmd_msg.data.back_lift >= 0) + lc_goto_position(LC_BACK_LIFT, lift_cmd_msg.data.back_lift); break; } } diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.h b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.h index da6ad7f..c55f124 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.h +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/can_monitor.h @@ -19,6 +19,8 @@ #include "odometry.h" #include "differential_drive.h" #include "can_messages.h" +#include "can_messages_sensors.h" +#include "lift_controller.h" void canMonitorInit(void); diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/controller_motor_stm32_user.mk b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/controller_motor_stm32_user.mk index bd55ecc..56ea826 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/controller_motor_stm32_user.mk +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/controller_motor_stm32_user.mk @@ -20,6 +20,7 @@ controller_motor_stm32_USER_CSRC = \ $(controller_motor_stm32_SRC_PATH)/bezier_utils.c \ $(controller_motor_stm32_SRC_PATH)/differential_drive.c \ $(controller_motor_stm32_SRC_PATH)/can_monitor.c \ + $(controller_motor_stm32_SRC_PATH)/lift_controller.c \ $(controller_motor_stm32_SRC_PATH)/main.c \ # diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/differential_drive.c b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/differential_drive.c index 179db7f..b566a84 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/differential_drive.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/differential_drive.c @@ -252,14 +252,14 @@ command_generator_t* dd_get_right_wheel_generator(void) { void dd_move(float distance, float speed, float acceleration) { if (params.enabled) { params.last_lin_acceleration = acceleration; - tc_goto(DD_LINEAR_SPEED_TC, distance, speed, params.last_lin_acceleration); + tc_move(DD_LINEAR_SPEED_TC, distance, speed, params.last_lin_acceleration); } } void dd_turn(float angle, float speed, float acceleration) { if (params.enabled) { params.last_rot_acceleration = acceleration; - tc_goto(DD_ROTATIONAL_SPEED_TC, angle, speed, params.last_rot_acceleration); + tc_move(DD_ROTATIONAL_SPEED_TC, angle, speed, params.last_rot_acceleration); } } diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.c b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.c new file mode 100644 index 0000000..56cb686 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.c @@ -0,0 +1,139 @@ +/* + * lift_controller.c + * ----------------- + * Copyright : (c) 2011, Xavier Lagorce <Xav...@cr...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + */ + +#include "lift_controller.h" + +#define DIR_UP 0 +#define DIR_DOWN 1 + +typedef struct { + uint8_t enabled, tc_ind; + int8_t direction; + float bottom, extend; + uint8_t end_stop_ind; +} lc_state_t; + +lc_state_t lc_state[2]; + +float pos2angle(uint8_t lift, float position); + +float pos2angle(uint8_t lift, float position) { + + //return lc_state[lift].offset - position / 23.474; + return lc_state[lift].bottom + lc_state[lift].extend*position; +} + +void lc_init(void) { + motor_controller_params_t params; + int i; + + // Init state + for (i=0; i<2; i++) { + lc_state[i].enabled = 1; + lc_state[i].direction = -1; + lc_state[i].bottom = 0; + lc_state[i].extend = 0; + lc_state[i].end_stop_ind = 0; + } + lc_state[LC_FRONT_LIFT].tc_ind = LC_TC_FRONT; + lc_state[LC_BACK_LIFT].tc_ind = LC_TC_BACK; + + // Init Trajectory controllers + tc_new_controller(LC_TC_FRONT); + tc_new_controller(LC_TC_BACK); + // Limit PWM value + motorSetMaxPWM(MOTOR3, 1600); + motorSetMaxPWM(MOTOR4, 1600); + // Common parameters + params.encoder_gain = 2.0*M_PI/588.0; + params.G0 = 0.0035; + params.tau = 0.025; + params.k[0] = -10216; + params.k[1] = -255.39; + params.l = -params.k[0]; + params.l0[0] = 0.0091; + params.l0[1] = 1.6361; + params.T = 0.005; + // Initialize front lift + params.motor = MOTOR4; + params.encoder = ENCODER4; + mc_new_controller(¶ms, tc_get_position_generator(LC_TC_FRONT), CONTROLLER_MODE_NORMAL); + // Initialize back lift + params.motor = MOTOR3; + params.encoder = ENCODER3; + mc_new_controller(¶ms, tc_get_position_generator(LC_TC_BACK), CONTROLLER_MODE_NORMAL); +} + +void lc_end_stop_reached(uint8_t end_stops) { + + // Set the end stop indicators and stop the lift if needed + if ((end_stops & LC_FRONT_UP) || (end_stops & LC_FRONT_BOTTOM)) { + if ((end_stops & LC_FRONT_UP) && (lc_state[LC_FRONT_LIFT].direction == 1)) + tc_stop(LC_TC_FRONT); + if ((end_stops & LC_FRONT_BOTTOM) && (lc_state[LC_FRONT_LIFT].direction == -1)) + tc_stop(LC_TC_FRONT); + lc_state[LC_FRONT_LIFT].end_stop_ind = end_stops & (LC_FRONT_UP|LC_FRONT_BOTTOM); + } + if ((end_stops & LC_BACK_UP) || (end_stops & LC_BACK_BOTTOM)) { + if ((end_stops & LC_BACK_UP) && (lc_state[LC_BACK_LIFT].direction == 1)) + tc_stop(LC_TC_BACK); + if ((end_stops & LC_BACK_BOTTOM) && (lc_state[LC_BACK_LIFT].direction == -1)) + tc_stop(LC_TC_BACK); + lc_state[LC_BACK_LIFT].end_stop_ind = (end_stops & (LC_BACK_UP|LC_BACK_BOTTOM)) >> 2; + } +} + +void lc_homing(uint8_t lift) { + // Go down + lc_state[lift].direction = -1; + tc_goto_speed(lc_state[lift].tc_ind, M_PI/4, 1); + // Wait for the end stop to trigger + while (!(lc_state[lift].end_stop_ind & LC_BOTTOM)) + cpu_relax(); + // Stop the lift + tc_stop(lc_state[lift].tc_ind); + // Assert end stop + lc_state[lift].end_stop_ind &= ~LC_BOTTOM; + // Wait and get current generator position as offset + timer_delay(50); + lc_state[lift].bottom = get_output_value(tc_get_position_generator(lc_state[lift].tc_ind)); + + // Go up + lc_state[lift].direction = 1; + tc_goto_speed(lc_state[lift].tc_ind, -M_PI/4, 1); + // Wait for the end stop to trigger + while (!(lc_state[lift].end_stop_ind & LC_UP)) + cpu_relax(); + // Stop the lift + tc_stop(lc_state[lift].tc_ind); + // Assert end stop + lc_state[lift].end_stop_ind &= ~LC_UP; + // Wait and get current generator position as offset + timer_delay(50); + lc_state[lift].extend = get_output_value(tc_get_position_generator(lc_state[lift].tc_ind)) - lc_state[lift].bottom; +} + +void lc_goto_position(uint8_t lift, float position) { + float goal = pos2angle(lift, position); + + if (goal > get_output_value(tc_get_position_generator(lc_state[lift].tc_ind))) { + lc_state[lift].direction = -1; + } else { + lc_state[lift].direction = 1; + } + tc_goto(lift, goal, M_PI, 5); +} + +void lc_release(void) { + mc_delete_controller(MOTOR3); + mc_delete_controller(MOTOR4); + + lc_state[LC_FRONT_LIFT].enabled = 0; + lc_state[LC_BACK_LIFT].enabled = 0; +} diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.h b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.h new file mode 100644 index 0000000..717c8cc --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/lift_controller.h @@ -0,0 +1,41 @@ +/* + * lift_controller.h + * ----------------- + * Copyright : (c) 2011, Xavier Lagorce <Xav...@cr...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + */ + +#ifndef __LIFT_CONTROLLER_H +#define __LIFT_CONTROLLER_H + +#include "motor_controller.h" +#include "trajectory_controller.h" +#include "command_generator.h" + +#define LC_FRONT_LIFT 0 +#define LC_BACK_LIFT 1 + +#define LC_FRONT_UP 1 +#define LC_FRONT_BOTTOM 2 +#define LC_BACK_UP 4 +#define LC_BACK_BOTTOM 8 + +#define LC_UP 1 +#define LC_BOTTOM 2 + +#define LC_POSITION_BOTTOM 1 +#define LC_POSITION_MIDDLE 2 +#define LC_POSITION_UP 4 + +#define LC_TC_FRONT 0 +#define LC_TC_BACK 1 + +void lc_init(void); +void lc_end_stop_reached(uint8_t end_stops); +void lc_homing(uint8_t lift); +void lc_goto_position(uint8_t lift, float position); +void lc_release(void); + +#endif /* __LIFT_CONTROLLER_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/main.c b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/main.c index b769991..f906450 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/main.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/main.c @@ -21,8 +21,6 @@ PROC_DEFINE_STACK(stack_ind, KERN_MINSTACKSIZE * 2); static void init(void) { - motor_controller_params_t params; - IRQ_ENABLE; /* Initialize debugging module (allow kprintf(), etc.) */ @@ -36,38 +34,25 @@ static void init(void) */ proc_init(); - // Initialize CONTROL driver (will initialize MOTOR and ENCODER subsystems) - motorControllerInit(); - // Initialize CAN_MONITOR canMonitorInit(); - // Start control of drive motors + // Initialize CONTROL driver (will initialize MOTOR and ENCODER subsystems) + motorControllerInit(); + // Initialize Command generator tc_init(); - tc_new_controller(0); - tc_new_controller(1); - motorSetMaxPWM(MOTOR4, 1600); + // Initialize Lift Controller + lc_init(); + + // Init lifts + lc_homing(LC_BACK_LIFT); + lc_goto_position(LC_BACK_LIFT, 0.5); + while(tc_is_working(TC_MASK(LC_TC_BACK))) + timer_delay(100); + // Setup Beacon's motor motorSetMaxPWM(MOTOR2, 1080); enableMotor(MOTOR2); - // Common parameters - params.encoder_gain = 2.0*M_PI/588.0; - params.G0 = 0.0035; - params.tau = 0.025; - params.k[0] = -10216; - params.k[1] = -255.39; - params.l = -params.k[0]; - params.l0[0] = 0.0091; - params.l0[1] = 1.6361; - params.T = 0.005; - // Initialize forward lift - params.motor = MOTOR4; - params.encoder = ENCODER4; - //mc_new_controller(¶ms, tc_get_position_generator(0), CONTROLLER_MODE_NORMAL); - // Initialize backward lift - params.motor = MOTOR3; - params.encoder = ENCODER3; - //mc_new_controller(¶ms, tc_get_position_generator(1), CONTROLLER_MODE_NORMAL); // Blink to say we are ready for (uint8_t i=0; i < 5; i++) { @@ -87,22 +72,16 @@ static void init(void) static void NORETURN ind_process(void) { while(1) { - LED4_ON(); - tc_goto(0, 50/23.475, M_PI, 5); - while(tc_is_working(TC_MASK(0))) + LED1_ON(); + lc_goto_position(LC_BACK_LIFT, 1.); + while(tc_is_working(TC_MASK(LC_TC_BACK))) timer_delay(100); - timer_delay(500); - LED4_OFF(); - tc_goto(0, -50/23.475, M_PI, 5); - while(tc_is_working(TC_MASK(0))) + timer_delay(1000); + LED1_OFF(); + lc_goto_position(LC_BACK_LIFT, 0); + while(tc_is_working(TC_MASK(LC_TC_BACK))) timer_delay(100); - timer_delay(500); - - /*if (dd_get_ghost_state(NULL, NULL) == DD_GHOST_MOVING) { - LED1_ON(); - } else { - LED1_OFF(); - }*/ + timer_delay(1000); } } @@ -114,7 +93,6 @@ int main(void) //proc_new(ind_process, NULL, sizeof(stack_ind), stack_ind); // Tests - //motorSetSpeed(MOTOR4, 400); motorSetSpeed(MOTOR2, 1000); /* diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.c b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.c index 2ae2d4f..ef59d93 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.c @@ -214,6 +214,23 @@ command_generator_t* tc_get_speed_generator(uint8_t cntr_index) { } void tc_goto(uint8_t cntr_index, float angle, float speed, float acceleration) { + trajectory_controller_t *cont; + + // Verify parameters + if (angle == 0 || speed <= 0 || acceleration <= 0) + return; + + // Get the controller and verifies it is enabled + if (cntr_index >= NUM_TC_MAX) + return; + cont = &controllers[cntr_index]; + if (!cont->enabled) + return; + + tc_move(cntr_index, angle - get_output_value(&cont->position), speed, acceleration); +} + +void tc_move(uint8_t cntr_index, float angle, float speed, float acceleration) { float acc_dist, t_acc, t_end; trajectory_controller_t *cont; @@ -321,46 +338,26 @@ void tc_set_speed(uint8_t cntr_index, float speed) { cont->working = 0; } +void tc_stop(uint8_t cntr_index) { + trajectory_controller_t *cont; + // Get the controller and verifies it is enabled + if (cntr_index >= NUM_TC_MAX) + return; + cont = &controllers[cntr_index]; + if (!cont->enabled) + return; -void tc_move(tc_robot_t *robot, float distance, float speed, float acceleration) { - float dis_s, spe_s, acc_s; - - // Let's pause the wheel's speed generators to synchronize movement start - pause_generator(&controllers[robot->left_wheel].speed); - pause_generator(&controllers[robot->right_wheel].speed); - - // Compute parameters - dis_s = distance / robot->wheel_radius; - spe_s = speed / robot->wheel_radius; - acc_s = acceleration / robot->wheel_radius; + // Disable a possibly running profile + cont->aut.state = TRAPEZOID_STATE_STOP; + remove_callback(&cont->position); + remove_callback(&cont->speed); - // Planify movements - tc_goto(robot->left_wheel, dis_s, spe_s, acc_s); - tc_goto(robot->right_wheel, dis_s, spe_s, acc_s); + // Stop generator evolution + adjust_speed(&cont->speed, 0.); + adjust_value(&cont->speed, 0.); - // Go - start_generator(&controllers[robot->left_wheel].speed); - start_generator(&controllers[robot->right_wheel].speed); + // Trajectory controller is not working anylonger + cont->working = 0; } -void tc_turn(tc_robot_t *robot, float angle, float speed, float acceleration) { - float angle_s, spe_s, acc_s; - - // Let's pause the wheel's speed generators to synchronize movement start - pause_generator(&controllers[robot->left_wheel].speed); - pause_generator(&controllers[robot->right_wheel].speed); - - // Compute parameters - angle_s = angle * robot->shaft_width / 2.0 / robot->wheel_radius; - spe_s = speed * robot->shaft_width / 2.0 / robot->wheel_radius; - acc_s = acceleration * robot->shaft_width / 2.0 / robot->wheel_radius; - - // Planify movements - tc_goto(robot->left_wheel, -angle_s, spe_s, acc_s); - tc_goto(robot->right_wheel, angle_s, spe_s, acc_s); - - // Go - start_generator(&controllers[robot->left_wheel].speed); - start_generator(&controllers[robot->right_wheel].speed); -} diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.h b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.h index cf8452d..ba4df32 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.h +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Effectors/controller_motor_stm32/trajectory_controller.h @@ -61,6 +61,13 @@ command_generator_t* tc_get_position_generator(uint8_t cntr_index); */ command_generator_t* tc_get_speed_generator(uint8_t cntr_index); +/* Moves to a given angle + * - angle : angle to move to. The units corresponds to the given scaling factor + * during initialization. + * - speed : moving speed (in units per second) should be positive. + * - acceleration : in units per second per second, should be positive. + */ +void tc_goto(uint8_t cntr_index, float angle, float speed, float acceleration); /* Moves of a given angle * - angle : angle to move of, can be positive (forward) or negative @@ -69,7 +76,7 @@ command_generator_t* tc_get_speed_generator(uint8_t cntr_index); * - speed : moving speed (in units per second) should be positive. * - acceleration : in units per second per second, should be positive. */ -void tc_goto(uint8_t cntr_index, float angle, float speed, float acceleration); +void tc_move(uint8_t cntr_index, float angle, float speed, float acceleration); /* Accelerates or brakes the robot to the given speed * @@ -81,22 +88,9 @@ void tc_goto_speed(uint8_t cntr_index, float speed, float acceleration); */ void tc_set_speed(uint8_t cntr_index, float speed); -/* Moves along a line - * - robot : pointer to a structure describing the robot configuration - * - distance : distance to move of (in meters), can be positive (forward) - * or negative (backward). - * - speed : moving speed (in meters per second) should be positive. - * - acceleration : in meters per second per second, should be positive. - */ -void tc_move(tc_robot_t *robot, float distance, float speed, float acceleration); - -/* Turns around the propulsion shaft center - * - robot : pointer to a structure describing the robot configuration - * - angle : angle to turn of (in degrees), can be positive (CCW) - * or negative (CW). - * - speed : turning speed (in degrees per second) should be positive. - * - acceleration : in degrees per second per second, should be positive. +/* + * Stops the current movement by keeping the current value */ -void tc_turn(tc_robot_t *robot, float angle, float speed, float acceleration); +void tc_stop(uint8_t cntr_index); #endif /* __TRAJECTORY_CONTROLLER_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/differential_drive.c b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/differential_drive.c index 179db7f..ea27a98 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/differential_drive.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/differential_drive.c @@ -87,6 +87,8 @@ static void NORETURN traj_following_process(void) { params.working = 0; traj->initialized = 0; traj->enabled = 0; + if (params.u > 1.0) + params.u = 1.0; if (!params.trajs[next_traj].initialized) { // We have no other trajectory to follow, let's brake dd_set_rotational_speed(0., params.at_max); diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/Makefile b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/Makefile new file mode 100644 index 0000000..174ec1b --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni <du...@de...> +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include test_ax12/test_ax12.mk + +include bertos/rules.mk diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/VERSION b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/VERSION new file mode 100644 index 0000000..e520145 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/VERSION @@ -0,0 +1 @@ +BeRTOS 2.6.99 [local copy] diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.c b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.c new file mode 100644 index 0000000..d4293f9 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.c @@ -0,0 +1,102 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC table and support routines + * + * \author Bernie Innocenti <be...@co...> + */ + +#include "crc.h" + +/* + * The boot on AVR cpu is placed at the end of flash memory, but the avr + * address memory by byte and the pointers are 16bits long, so we are able + * to address 64Kbyte memory max. For this reason we can't read the crctab + * from flash, because it is placed at the end of memory. This is true every + * time we have an AVR cpu with more that 64Kbyte of flash. To fix this problem + * we let the compiler copy the table in RAM at startup. Obviously this solution + * is not efficent, but for now this is the only way. + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define CRC_TABLE const uint16_t PROGMEM crc16tab[256] +#else + #define CRC_TABLE const uint16_t crc16tab[256] +#endif + +/** + * crctab calculated by Mark G. Mendel, Network Systems Corporation + */ +CRC_TABLE = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + +uint16_t crc16(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while(len--) + crc = UPDCRC16(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.h b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.h new file mode 100644 index 0000000..c5c1eef --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief Cyclic Redundancy Check 16 (CRC). This algorithm is the one used by the XMODEM protocol. + * + * \note This algorithm is incompatible with the CCITT-CRC16. + * + * This code is based on the article Copyright 1986 Stephen Satchell. + * + * Programmers may incorporate any or all code into their programs, + * giving proper credit within the source. Publication of the + * source routines is permitted so long as proper credit is given + * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, + * Omen Technology. + * + * \author Bernie Innocenti <be...@co...> + * + * $WIZ$ module_name = "crc16" + */ + +#ifndef ALGO_CRC_H +#define ALGO_CRC_H + +#include "cfg/cfg_arch.h" + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc16tab[256]; + + +/** + * \brief Compute the updated CRC16 value for one octet (macro version) + * + * \note This version is only intended for old/broken compilers. + * Use the inline function in new code. + * + * \param c New octet (range 0-255) + * \param oldcrc Previous CRC16 value (referenced twice, beware of side effects) + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define UPDCRC16(c, oldcrc) (pgm_read_uint16_t(&crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#else + #define UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#endif + +/** CRC-16 init value */ +#define CRC16_INIT_VAL ((uint16_t)0) + +#ifdef INLINE +/** + * \brief Compute the updated CRC16 value for one octet (inline version) + */ +INLINE uint16_t updcrc16(uint8_t c, uint16_t oldcrc) +{ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + return pgm_read_uint16_t(&crc16tab[(oldcrc >> 8) ^ c]) ^ (oldcrc << 8); +#else + return crc16tab[(oldcrc >> 8) ^ c] ^ (oldcrc << 8); +#endif +} +#endif // INLINE + + +/** + * This function implements the CRC 16 calculation on a buffer. + * + * \param crc Current CRC16 value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC16 value. + */ +extern uint16_t crc16(uint16_t crc, const void *buf, size_t len); + +int crc_testSetup(void); +int crc_testRun(void); +int crc_testTearDown(void); + +EXTERN_C_END + +#endif /* ALGO_CRC_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.c b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.c new file mode 100644 index 0000000..feaf624 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.c @@ -0,0 +1,83 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" + +const uint16_t PROGMEM crc_ccitt_tab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, +}; + +uint16_t crc_ccitt(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while (len--) + crc = updcrc_ccitt(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.h b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.h new file mode 100644 index 0000000..240e6e1 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_ccitt.h @@ -0,0 +1,78 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CCITT Cyclic Redundancy Check (CRC-CCITT). + * + * \note This algorithm is incompatible with the CRC16. + * + * \author Francesco Sacchi <ba...@de...> + * + * $WIZ$ module_name = "crc-ccitt" + */ + +#ifndef ALGO_CRC_CCITT_H +#define ALGO_CRC_CCITT_H + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc_ccitt_tab[256]; + +/** + * \brief Compute the updated CRC-CCITT value for one octet (inline version) + */ +INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) +{ + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); +} + +/** CRC-CCITT init value */ +#define CRC_CCITT_INIT_VAL ((uint16_t)0xFFFF) + + +/** + * This function implements the CRC-CCITT calculation on a buffer. + * + * \param crc Current CRC-CCITT value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC-CCITT value. + */ +extern uint16_t crc_ccitt(uint16_t crc, const void *buf, size_t len); + +EXTERN_C_END + +#endif /* ALGO_CRC_CCITT_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_test.c b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_test.c new file mode 100644 index 0000000..1a93e3b --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/reset_ax12/bertos/algo/crc_test.c @@ -0,0 +1,75 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * temp... [truncated message content] |
From: Pierre C. <Ba...@us...> - 2011-05-31 14:14:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 617b3078e3af5ed2d37e4a380167ef65d924f3ab (commit) via d7fb053a920e6e635455a28769ab678d4b36d82f (commit) from e68d5b4809d5c09a37344baebd657acb2b5d197b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 617b3078e3af5ed2d37e4a380167ef65d924f3ab Author: chambart <cha...@cr...> Date: Tue May 31 16:12:39 2011 +0200 [info] krobot_webcam pass arguments to krobo-find-object commit d7fb053a920e6e635455a28769ab678d4b36d82f Author: chambart <cha...@cr...> Date: Tue May 31 16:08:09 2011 +0200 [info] vision: apply an homography transformation to matched circles ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_webcam.ml b/info/control2011/src/tools/krobot_webcam.ml index b1cf643..83382b9 100644 --- a/info/control2011/src/tools/krobot_webcam.ml +++ b/info/control2011/src/tools/krobot_webcam.ml @@ -29,8 +29,8 @@ let rec parse bus objects ic = parse bus [] ic end else begin (* Otherwise read one and add it to the current list of objects. *) - let cx, cy, w, h, alpha = Scanf.sscanf line "%d %d %d %d %f" (fun cx cy w h alpha -> (cx, cy, w, h, alpha)) in - parse bus ({ x = float cx; y = float cy } :: objects) ic + let cx, cy = Scanf.sscanf line "%f %f" (fun cx cy-> (cx, cy)) in + parse bus ({ x = cx; y = cy } :: objects) ic end (* +-----------------------------------------------------------------+ @@ -81,8 +81,11 @@ lwt () = (* Handle krobot message. *) E.keep (E.map (handle_message bus) (Krobot_bus.recv bus)); + (* for printf to print floats with points and not colons *) + Unix.putenv "LANG" "C"; + (* Launch the objects finder. *) - let process = Lwt_process.open_process_in ("krobot-find-objects", [|"krobot-find-objects"|]) in + let process = Lwt_process.open_process_in ("krobot-find-objects", [|"krobot-find-objects"; Sys.argv.(1); Sys.argv.(2); Sys.argv.(3)|]) in (* Read the first separator. *) lwt _ = Lwt_io.read_line process#stdout in diff --git a/info/vision/coupe2011/findBallse.c b/info/vision/coupe2011/findBallse.c index d5abdb9..988e155 100644 --- a/info/vision/coupe2011/findBallse.c +++ b/info/vision/coupe2011/findBallse.c @@ -35,6 +35,8 @@ IplImage *image01 = 0, *image02 = 0, *image03 = 0, *imCont = 0, *imFill = 0, *im /* Whether to display the result on the screen or not using HighGUI. */ int display = 0; +CvMat* homography; + /* +-----------------------------------------------------------------+ | Config file parsing | +-----------------------------------------------------------------+ */ @@ -112,6 +114,9 @@ void process_image() CvPoint2D32f* PointArray2D32f; int i, j, meanRad; + CvMat* src; + CvMat* dst; + // Changement d'espace de couleur cvCvtColor(image01, imHSV, CV_BGR2HSV); @@ -160,7 +165,7 @@ void process_image() cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor); /* Print a separator. */ - printf("====="); + printf("=====\n"); if (cont) { // Threshold the source image. This needful for cvFindContours(). @@ -214,8 +219,16 @@ void process_image() meanRad = (size.width + size.height) / 2; if (meanRad >= params.minCont && meanRad <= params.maxCont) { + + // tansform matched elipsis to table coordinates + src = cvCreateMat(1, 1, CV_32FC2); + dst = cvCreateMat(1, 1, CV_32FC2); + src->data.fl[0] = (float) center.x; + dst->data.fl[1] = (float) center.y; + cvPerspectiveTransform(point1, point2, homography); + /* Print ellipsis parameters on stdout. */ - printf("%d %d %d %d %f\n", center.x, center.y, size.width, size.height, box->angle); + printf("%f %f\n", dst->data.fl[0], dst->data.fl[1]); if (display) { // Draw current contour. @@ -235,6 +248,8 @@ void process_image() } } + fflush(stdout); + // On libère la mémoire if (display) { free(imCont->roi); @@ -286,6 +301,18 @@ int main( int argc, char** argv ) // Même chose avec l'image pour conversion imHSV = cvCreateImage(cvSize(image01->width,image01->height), IPL_DEPTH_8U, 3); + // create and initialise homograpy matrix + homography = cvCreateMat(3, 3, CV_32F); + homography->data.fl[0] = -0.00109182286542; + homography->data.fl[1] = -0.0570392236114; + homography->data.fl[2] = 7.99883031845; + homography->data.fl[3] = -0.00867976341397; + homography->data.fl[4] = -0.0176480710506; + homography->data.fl[5] = 3.60714673996; + homography->data.fl[6] = -0.000370743422536; + homography->data.fl[7] = -0.0184959284961; + homography->data.fl[8] = 1.0; + while (!quit) { // Récupère une image de la webcam hooks/post-receive -- krobot |
From: Nicolas D. <Ba...@us...> - 2011-05-30 22:24:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 725b1397b56bce4331210dd760924370845ae38c (commit) from 2ee1763a0f7bd92e6e37a25b1e4bf17c0351290d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 725b1397b56bce4331210dd760924370845ae38c Author: Nicolas Dandrimont <Nic...@cr...> Date: Tue May 31 00:23:56 2011 +0200 [control2011] Add the current Sensor_Actuator CAN messages ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_message.ml b/info/control2011/src/lib/krobot_message.ml index d2ee967..7af5a51 100644 --- a/info/control2011/src/lib/krobot_message.ml +++ b/info/control2011/src/lib/krobot_message.ml @@ -23,6 +23,11 @@ type t = | Battery2_voltages of float * float * float * float | Beacon_position of float * float * float | Beacon_lowlevel_position of float * float * int + | Switch1_status of bool * bool * bool * bool * bool * bool * bool * bool + | Switch2_status of bool * bool * bool * bool * bool * bool * bool * bool + | Switch_request of int * bool + | Adc1_values of int * int * int * int + | Adc2_values of int * int * int * int | Encoder_position_direction_1_2 of int * direction * int * direction | Encoder_position_direction_3_4 of int * direction * int * direction | Encoder_position_speed_3 of float * float @@ -74,6 +79,27 @@ let to_string = function angle width period + | Switch1_status(s1, s2, s3, s4, s5, s6, s7, s8) -> + sprintf + "Switch1_status(%B, %B, %B, %B, %B, %B, %B, %B)" + s1 s2 s3 s4 s5 s6 s7 s8 + | Switch2_status(s1, s2, s3, s4, s5, s6, s7, s8) -> + sprintf + "Switch2_status(%B, %B, %B, %B, %B, %B, %B, %B)" + s1 s2 s3 s4 s5 s6 s7 s8 + | Switch_request(switch, status) -> + sprintf + "Switch_request(%d, %s)" + switch + (if status then "ON" else "OFF") + | Adc1_values(v1, v2, v3, v4) -> + sprintf + "Adc1_values(%d, %d, %d, %d)" + v1 v2 v3 v4 + | Adc2_values(v1, v2, v3, v4) -> + sprintf + "Adc2_values(%d, %d, %d, %d)" + v1 v2 v3 v4 | Encoder_position_direction_1_2(pos1, dir1, pos2, dir2) -> sprintf "Encoder_position_direction_1_2(%d, %s, %d, %s)" @@ -292,6 +318,72 @@ let encode = function ~remote:false ~format:F29bits ~data + | Switch1_status(sw1, sw2, sw3, sw4, sw5, sw6, sw7, sw8) -> + let data = String.create 8 in + put_uint8 data 0 (if sw1 then 1 else 0); + put_uint8 data 1 (if sw2 then 1 else 0); + put_uint8 data 2 (if sw3 then 1 else 0); + put_uint8 data 3 (if sw4 then 1 else 0); + put_uint8 data 4 (if sw5 then 1 else 0); + put_uint8 data 5 (if sw6 then 1 else 0); + put_uint8 data 6 (if sw7 then 1 else 0); + put_uint8 data 7 (if sw8 then 1 else 0); + frame + ~identifier:311 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:data + | Switch2_status(sw1, sw2, sw3, sw4, sw5, sw6, sw7, sw8) -> + let data = String.create 8 in + put_uint8 data 0 (if sw1 then 1 else 0); + put_uint8 data 1 (if sw2 then 1 else 0); + put_uint8 data 2 (if sw3 then 1 else 0); + put_uint8 data 3 (if sw4 then 1 else 0); + put_uint8 data 4 (if sw5 then 1 else 0); + put_uint8 data 5 (if sw6 then 1 else 0); + put_uint8 data 6 (if sw7 then 1 else 0); + put_uint8 data 7 (if sw8 then 1 else 0); + frame + ~identifier:312 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:data + | Switch_request(switch, status) -> + let data = String.create 2 in + put_uint8 data 0 switch; + put_uint8 data 1 (if status then 1 else 0); + frame + ~identifier:313 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:data + | Adc1_values(v1, v2, v3, v4) -> + let data = String.create 8 in + put_uint16 data 0 v1; + put_uint16 data 2 v2; + put_uint16 data 4 v3; + put_uint16 data 6 v4; + frame + ~identifier:321 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:data + | Adc2_values(v1, v2, v3, v4) -> + let data = String.create 8 in + put_uint16 data 0 v1; + put_uint16 data 2 v2; + put_uint16 data 4 v3; + put_uint16 data 6 v4; + frame + ~identifier:322 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:data | Battery1_voltages(elem1, elem2, elem3, elem4) -> let data = String.create 8 in put_uint16 data 0 (truncate (elem1 *. 10000.)); @@ -447,6 +539,42 @@ let decode frame = (float (get_uint16 frame.data 0) /. 10000., float (get_uint16 frame.data 2) /. 100000., get_uint32 frame.data 4) + | 311 -> + Switch1_status + (get_uint8 frame.data 0 <> 0, + get_uint8 frame.data 1 <> 0, + get_uint8 frame.data 2 <> 0, + get_uint8 frame.data 3 <> 0, + get_uint8 frame.data 4 <> 0, + get_uint8 frame.data 5 <> 0, + get_uint8 frame.data 6 <> 0, + get_uint8 frame.data 7 <> 0) + | 312 -> + Switch2_status + (get_uint8 frame.data 0 <> 0, + get_uint8 frame.data 1 <> 0, + get_uint8 frame.data 2 <> 0, + get_uint8 frame.data 3 <> 0, + get_uint8 frame.data 4 <> 0, + get_uint8 frame.data 5 <> 0, + get_uint8 frame.data 6 <> 0, + get_uint8 frame.data 7 <> 0) + | 313 -> + Switch_request + (get_uint8 frame.data 0, + get_uint8 frame.data 1 <> 0) + | 321 -> + Adc1_values + (get_uint16 frame.data 0, + get_uint16 frame.data 2, + get_uint16 frame.data 4, + get_uint16 frame.data 6) + | 322 -> + Adc2_values + (get_uint16 frame.data 0, + get_uint16 frame.data 2, + get_uint16 frame.data 4, + get_uint16 frame.data 6) | 401 -> Battery1_voltages (float (get_uint16 frame.data 0) /. 10000., diff --git a/info/control2011/src/lib/krobot_message.mli b/info/control2011/src/lib/krobot_message.mli index 90ff8f7..65a6355 100644 --- a/info/control2011/src/lib/krobot_message.mli +++ b/info/control2011/src/lib/krobot_message.mli @@ -22,6 +22,16 @@ type t = (** The position of the beacon relative to the robot *) | Beacon_lowlevel_position of float * float * int (** The position of the beacon as internally stored (for calibration) *) + | Switch1_status of bool * bool * bool * bool * bool * bool * bool * bool + (** The status of the first 8 switches *) + | Switch2_status of bool * bool * bool * bool * bool * bool * bool * bool + (** The status of the other 8 switches *) + | Switch_request of int * bool + (** A request to switch something on/off *) + | Adc1_values of int * int * int * int + (** The values of the first 4 ADCs *) + | Adc2_values of int * int * int * int + (** The values of the other 4 ADCs *) | Encoder_position_direction_1_2 of int * direction * int * direction (** The position and direction of encoders 1 and 2. *) | Encoder_position_direction_3_4 of int * direction * int * direction hooks/post-receive -- krobot |
From: Nicolas D. <Ba...@us...> - 2011-05-30 21:59:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 2ee1763a0f7bd92e6e37a25b1e4bf17c0351290d (commit) via 900dfc8c3c7319040141e12d7f896831d604dfd2 (commit) via d79681660ec191abf8c383634f6e937bf06c4acf (commit) via 722916138bde625e4a56e8c77bf7d11a9b34cadc (commit) from 7ad67e53ff536078ecef7132f604d5957472f782 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2ee1763a0f7bd92e6e37a25b1e4bf17c0351290d Author: Nicolas Dandrimont <Nic...@cr...> Date: Mon May 30 23:58:19 2011 +0200 [USB_CAN] Move battery monitoring to the Sensor_Actuator board commit 900dfc8c3c7319040141e12d7f896831d604dfd2 Author: Nicolas Dandrimont <Nic...@cr...> Date: Mon May 30 23:53:44 2011 +0200 [Sensor_Actuator] Add ADC management commit d79681660ec191abf8c383634f6e937bf06c4acf Author: Nicolas Dandrimont <Nic...@cr...> Date: Mon May 30 23:51:25 2011 +0200 [Sensor_Actuator] Silence SAM3X warnings commit 722916138bde625e4a56e8c77bf7d11a9b34cadc Author: Nicolas Dandrimont <Nic...@cr...> Date: Mon May 30 23:50:38 2011 +0200 [Sensor_Actuator] Enhance switches management ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.c new file mode 100644 index 0000000..434790f --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.c @@ -0,0 +1,35 @@ +#include "adc.h" + +void sa_adc_init(void) { + + // Initialize the pins in the Analog IN mode + // (should be the default, but anyway...) + stm32_gpioPinConfig((struct stm32_gpio *)GPIOC_BASE, + BV(0) | BV(1) | BV(2) | BV(3), + GPIO_MODE_AIN, + GPIO_SPEED_50MHZ); + + stm32_gpioPinConfig((struct stm32_gpio *)GPIOA_BASE, + BV(0) | BV(1) | BV(2) | BV(3), + GPIO_MODE_AIN, + GPIO_SPEED_50MHZ); + + + // BeRTOS ADC initialization + adc_init(); + + // Yep, that's all folks... +} + +void get_adc_values(adc_values *pkt1, adc_values *pkt2) { + pkt1->p.val1 = adc_read(10); + pkt1->p.val2 = adc_read(11); + pkt1->p.val3 = adc_read(12); + pkt1->p.val4 = adc_read(13); + + pkt2->p.val1 = adc_read(0); + pkt2->p.val2 = adc_read(1); + pkt2->p.val3 = adc_read(2); + pkt2->p.val4 = adc_read(3); + +} diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.h new file mode 100644 index 0000000..44dba3e --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/adc/adc.h @@ -0,0 +1,47 @@ +/** + * Sensor and Actuator Board : ADC Interfacing + * + * This file contains the interface for the ADCs + * + * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> + * Authors: Nicolas Dandrimont <ol...@cr...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef ADC_H__ +#define ADC_H__ + +#include <stdlib.h> +#include <stdint.h> + +#include <drv/adc.h> +#include <drv/clock_stm32.h> +#include <drv/gpio_stm32.h> + +#include "../can/can_messages.h" + +/** + * Initialize the ADCs + */ +void sa_adc_init(void); + +/** + * Fetch the ADC data in the CAN packets + */ +void get_adc_values(adc_values *pkt1, adc_values *pkt2); + + +#endif diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.c new file mode 100644 index 0000000..031ff29 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.c @@ -0,0 +1,25 @@ +/* + * Wrapper to use the ADS7828 analog to digital converter + * Olivier Bichler + */ + +#include "ads7828.h" + +unsigned int adc7828_measure(I2c* i2c, unsigned char addr, unsigned char ch) { + unsigned char value[2] = {0}; + unsigned char cmd = ADS7828_CMD_PD0 + | ADS7828_CMD_PD1 + | ((ch/2) << 4) + | ADS7828_CMD_SD; + + if (ch % 2) + cmd|= ADS7828_CMD_C2; + + i2c_start_w(i2c, addr, 1, I2C_STOP); + i2c_write(i2c, &cmd, 1); + i2c_start_r(i2c, addr, 2, I2C_STOP); + i2c_read(i2c, &value, 2); + + return ((value[0] << 8) | value[1]); +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.h new file mode 100644 index 0000000..5622fa8 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/ads7828.h @@ -0,0 +1,29 @@ +/* + * Wrapper to use the ADS7828 analog to digital converter + * Olivier Bichler + */ + +#ifndef HEADER__ADS7828 +#define HEADER__ADS7828 + +#define ADS7828_VREF 2.5 +#define ADS7828_RES 12 +#define ADS7828_LSB (ADS7828_VREF/((1 << ADS7828_RES) - 1.0)) + +#define ADS7828_ADDR_BASE 0x90 +#define ADS7828_ADDR_A0 0x02 +#define ADS7828_ADDR_A1 0x04 + +#define ADS7828_CMD_PD0 0x04 +#define ADS7828_CMD_PD1 0x08 +#define ADS7828_CMD_C0 0x10 +#define ADS7828_CMD_C1 0x20 +#define ADS7828_CMD_C2 0x40 +#define ADS7828_CMD_SD 0x80 + +#include <drv/i2c.h> + +unsigned int adc7828_measure(I2c* i2c, unsigned char addr, unsigned char ch); + +#endif + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.c new file mode 100644 index 0000000..31f5175 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.c @@ -0,0 +1,82 @@ +/** + * Battery Monitoring wrapper for the USB CAN Board + * + * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> + * Authors: Nicolas Dandrimont <ol...@cr...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "battery_monitoring.h" + +PROC_DEFINE_STACK(stack_battery_monitoring, KERN_MINSTACKSIZE * 16); + +static battery_monitoring_ctx _ctx; +battery_monitoring_ctx *ctx = &_ctx; + +static void NORETURN battery_monitoring_process(void) { + + can_tx_frame txf; + can_rx_frame rxf; + + battery_status b; + + uint8_t ch; + uint16_t value = 42; + + txf.ide = rxf.ide = 1; + txf.rtr = rxf.rtr = 0; + txf.dlc = rxf.dlc = sizeof(b.p); + + for (;;) { + // Battery 1 + for (ch = 0; ch < 4; ++ch) { + value = adc7828_measure(ctx->i2c, ADS7828_ADDR_BASE, ch); + b.p.elem[ch] = (uint16_t)(2.0*value*ADS7828_LSB * 10000.); + } + + txf.eid = rxf.eid = 401; + txf.data32[0] = rxf.data32[0] = b.d[0]; + txf.data32[1] = rxf.data32[1] = b.d[1]; + + usb_can_emit(ctx->usbcan, &rxf); + can_transmit(ctx->usbcan->can, &txf, ms_to_ticks(10)); + + // Battery 2 + for (ch = 0; ch < 4; ++ch) { + value = adc7828_measure(ctx->i2c, ADS7828_ADDR_BASE + 2, ch); + b.p.elem[ch] = (uint16_t)(2.0*value*ADS7828_LSB * 10000.); + } + + txf.eid = rxf.eid = 402; + txf.data32[0] = rxf.data32[0] = b.d[0]; + txf.data32[1] = rxf.data32[1] = b.d[1]; + + usb_can_emit(ctx->usbcan, &rxf); + can_transmit(ctx->usbcan->can, &txf, ms_to_ticks(10)); + + timer_delay(100); + } +} + +battery_monitoring_ctx *battery_monitoring_init(usb_can *usbcan, I2c *i2c) { + ctx->usbcan = usbcan; + ctx->i2c = i2c; + + proc_new(battery_monitoring_process, NULL, sizeof(stack_battery_monitoring), stack_battery_monitoring); + + + return ctx; +} diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.h new file mode 100644 index 0000000..6075c1e --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/battery_monitoring/battery_monitoring.h @@ -0,0 +1,47 @@ +/** + * Battery Monitoring wrapper for the USB CAN Board + * + * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> + * Authors: Nicolas Dandrimont <ol...@cr...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef BATTERY_MONITORING_H +#define BATTERY_MONITORING_H + +#include <drv/can.h> +#include <drv/i2c.h> + +#include "../usb_can/usb_can.h" +#include "ads7828.h" + +typedef struct { + usb_can *usbcan; + I2c *i2c; +} battery_monitoring_ctx; + +struct battery_status_pkt { + uint16_t elem[4] __attribute__((packed)); // in 1/10000th volts [0; 6.5536[ +}; + +typedef union { + struct battery_status_pkt p; + uint32_t d[2]; +} battery_status; + +battery_monitoring_ctx *battery_monitoring_init(usb_can *usbcan, I2c *i2c); + +#endif diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_messages.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_messages.h index 9dac070..512077e 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_messages.h +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_messages.h @@ -38,6 +38,14 @@ #define CAN_SWITCH_STATUS_1 311 // switch_status #define CAN_SWITCH_STATUS_2 312 // switch_status +#define CAN_SWITCH_SET 313 // switch_request + + +// ADC + +#define CAN_ADC_VALUES_1 321 // adc_values +#define CAN_ADC_VALUES_2 322 // adc_values + /****************************************************************************/ @@ -90,6 +98,23 @@ struct switch_status_pkt { uint8_t sw8; }; +// Switch request +struct switch_request_pkt { + uint8_t num; + uint8_t state; +}; + +/** + * ADC messages + */ +// ADC Values +struct adc_values_pkt { + uint16_t val1; + uint16_t val2; + uint16_t val3; + uint16_t val4; +} __attribute__((packed)); + /****************************************************************************/ /** @@ -116,4 +141,14 @@ typedef union { uint32_t d[2]; } switch_status; +typedef union { + struct switch_request_pkt p; + uint32_t d[2]; +} switch_request; + +typedef union { + struct adc_values_pkt p; + uint32_t d[2]; +} adc_values; + #endif diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.c index c777fe4..80bab34 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.c +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.c @@ -26,6 +26,29 @@ PROC_DEFINE_STACK(stack_send, KERN_MINSTACKSIZE * 4) PROC_DEFINE_STACK(stack_recv, KERN_MINSTACKSIZE * 4) +static void NORETURN can_sender_process(void); +static void NORETURN can_receiver_process(void); + +void can_processes_init(void) { + can_config cfg; + + cfg.mcr = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP; + /* 1 Mbit by default (FIXME: O'RLY?) */ + cfg.btr = CAN_BTR_SJW(0) | CAN_BTR_TS1(8) | CAN_BTR_TS2(1) | CAN_BTR_BRP(6); + + cfg.n_filters = 0; + cfg.filters = NULL; + + /* Initialize CAN driver */ + can_init(); + + can_start(CAND1, &cfg); + + proc_new(can_sender_process, NULL, sizeof(stack_send), stack_send); + proc_new(can_receiver_process, NULL, sizeof(stack_recv), stack_recv); + +} + #define SET_PACKET(f, id, pk) do { \ f.eid = id; \ f.dlc = sizeof(pk.p); \ @@ -44,6 +67,8 @@ static void NORETURN can_sender_process(void) { switch_status st1, st2; + adc_values adc1, adc2; + /* Initialize can frame */ f.ide = 1; @@ -67,7 +92,7 @@ static void NORETURN can_sender_process(void) { /* Switches */ - get_switch_state(&st1, &st2); + get_switch_status(&st1, &st2); SET_PACKET(f, CAN_SWITCH_STATUS_1, st1); can_transmit(CAND1, &f, ms_to_ticks(10)); @@ -75,35 +100,45 @@ static void NORETURN can_sender_process(void) { SET_PACKET(f, CAN_SWITCH_STATUS_2, st2); can_transmit(CAND1, &f, ms_to_ticks(10)); - timer_waitEvent(&timer_send); - } + /* ADC */ -} + get_adc_values(&adc1, &adc2); -static void NORETURN can_receiver_process(void) { + SET_PACKET(f, CAN_ADC_VALUES_1, adc1); + can_transmit(CAND1, &f, ms_to_ticks(10)); - for (;;) { - timer_delay(500); + SET_PACKET(f, CAN_ADC_VALUES_2, adc2); + can_transmit(CAND1, &f, ms_to_ticks(10)); + + + timer_waitEvent(&timer_send); } } -void can_processes_init(void) { - can_config cfg; - - cfg.mcr = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP; - /* 1 Mbit by default (FIXME: O'RLY?) */ - cfg.btr = CAN_BTR_SJW(0) | CAN_BTR_TS1(8) | CAN_BTR_TS2(1) | CAN_BTR_BRP(6); +#define GET_PACKET(type, name, frame) type name; name.d[0] = frame.data32[0]; name.d[1] = frame.data32[1] - cfg.n_filters = 0; - cfg.filters = NULL; +static void NORETURN can_receiver_process(void) { - /* Initialize CAN driver */ - can_init(); + can_rx_frame f; - can_start(CAND1, &cfg); + int ret; - proc_new(can_sender_process, NULL, sizeof(stack_send), stack_send); - proc_new(can_receiver_process, NULL, sizeof(stack_recv), stack_recv); + for (;;) { + ret = can_receive(CAND1, &f, ms_to_ticks(200)); + if (!ret || f.ide != 1) + continue; + + switch (f.eid) { + case CAN_SWITCH_SET: + do { + GET_PACKET(switch_request, req, f); + set_switch(&req); + } while (0); + break; + default: + break; + } + } } diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.h index 4bab22c..757e3a4 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.h +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/can/can_monitor.h @@ -31,6 +31,7 @@ #include "can_messages.h" +#include "../adc/adc.h" #include "../beacon/beacon.h" #include "../switch/switch.h" diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/main.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/main.c index 9e861b8..8ba8ccb 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/main.c +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/main.c @@ -37,9 +37,10 @@ #include <kern/proc.h> #include <io/kfile.h> +#include "adc/adc.h" #include "beacon/beacon.h" -#include "switch/switch.h" #include "can/can_monitor.h" +#include "switch/switch.h" PROC_DEFINE_STACK(stack_blinky, KERN_MINSTACKSIZE * 2); @@ -68,6 +69,9 @@ static void init(void) // Initialize the switches switch_init(); + // Initialize the ADCs + sa_adc_init(); + // Initialize the CAN bus processing can_processes_init(); diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/sensor_actuator_user.mk b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/sensor_actuator_user.mk index 79cac29..ec821cb 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/sensor_actuator_user.mk +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/sensor_actuator_user.mk @@ -10,10 +10,11 @@ sensor_actuator_PROGRAMMER_PORT = none # Files included by the user. sensor_actuator_USER_CSRC = \ $(sensor_actuator_SRC_PATH)/main.c \ + $(sensor_actuator_SRC_PATH)/adc/adc.c \ $(sensor_actuator_SRC_PATH)/beacon/stm32lib/stm32f10x_tim.c \ $(sensor_actuator_SRC_PATH)/beacon/beacon.c \ - $(sensor_actuator_SRC_PATH)/switch/switch.c \ $(sensor_actuator_SRC_PATH)/can/can_monitor.c \ + $(sensor_actuator_SRC_PATH)/switch/switch.c \ # $(sensor_actuator_SRC_PATH)/ax12/serial.c \ # $(sensor_actuator_SRC_PATH)/ax12/ax12.c \ # @@ -46,4 +47,5 @@ sensor_actuator_USER_CPPAFLAGS = \ sensor_actuator_USER_CPPFLAGS = \ -fno-strict-aliasing \ -fwrapv \ + -DCPU_CM3_SAM3X=0 \ # diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.c index 180efd4..0dabba9 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.c +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.c @@ -23,38 +23,71 @@ #include "switch.h" +static uint32_t pins[][2] = { + //{GPIOC_BASE, 4}, + //{GPIOC_BASE, 5}, + //{GPIOB_BASE, 0}, + //{GPIOB_BASE, 1}, + //{GPIOB_BASE, 12}, + //{GPIOB_BASE, 15}, + //{GPIOC_BASE, 6}, + //{GPIOC_BASE, 7}, + //{GPIOC_BASE, 8}, + //{GPIOC_BASE, 9}, + //{GPIOA_BASE, 8}, + //{GPIOC_BASE, 12}, + {GPIOA_BASE, 4}, + {GPIOA_BASE, 5}, + {GPIOA_BASE, 6}, + {GPIOA_BASE, 7}, + {GPIOB_BASE, 5}, +}; + void switch_init(void) { // Clock the GPIOs. RCC->APB2ENR |= RCC_APB2_GPIOA | RCC_APB2_GPIOB | RCC_APB2_GPIOC; - // Initialize D1_1 PC(4) and D1_2 PC(5) + // Initialize D1_1 PC(4) and D1_2 PC(5) as inputs stm32_gpioPinConfig((struct stm32_gpio *)GPIOC_BASE, BV(4) | BV(5), GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ); - // Initialize D1_3 PB(0), D1_4 PB(1), D1_5 PB(12), D1_6 PB(15) + // Initialize D1_3 PB(0), D1_4 PB(1), D1_5 PB(12), D1_6 PB(15) as inputs stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, BV(0) | BV(1) | BV(12) | BV(15), GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ); - // Initialize D2_1 PC(6), D2_2 PC(7), D2_3 PC(8), D2_4 PC(9), D2_6 PC(12) + // Initialize D2_1 PC(6), D2_2 PC(7), D2_3 PC(8), D2_4 PC(9), D2_6 PC(12) as inputs stm32_gpioPinConfig((struct stm32_gpio *)GPIOC_BASE, BV(6) | BV(7) | BV(8) | BV(9) | BV(12), GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ); - // Initialize D2_5 PA(8) + // Initialize D2_5 PA(8) as input stm32_gpioPinConfig((struct stm32_gpio *)GPIOA_BASE, BV(8), GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ); + + // Initialize SW1..4 PA(4..7) as outputs open drain + stm32_gpioPinConfig((struct stm32_gpio *)GPIOA_BASE, + BV(4) | BV(5) | BV(6) | BV(7), + GPIO_MODE_OUT_OD, + GPIO_SPEED_50MHZ); + + // Initialize BUZ PB(5) as output push-pull + stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, + BV(5), + GPIO_MODE_OUT_PP, + GPIO_SPEED_50MHZ); + } #define BOOL(a) ((a)?1:0) -void get_switch_state(switch_status *pkt1, switch_status *pkt2) { +void get_switch_status(switch_status *pkt1, switch_status *pkt2) { pkt1->p.sw1 = BOOL(stm32_gpioPinRead((struct stm32_gpio *)GPIOC_BASE, BV(4))); pkt1->p.sw2 = BOOL(stm32_gpioPinRead((struct stm32_gpio *)GPIOC_BASE, BV(5))); @@ -71,3 +104,17 @@ void get_switch_state(switch_status *pkt1, switch_status *pkt2) { pkt2->p.sw6 = BOOL(stm32_gpioPinRead((struct stm32_gpio *)GPIOC_BASE, BV(12))); } + +void set_switch(switch_request *pkt) { + + struct stm32_gpio *base = NULL; + int32_t pin; + + if(pkt->p.num >= sizeof(pins)/sizeof(pins[0])) + return; + + base = (struct stm32_gpio *)pins[pkt->p.num][0]; + pin = BV(pins[pkt->p.num][1]); + + stm32_gpioPinWrite(base, pin, pkt->p.state); +} diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.h index b5cb78b..b4eae68 100644 --- a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.h +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/sensor_actuator/switch/switch.h @@ -36,6 +36,11 @@ void switch_init(void); /** * Get the switch CAN packet */ -void get_switch_state(switch_status *pkt1, switch_status *pkt2); +void get_switch_status(switch_status *pkt1, switch_status *pkt2); + +/** + * Set the switch state from the CAN packet + */ +void set_switch(switch_request *pkt); #endif diff --git a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.c b/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.c deleted file mode 100644 index 031ff29..0000000 --- a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Wrapper to use the ADS7828 analog to digital converter - * Olivier Bichler - */ - -#include "ads7828.h" - -unsigned int adc7828_measure(I2c* i2c, unsigned char addr, unsigned char ch) { - unsigned char value[2] = {0}; - unsigned char cmd = ADS7828_CMD_PD0 - | ADS7828_CMD_PD1 - | ((ch/2) << 4) - | ADS7828_CMD_SD; - - if (ch % 2) - cmd|= ADS7828_CMD_C2; - - i2c_start_w(i2c, addr, 1, I2C_STOP); - i2c_write(i2c, &cmd, 1); - i2c_start_r(i2c, addr, 2, I2C_STOP); - i2c_read(i2c, &value, 2); - - return ((value[0] << 8) | value[1]); -} - diff --git a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.h b/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.h deleted file mode 100644 index 5622fa8..0000000 --- a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/ads7828.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Wrapper to use the ADS7828 analog to digital converter - * Olivier Bichler - */ - -#ifndef HEADER__ADS7828 -#define HEADER__ADS7828 - -#define ADS7828_VREF 2.5 -#define ADS7828_RES 12 -#define ADS7828_LSB (ADS7828_VREF/((1 << ADS7828_RES) - 1.0)) - -#define ADS7828_ADDR_BASE 0x90 -#define ADS7828_ADDR_A0 0x02 -#define ADS7828_ADDR_A1 0x04 - -#define ADS7828_CMD_PD0 0x04 -#define ADS7828_CMD_PD1 0x08 -#define ADS7828_CMD_C0 0x10 -#define ADS7828_CMD_C1 0x20 -#define ADS7828_CMD_C2 0x40 -#define ADS7828_CMD_SD 0x80 - -#include <drv/i2c.h> - -unsigned int adc7828_measure(I2c* i2c, unsigned char addr, unsigned char ch); - -#endif - diff --git a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.c b/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.c deleted file mode 100644 index 31f5175..0000000 --- a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.c +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Battery Monitoring wrapper for the USB CAN Board - * - * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> - * Authors: Nicolas Dandrimont <ol...@cr...> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#include "battery_monitoring.h" - -PROC_DEFINE_STACK(stack_battery_monitoring, KERN_MINSTACKSIZE * 16); - -static battery_monitoring_ctx _ctx; -battery_monitoring_ctx *ctx = &_ctx; - -static void NORETURN battery_monitoring_process(void) { - - can_tx_frame txf; - can_rx_frame rxf; - - battery_status b; - - uint8_t ch; - uint16_t value = 42; - - txf.ide = rxf.ide = 1; - txf.rtr = rxf.rtr = 0; - txf.dlc = rxf.dlc = sizeof(b.p); - - for (;;) { - // Battery 1 - for (ch = 0; ch < 4; ++ch) { - value = adc7828_measure(ctx->i2c, ADS7828_ADDR_BASE, ch); - b.p.elem[ch] = (uint16_t)(2.0*value*ADS7828_LSB * 10000.); - } - - txf.eid = rxf.eid = 401; - txf.data32[0] = rxf.data32[0] = b.d[0]; - txf.data32[1] = rxf.data32[1] = b.d[1]; - - usb_can_emit(ctx->usbcan, &rxf); - can_transmit(ctx->usbcan->can, &txf, ms_to_ticks(10)); - - // Battery 2 - for (ch = 0; ch < 4; ++ch) { - value = adc7828_measure(ctx->i2c, ADS7828_ADDR_BASE + 2, ch); - b.p.elem[ch] = (uint16_t)(2.0*value*ADS7828_LSB * 10000.); - } - - txf.eid = rxf.eid = 402; - txf.data32[0] = rxf.data32[0] = b.d[0]; - txf.data32[1] = rxf.data32[1] = b.d[1]; - - usb_can_emit(ctx->usbcan, &rxf); - can_transmit(ctx->usbcan->can, &txf, ms_to_ticks(10)); - - timer_delay(100); - } -} - -battery_monitoring_ctx *battery_monitoring_init(usb_can *usbcan, I2c *i2c) { - ctx->usbcan = usbcan; - ctx->i2c = i2c; - - proc_new(battery_monitoring_process, NULL, sizeof(stack_battery_monitoring), stack_battery_monitoring); - - - return ctx; -} diff --git a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.h b/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.h deleted file mode 100644 index 6075c1e..0000000 --- a/elec/boards/USB_CAN/Firmware/usb_can/battery_monitoring/battery_monitoring.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Battery Monitoring wrapper for the USB CAN Board - * - * Copyright © 2011 Nicolas Dandrimont <ol...@cr...> - * Authors: Nicolas Dandrimont <ol...@cr...> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef BATTERY_MONITORING_H -#define BATTERY_MONITORING_H - -#include <drv/can.h> -#include <drv/i2c.h> - -#include "../usb_can/usb_can.h" -#include "ads7828.h" - -typedef struct { - usb_can *usbcan; - I2c *i2c; -} battery_monitoring_ctx; - -struct battery_status_pkt { - uint16_t elem[4] __attribute__((packed)); // in 1/10000th volts [0; 6.5536[ -}; - -typedef union { - struct battery_status_pkt p; - uint32_t d[2]; -} battery_status; - -battery_monitoring_ctx *battery_monitoring_init(usb_can *usbcan, I2c *i2c); - -#endif diff --git a/elec/boards/USB_CAN/Firmware/usb_can/main.c b/elec/boards/USB_CAN/Firmware/usb_can/main.c index 4f984b8..a5a2aa7 100644 --- a/elec/boards/USB_CAN/Firmware/usb_can/main.c +++ b/elec/boards/USB_CAN/Firmware/usb_can/main.c @@ -32,7 +32,6 @@ #include <drv/gpio_stm32.h> #include <drv/can.h> -#include <drv/i2c.h> #include <drv/timer.h> #include <kern/monitor.h> @@ -47,8 +46,6 @@ PROC_DEFINE_STACK(stack_blinky, KERN_MINSTACKSIZE * 2); -static I2c i2c; - static void init(void) { can_config cfg; @@ -88,9 +85,6 @@ static void init(void) /* Initialize Serial driver */ serial_init(SERIAL_BAUDRATE); - /* Initialize I2c interface */ - i2c_init(&i2c, 0, CONFIG_I2C_FREQ); - /* * Kernel initialization: processes (allow to create and dispatch * processes using proc_new()). @@ -99,9 +93,6 @@ static void init(void) /* Initialize USB-CAN logic */ usbcan = usb_can_init(CAND1); - - /* Initialize battery monitoring */ - battery_monitoring_init(usbcan, &i2c); } static void NORETURN blinky_process(void) { diff --git a/elec/boards/USB_CAN/Firmware/usb_can/usb_can_user.mk b/elec/boards/USB_CAN/Firmware/usb_can/usb_can_user.mk index d6bff03..6831017 100644 --- a/elec/boards/USB_CAN/Firmware/usb_can/usb_can_user.mk +++ b/elec/boards/USB_CAN/Firmware/usb_can/usb_can_user.mk @@ -9,8 +9,6 @@ usb_can_PROGRAMMER_PORT = none # Files included by the user. usb_can_USER_CSRC = \ - $(usb_can_SRC_PATH)/battery_monitoring/ads7828.c \ - $(usb_can_SRC_PATH)/battery_monitoring/battery_monitoring.c \ $(usb_can_SRC_PATH)/usb_can/serial.c \ $(usb_can_SRC_PATH)/usb_can/usb_can.c \ $(usb_can_SRC_PATH)/main.c \ hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-30 16:45:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 7ad67e53ff536078ecef7132f604d5957472f782 (commit) from 101c37b33f577397fc259e8bb532220ca5c009db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7ad67e53ff536078ecef7132f604d5957472f782 Author: Jérémie Dimino <je...@di...> Date: Mon May 30 18:44:44 2011 +0200 [info] add a smart goto function to krobot-planner ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_bus.ml b/info/control2011/src/lib/krobot_bus.ml index 3d423b8..3775071 100644 --- a/info/control2011/src/lib/krobot_bus.ml +++ b/info/control2011/src/lib/krobot_bus.ml @@ -30,6 +30,7 @@ type message = | Trajectory_add_vertice of vertice | Trajectory_simplify of float | Trajectory_go of float * float * float * float + | Trajectory_goto of vertice | Trajectory_stop | Trajectory_moving of bool | Trajectory_find_path @@ -97,6 +98,10 @@ let string_of_message = function sprintf "Trajectory_go(%f, %f, %f, %f)" a b c d + | Trajectory_goto v -> + sprintf + "Trajectory_goto %s" + (string_of_vertice v) | Trajectory_stop -> "Trajectory_stop" | Trajectory_moving b -> diff --git a/info/control2011/src/lib/krobot_bus.mli b/info/control2011/src/lib/krobot_bus.mli index dd7f2e3..ad99d61 100644 --- a/info/control2011/src/lib/krobot_bus.mli +++ b/info/control2011/src/lib/krobot_bus.mli @@ -46,6 +46,8 @@ type message = | Trajectory_go of float * float * float * float (** [Trajectory_go(rotation_speed, rotation_acceleration, moving_speed, moving_acceleration)]. *) + | Trajectory_goto of vertice + (** [Trajectory_goto dest] go to the given position. *) | Trajectory_stop (** Stop the current trajectory. *) | Trajectory_moving of bool diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index b47756e..03f3db9 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -72,16 +72,12 @@ let object_safety_distance = object_radius +. robot_size /. 2. let find_path planner src dst = let objects = List.filter (fun obj -> distance dst obj >= object_safety_distance) planner.objects in - match - Krobot_pathfinding.find_path ~src ~dst - ({ x = border_safety_distance; - y = border_safety_distance}, - { x = world_width -. border_safety_distance; - y = world_height -. border_safety_distance}) + Krobot_pathfinding.find_path ~src ~dst + ({ x = border_safety_distance; + y = border_safety_distance}, + { x = world_width -. border_safety_distance; + y = world_height -. border_safety_distance}) (List.map (fun v -> v,object_safety_distance) objects) - with - | None -> [] - | Some l -> l (* +-----------------------------------------------------------------+ | Primitives | @@ -181,6 +177,73 @@ let wait_start planner = in Lwt_log.info "robot started the new trajectory" +(* Send a bezier curve to the robot. *) +let send_curve planner sign p q r s v_end = + (* Compute parameters. *) + let d1 = sign *. distance p q and d2 = distance r s in + let v = vector r s in + let theta_end = atan2 v.vy v.vx in + + ignore ( + Lwt_log.info_f + "sending bezier curve, x = %f, y = %f, d1 = %f, d2 = %f, theta_end = %f, v_end = %f" + s.x s.y d1 d2 theta_end v_end + ); + + (* Send the curve. *) + Krobot_message.send planner.bus (Unix.gettimeofday (), Motor_bezier(s.x, s.y, d1, d2, theta_end, v_end)) + +(* Remove the first vertice of the trajecotry. *) +let drop_vertice planner = + set_vertices planner ~curves:(List.tl planner.curves) (List.tl planner.vertices) + +(* Follow the given path, updating [current_curve] each time we follow + a new curve. *) +let follow_path planner current_curve path = + let rec loop = function + | [] -> + lwt () = wait_done planner in + set_vertices planner []; + return () + + | [(sign, p, q, r, s)] -> + lwt () = wait_middle planner in + lwt () = send_curve planner sign p q r s 0.01 in + lwt () = wait_start planner in + current_curve := Bezier.of_vertices p q r s; + drop_vertice planner; + lwt () = wait_done planner in + set_vertices planner []; + return () + + | (sign, p, q, r, s) :: rest -> + lwt () = wait_middle planner in + lwt () = send_curve planner sign p q r s 0.5 in + lwt () = wait_start planner in + current_curve := Bezier.of_vertices p q r s; + drop_vertice planner; + loop rest + in + + (* Add the origin of the trajectory to keep displaying it. *) + planner.vertices <- planner.position :: path; + match planner.curves with + | [] -> + set_vertices planner []; + return () + + | [(sign, p, q, r, s)] -> + current_curve := Bezier.of_vertices p q r s; + lwt () = send_curve planner sign p q r s 0.01 in + lwt () = wait_done planner in + set_vertices planner []; + return () + + | (sign, p, q, r, s) :: rest -> + current_curve := Bezier.of_vertices p q r s; + lwt () = send_curve planner sign p q r s 0.5 in + loop rest + let go planner rotation_speed rotation_acceleration moving_speed moving_acceleration = if planner.moving then return () @@ -188,70 +251,62 @@ let go planner rotation_speed rotation_acceleration moving_speed moving_accelera set_moving planner true; planner.mover <- ( try_lwt - (* Send a bezier curve to the robot. *) - let send_curve (sign, p, q, r, s) v_end = - (* Compute parameters. *) - let d1 = sign *. distance p q and d2 = distance r s in - let v = vector r s in - let theta_end = atan2 v.vy v.vx in - - ignore ( - Lwt_log.info_f - "sending bezier curve, x = %f, y = %f, d1 = %f, d2 = %f, theta_end = %f, v_end = %f" - s.x s.y d1 d2 theta_end v_end - ); - - (* Send the curve. *) - lwt () = Krobot_message.send planner.bus (Unix.gettimeofday (), Motor_bezier(s.x, s.y, d1, d2, theta_end, v_end)) in - - return (s, theta_end) - in - - (* Remove the first vertice of the trajecotry. *) - let drop_vertice (s, theta) = - set_vertices planner ~curves:(List.tl planner.curves) (List.tl planner.vertices) - in + follow_path planner (ref (Bezier.of_vertices origin origin origin origin)) planner.vertices - let rec loop x = function - | [] -> - lwt () = wait_done planner in - set_vertices planner []; - return () - - | [points] -> - lwt () = wait_middle planner in - lwt _ = send_curve points 0.01 in - lwt () = wait_start planner in - drop_vertice x; - lwt () = wait_done planner in - set_vertices planner []; - return () - - | points :: rest -> - lwt () = wait_middle planner in - lwt y = send_curve points 0.5 in - lwt () = wait_start planner in - drop_vertice x; - loop y rest - in - - (* Add the origin of the trajectory to keep displaying it. *) - planner.vertices <- planner.position :: planner.vertices; - match planner.curves with - | [] -> - set_vertices planner []; - return () + with exn -> + Lwt_log.error_f ~section ~exn "failed to move" - | [points] -> - lwt _ = send_curve points 0.01 in - lwt () = wait_done planner in - set_vertices planner []; - return () + finally + set_moving planner false; + return () + ); + return () + end - | points :: rest -> - lwt x = send_curve points 0.5 in - loop x rest +let abort planner = + Krobot_message.send planner.bus (Unix.gettimeofday (), Motor_stop(1.0, 0.0)) + +let check planner curve = + let rec loop i = + if i = 256 then + true + else + let v = Bezier.vertice curve (float i /. 255.) in + if List.for_all (fun obj -> distance v obj >= object_safety_distance) planner.objects then + loop (i + 1) + else + false + in + loop planner.curve_status +(* Go to the given destination. *) +let goto planner dst = + if planner.moving then + return () + else begin + set_moving planner true; + planner.mover <- ( + try_lwt + let rec loop () = + match find_path planner planner.position dst with + | None -> + ignore (Lwt_log.info ~section "cannot find a path to the destination"); + return () + | Some path -> + let current_curve = ref (Bezier.of_vertices origin origin origin origin) in + match_lwt + pick [ + follow_path planner current_curve path >> return true; + Lwt_unix.sleep 0.01 >> while_lwt check planner !current_curve do Lwt_unix.sleep 0.01 done >> return false; + ] + with + | true -> + return () + | false -> + lwt () = abort planner in + loop () + in + loop () with exn -> Lwt_log.error_f ~section ~exn "failed to move" @@ -311,17 +366,21 @@ let handle_message planner (timestamp, message) = if not planner.moving then ignore (go planner rotation_speed rotation_acceleration moving_speed moving_acceleration) + | Trajectory_goto v -> + if not planner.moving then + ignore (goto planner v) + | Trajectory_stop -> cancel planner.mover; set_moving planner false; set_vertices planner []; - ignore (Krobot_message.send planner.bus (Unix.gettimeofday (), Motor_stop(1.0,0.0))) + ignore (Krobot_message.send planner.bus (Unix.gettimeofday (), Motor_stop(1.0, 0.0))) | Trajectory_find_path -> if not planner.moving then begin match planner.vertices with | v :: _ -> - set_vertices planner (find_path planner planner.position v) + set_vertices planner (match find_path planner planner.position v with Some p -> p | None -> []) | _ -> () end diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index ea98946..219ff6a 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -552,6 +552,18 @@ lwt () = false)); ignore + (ui#button_goto#event#connect#button_release + (fun ev -> + if GdkEvent.Button.button ev = 1 then begin + match viewer.vertices with + | [] -> + () + | v :: _ -> + ignore (Krobot_bus.send bus (Unix.gettimeofday (), Trajectory_goto v)) + end; + false)); + + ignore (ui#button_start_red#event#connect#button_release (fun ev -> if GdkEvent.Button.button ev = 1 then diff --git a/info/control2011/src/tools/krobot_viewer_ui.glade b/info/control2011/src/tools/krobot_viewer_ui.glade index 351e0c4..238adf1 100644 --- a/info/control2011/src/tools/krobot_viewer_ui.glade +++ b/info/control2011/src/tools/krobot_viewer_ui.glade @@ -275,9 +275,6 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> <widget class="GtkButton" id="button_find"> <property name="label" translatable="yes">Find a path</property> <property name="visible">True</property> @@ -289,6 +286,20 @@ <property name="bottom_attach">2</property> </packing> </child> + <child> + <widget class="GtkButton" id="button_goto"> + <property name="label" translatable="yes">Smart goto</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> </widget> <packing> <property name="expand">False</property> hooks/post-receive -- krobot |
From: Nicolas D. <Ba...@us...> - 2011-05-29 22:51:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 101c37b33f577397fc259e8bb532220ca5c009db (commit) from 1ed43bec7729c6f008dcd6d1fde00c24e44a4854 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 101c37b33f577397fc259e8bb532220ca5c009db Author: Nicolas Dandrimont <Nic...@cr...> Date: Mon May 30 00:49:35 2011 +0200 [Sensor_Actuator] Import Firmware ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/Makefile b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/Makefile new file mode 100644 index 0000000..ffd4842 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni <du...@de...> +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include sensor_actuator/sensor_actuator.mk + +include bertos/rules.mk diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/VERSION b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/VERSION new file mode 100644 index 0000000..e520145 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/VERSION @@ -0,0 +1 @@ +BeRTOS 2.6.99 [local copy] diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.c new file mode 100644 index 0000000..d4293f9 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.c @@ -0,0 +1,102 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC table and support routines + * + * \author Bernie Innocenti <be...@co...> + */ + +#include "crc.h" + +/* + * The boot on AVR cpu is placed at the end of flash memory, but the avr + * address memory by byte and the pointers are 16bits long, so we are able + * to address 64Kbyte memory max. For this reason we can't read the crctab + * from flash, because it is placed at the end of memory. This is true every + * time we have an AVR cpu with more that 64Kbyte of flash. To fix this problem + * we let the compiler copy the table in RAM at startup. Obviously this solution + * is not efficent, but for now this is the only way. + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define CRC_TABLE const uint16_t PROGMEM crc16tab[256] +#else + #define CRC_TABLE const uint16_t crc16tab[256] +#endif + +/** + * crctab calculated by Mark G. Mendel, Network Systems Corporation + */ +CRC_TABLE = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, + 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, + 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, + 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, + 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, + 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, + 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, + 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, + 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, + 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, + 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, + 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, + 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, + 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, + 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, + 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + +uint16_t crc16(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while(len--) + crc = UPDCRC16(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.h new file mode 100644 index 0000000..c5c1eef --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief Cyclic Redundancy Check 16 (CRC). This algorithm is the one used by the XMODEM protocol. + * + * \note This algorithm is incompatible with the CCITT-CRC16. + * + * This code is based on the article Copyright 1986 Stephen Satchell. + * + * Programmers may incorporate any or all code into their programs, + * giving proper credit within the source. Publication of the + * source routines is permitted so long as proper credit is given + * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, + * Omen Technology. + * + * \author Bernie Innocenti <be...@co...> + * + * $WIZ$ module_name = "crc16" + */ + +#ifndef ALGO_CRC_H +#define ALGO_CRC_H + +#include "cfg/cfg_arch.h" + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc16tab[256]; + + +/** + * \brief Compute the updated CRC16 value for one octet (macro version) + * + * \note This version is only intended for old/broken compilers. + * Use the inline function in new code. + * + * \param c New octet (range 0-255) + * \param oldcrc Previous CRC16 value (referenced twice, beware of side effects) + */ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + #define UPDCRC16(c, oldcrc) (pgm_read_uint16_t(&crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#else + #define UPDCRC16(c, oldcrc) ((crc16tab[((oldcrc) >> 8) ^ ((unsigned char)(c))]) ^ ((oldcrc) << 8)) +#endif + +/** CRC-16 init value */ +#define CRC16_INIT_VAL ((uint16_t)0) + +#ifdef INLINE +/** + * \brief Compute the updated CRC16 value for one octet (inline version) + */ +INLINE uint16_t updcrc16(uint8_t c, uint16_t oldcrc) +{ +#if CPU_HARVARD && !(defined(ARCH_BOOT) && (ARCH & ARCH_BOOT)) + return pgm_read_uint16_t(&crc16tab[(oldcrc >> 8) ^ c]) ^ (oldcrc << 8); +#else + return crc16tab[(oldcrc >> 8) ^ c] ^ (oldcrc << 8); +#endif +} +#endif // INLINE + + +/** + * This function implements the CRC 16 calculation on a buffer. + * + * \param crc Current CRC16 value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC16 value. + */ +extern uint16_t crc16(uint16_t crc, const void *buf, size_t len); + +int crc_testSetup(void); +int crc_testRun(void); +int crc_testTearDown(void); + +EXTERN_C_END + +#endif /* ALGO_CRC_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.c new file mode 100644 index 0000000..feaf624 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.c @@ -0,0 +1,83 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" + +const uint16_t PROGMEM crc_ccitt_tab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78, +}; + +uint16_t crc_ccitt(uint16_t crc, const void *buffer, size_t len) +{ + const unsigned char *buf = (const unsigned char *)buffer; + while (len--) + crc = updcrc_ccitt(*buf++, crc); + + return crc; +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.h new file mode 100644 index 0000000..240e6e1 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_ccitt.h @@ -0,0 +1,78 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2009 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief CCITT Cyclic Redundancy Check (CRC-CCITT). + * + * \note This algorithm is incompatible with the CRC16. + * + * \author Francesco Sacchi <ba...@de...> + * + * $WIZ$ module_name = "crc-ccitt" + */ + +#ifndef ALGO_CRC_CCITT_H +#define ALGO_CRC_CCITT_H + +#include <cfg/compiler.h> +#include <cpu/pgm.h> + +EXTERN_C_BEGIN + +/* CRC table */ +extern const uint16_t crc_ccitt_tab[256]; + +/** + * \brief Compute the updated CRC-CCITT value for one octet (inline version) + */ +INLINE uint16_t updcrc_ccitt(uint8_t c, uint16_t oldcrc) +{ + return (oldcrc >> 8) ^ pgm_read16(&crc_ccitt_tab[(oldcrc ^ c) & 0xff]); +} + +/** CRC-CCITT init value */ +#define CRC_CCITT_INIT_VAL ((uint16_t)0xFFFF) + + +/** + * This function implements the CRC-CCITT calculation on a buffer. + * + * \param crc Current CRC-CCITT value. + * \param buf The buffer to perform CRC calculation on. + * \param len The length of the Buffer. + * + * \return The updated CRC-CCITT value. + */ +extern uint16_t crc_ccitt(uint16_t crc, const void *buf, size_t len); + +EXTERN_C_END + +#endif /* ALGO_CRC_CCITT_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_test.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_test.c new file mode 100644 index 0000000..1a93e3b --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/crc_test.c @@ -0,0 +1,75 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/) + * Copyright 1999 Bernie Innocenti <be...@co...> + * + * --> + * + * \brief CRC-CCITT table and support routines + * + * \author Francesco Sacchi <ba...@de...> + */ + +#include "crc_ccitt.h" +#include "crc.h" + +#include <cfg/debug.h> +#include <cfg/test.h> + + +int crc_testSetup(void) +{ + kdbg_init(); + return 0; +} + +int crc_testTearDown(void) +{ + return 0; +} + +int crc_testRun(void) +{ + char vector[9] = "123456789"; + + uint16_t crc = CRC_CCITT_INIT_VAL; + + crc = crc_ccitt(crc, vector, sizeof(vector)); + kprintf("crc_ccitt [%04X]\n", crc); + ASSERT(crc == 0x6F91); + + crc = CRC16_INIT_VAL; + crc = crc16(crc, vector, sizeof(vector)); + kprintf("crc16 [%04X]\n", crc); + ASSERT(crc == 0x31C3); + + return 0; +} + +TEST_MAIN(crc); diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.c new file mode 100644 index 0000000..589d989 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.c @@ -0,0 +1,336 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2007 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief MD2 Message-Digest algorithm. + * + * The MD2 algorithm work with a constant array of 256 permutationt + * defined in RFC1319. If you don't want to use a standard array of + * permutatione you can use a md2_perm() function that generate an + * array of 256 "casual" permutation. To swich from a standard array + * to md2_perm function you must chanche CONFIG_MD2_STD_PERM defined in + * appconfig.h. + * If you need to store array in program memory you must define + * a macro _PROGMEM (for more info see cpu/pgm.h). + * + * + * \author Daniele Basile <as...@de...> + */ + +#include "md2.h" + +#include <string.h> //memset(), memcpy(); +#include <cfg/compiler.h> +#include <cfg/debug.h> //ASSERT() +#include <cfg/macros.h> //MIN(), countof(), ROTR(); +#include <cpu/pgm.h> + + +#if CONFIG_MD2_STD_PERM + /* + * Official array of 256 byte pemutation contructed from digits of pi, defined + * in the RFC 1319. + */ + static const uint8_t PROGMEM md2_perm[256] = + { + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, + 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, + 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, + 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, + 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 + }; + + #define MD2_PERM(x) pgm_read8(&md2_perm[x]) +#else + /** + * Md2_perm() function generate an array of 256 "casual" permutation. + */ + + /** + * Costant define for computing an array of 256 "casual" permutation. + * \{ + */ + #define K1 5 + #define K2 3 + #define R 2 + #define X 172 + /*\}*/ + + static uint8_t md2_perm(uint8_t i) + { + + i = i * K1; + i = ROTR(i, R); + i ^= X; + i = i * K2; + + return i; + } + + #define MD2_PERM(x) md2_perm(x) + +#endif + + +/** + * Pad function. Put len_pad unsigned char in + * input block. + */ +static void md2_pad(void *_block, size_t len_pad) +{ + uint8_t *block; + + block = (uint8_t *)_block; + + ASSERT(len_pad <= CONFIG_MD2_BLOCK_LEN); + + /* + * Fill input block with len_pad char. + */ + memset(block, len_pad, len_pad); + +} + +static void md2_compute(void *_state, void *_checksum, void *_block) +{ + int i = 0; + uint16_t t = 0; + uint8_t compute_array[COMPUTE_ARRAY_LEN]; + uint8_t *state; + uint8_t *checksum; + uint8_t *block; + + state = (uint8_t *)_state; + checksum = (uint8_t *)_checksum; + block = (uint8_t *)_block; + + /* + * Copy state and checksum context in compute array. + */ + memcpy(compute_array, state, CONFIG_MD2_BLOCK_LEN); + memcpy(compute_array + CONFIG_MD2_BLOCK_LEN, block, CONFIG_MD2_BLOCK_LEN); + + /* + * Fill compute array with state XOR block + */ + for(i = 0; i < CONFIG_MD2_BLOCK_LEN; i++) + compute_array[i + (CONFIG_MD2_BLOCK_LEN * 2)] = state[i] ^ block[i]; + + /* + * Encryt block. + */ + for(i = 0; i < NUM_COMPUTE_ROUNDS; i++) + { + for(int j = 0; j < COMPUTE_ARRAY_LEN; j++) + { + compute_array[j] ^= MD2_PERM(t); + t = compute_array[j]; + } + + t = (t + i) & 0xff; //modulo 256. + } + /* + * Update checksum. + */ + t = checksum[CONFIG_MD2_BLOCK_LEN - 1]; + + for(i = 0; i < CONFIG_MD2_BLOCK_LEN; i++) + { + checksum[i] ^= MD2_PERM(block[i] ^ t); + t = checksum[i]; + } + + /* + * Update state and clean compute array. + */ + memcpy(state, compute_array, CONFIG_MD2_BLOCK_LEN); + memset(compute_array, 0, sizeof(compute_array)); +} + +/** + * Algorithm initialization. + * + * \param context empty context. + */ +void md2_init(Md2Context *context) +{ + + memset(context, 0, sizeof(Md2Context)); + +} + +/** + * Update block. + */ +void md2_update(Md2Context *context, const void *_block_in, size_t block_len) +{ + + const uint8_t *block_in; + size_t cpy_len; + + + block_in = (const uint8_t *)_block_in; + + while(block_len > 0) + { + /* + * Choose a number of block that fill input context buffer. + */ + cpy_len = MIN(block_len, CONFIG_MD2_BLOCK_LEN - context->counter); + + + /* + * Copy in the buffer input block. + */ + memcpy(&context->buffer[context->counter], block_in, cpy_len); + + /* + * Update a context counter, input block length and remaning + * context buffer block lenght. + */ + context->counter += cpy_len; + block_len -= cpy_len; + block_in += cpy_len; + + /* + * If buffer is full, compute it. + */ + if (context->counter >= CONFIG_MD2_BLOCK_LEN) + { + md2_compute(context->state, context->checksum, context->buffer); + context->counter = 0; + } + } + + +} +/** + * Ends an MD2 message digest operation. + * This fuction take an context and return a pointer + * to context state. + * + * \param context in input. + * \return a pointer to context state (message digest). + */ +uint8_t *md2_end(Md2Context *context) +{ + + uint8_t buf[CONFIG_MD2_BLOCK_LEN]; + + /* + * Fill remaning empty context buffer. + */ + md2_pad(buf, CONFIG_MD2_BLOCK_LEN - context->counter); + + /* + * Update context buffer and compute it. + */ + md2_update(context, buf, CONFIG_MD2_BLOCK_LEN - context->counter); + + /* + * Add context checksum to message input. + */ + md2_update(context, context->checksum, CONFIG_MD2_BLOCK_LEN); + + + return context->state; //return a pointer to message digest. +} +/** + * MD2 test fuction. + * This function test MD2 algorithm with a standard string specified + * in RFC 1319. + * + * \note This test work with official array of 256 byte pemutation + * contructed from digits of pi, defined in the RFC 1319. + * + */ +bool md2_test(void) +{ + + Md2Context context; + + const char *test[] = + { + "", + "message digest", + "abcdefghijklmnopqrstuvwxyz", + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + }; + + + const char *result[] = { + "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69\x27\x73", + "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe\x06\xb0", + "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47\x94\x0b", + "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3\xef\xd8", + }; + + + for (size_t i = 0; i < countof(test); i++) + { + md2_init(&context); + md2_update(&context, test[i], strlen(test[i])); + + if(memcmp(result[i], md2_end(&context), MD2_DIGEST_LEN)) + return false; + } + + return true; +} + +#if 0 + +#include <stdio.h> +int main(int argc, char * argv[]) +{ + + if(md2_test()) + printf("MD2 algorithm work well!\n"); + else + printf("MD2 algorithm doesn't work well.\n"); + +} + +#endif + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.h new file mode 100644 index 0000000..f7642b9 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/md2.h @@ -0,0 +1,74 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2007 Develer S.r.l. (http://www.develer.com/) + * + * --> + * + * \brief MD2 Message-Digest algorithm. + * + * The algorithm takes as input a message of arbitrary length and produces + * as output a 128-bit message digest of the input. + * It is conjectured that it is computationally infeasible to produce + * two messages having the same message digest, or to produce any + * message having a given prespecified target message digest. + * + * + * \author Daniele Basile <as...@de...> + * + * $WIZ$ module_name = "md2" + * $WIZ$ module_configuration = "bertos/cfg/cfg_md2.h" + */ + +#ifndef ALGO_MD2_H +#define ALGO_MD2_H + +#include "cfg/cfg_md2.h" +#include <cfg/compiler.h> + +#define NUM_COMPUTE_ROUNDS 18 ///< Number of compute rounds. +#define COMPUTE_ARRAY_LEN CONFIG_MD2_BLOCK_LEN * 3 ///< Lenght of compute array. +#define MD2_DIGEST_LEN CONFIG_MD2_BLOCK_LEN +/** + * Context for MD2 computation. + */ +typedef struct Md2Context +{ + uint8_t buffer[CONFIG_MD2_BLOCK_LEN]; ///< Input buffer. + uint8_t state[CONFIG_MD2_BLOCK_LEN]; ///< Current state buffer. + uint8_t checksum[CONFIG_MD2_BLOCK_LEN]; ///< Checksum. + size_t counter; ///< Counter of remaining bytes. + +} Md2Context; + +void md2_init(Md2Context *context); +void md2_update(Md2Context *context, const void *block_in, size_t block_len); +uint8_t *md2_end(Md2Context *context); +bool md2_test(void); + +#endif /* ALGO_MD2_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/mean.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/mean.h new file mode 100644 index 0000000..893241e --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/mean.h @@ -0,0 +1,41 @@ +#warning revise me! + + +/** + * DECLARE_SMEAN(temperature, uint8_t, uint16_t); + * for (i = 0; i < TEMP_MEANS; ++i) + * SMEAN_ADD(temperature, adc_get(), TEMP_MEANS); + * printf("mean temperature = %d\n", SMEAN_GET(temperature)); + */ + +/** + * Instantiate a mean instance + */ +#define DECLARE_SMEAN(name, Type, SumType) \ + struct { \ + SumType sum; \ + Type result; \ + int count; \ + } name = { 0, 0, 0 } + +/** + * Insert a new sample into the mean. + * + * \note \a mean and \a max_samples are evaluated multiple times + */ +#define SMEAN_ADD(mean, sample, max_samples) \ + do { \ + (mean).sum += (sample); \ + if ((mean).count++ >= (max_samples)) \ + { \ + (mean).result = (mean).sum / (max_samples); \ + (mean).sum = 0; \ + (mean).count = 0; \ + } \ + } while (0) + +/** + * Return current mean value. + */ +#define SMEAN_GET(mean) ((mean).result) + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.c new file mode 100644 index 0000000..73e7ffd --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.c @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2008 Develer S.r.l. (http://www.develer.com/) + * --> + * + * + * \brief Proportional, integral, derivative controller (PID controller) (implementation) + * + * + * \author Daniele Basile <as...@de...> + */ + +#include "pid_control.h" + +#include "cfg/cfg_pid.h" + +// Define logging setting (for cfg/log.h module). +#define LOG_LEVEL PID_LOG_LEVEL +#define LOG_VERBOSITY PID_LOG_FORMAT + +#include <cfg/log.h> +#include <cfg/debug.h> + +/** + * Compute next value for reaching \a target point. + */ +piddata_t pid_control_update(PidContext *pid_ctx, piddata_t target, piddata_t curr_pos) +{ + piddata_t P; + piddata_t I; + piddata_t D; + piddata_t err; + + //Compute current error. + err = target - curr_pos; + + /* + * Compute Proportional contribute + */ + P = err * pid_ctx->cfg->kp; + + //Update integral state error + pid_ctx->i_state += err; + + //Clamp integral state between i_min and i_max + pid_ctx->i_state = MINMAX(pid_ctx->cfg->i_min, pid_ctx->i_state, pid_ctx->cfg->i_max); + + /* + * Compute Integral contribute + * + * note: for computing the integral contribute we use a sample period in seconds + * and so we divide sample_period in microsenconds for 1000. + */ + I = pid_ctx->i_state * pid_ctx->cfg->ki * ((piddata_t)pid_ctx->cfg->sample_period / 1000); + + + /* + * Compute derivative contribute + */ + D = (err - pid_ctx->prev_err) * pid_ctx->cfg->kd / ((piddata_t)pid_ctx->cfg->sample_period / 1000); + + + LOG_INFO("curr_pos[%lf],tgt[%lf],err[%f],P[%f],I[%f],D[%f]", curr_pos, target, err, P, I, D); + + + //Store the last error value + pid_ctx->prev_err = err; + piddata_t pid = MINMAX(pid_ctx->cfg->out_min, (P + I + D), pid_ctx->cfg->out_max); + + LOG_INFO("pid[%lf]",pid); + + //Clamp out between out_min and out_max + return pid; +} + +/** + * Init PID control. + */ +void pid_control_init(PidContext *pid_ctx, const PidCfg *pid_cfg) +{ + /* + * Init all values of pid control struct + */ + pid_ctx->cfg = pid_cfg; + + pid_control_reset(pid_ctx); + +} + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.h new file mode 100644 index 0000000..c21319a --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/pid_control.h @@ -0,0 +1,115 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files instantiate + * templates or use macros or inline functions from this file, or you compile + * this file and link it with other files to produce an executable, this + * file does not by itself cause the resulting executable to be covered by + * the GNU General Public License. This exception does not however + * invalidate any other reasons why the executable file might be covered by + * the GNU General Public License. + * + * Copyright 2008 Develer S.r.l. (http://www.develer.com/) + * --> + * + * + * \brief Proportional, integral, derivative controller (PID controller). + * + * + * \author Daniele Basile <as...@de...> + * + * $WIZ$ module_name = "pid_control" + * $WIZ$ module_depends = "timer" + */ + +#ifndef ALGO_PID_CONTROL_H +#define ALGO_PID_CONTROL_H + +#include <drv/timer.h> + +/** + * Data type for pid coefficient. + */ +typedef float pidk_t; +typedef float piddata_t; + +/** + * PID context structure. + */ +typedef struct PidCfg +{ + pidk_t kp; ///< Proportional term of PID control method (Gain). + pidk_t ki; ///< Integral term of PID control method (Integral Gain). + pidk_t kd; ///< Derivative of PID control method (Derivative Gain). + + piddata_t i_max; ///< Max value of integral term. + piddata_t i_min; ///< Min value of integral term. + + piddata_t out_max; ///< Man value of output. + piddata_t out_min; ///< Min value of output. + + mtime_t sample_period; ///< Sample period in milliseconds. + +} PidCfg; + + +/** + * PID context structure. + */ +typedef struct PidContext +{ + const PidCfg *cfg; + + piddata_t prev_err; ///< Previous error. + piddata_t i_state; ///< Integrator state (sum of all the preceding errors). + +} PidContext; + +/** + * Set Kp, Ki, Kd constants of PID control. + */ +INLINE void pid_control_setPid(PidCfg *pid_cfg, pidk_t kp, pidk_t ki, pidk_t kd) +{ + pid_cfg->kp = kp; + pid_cfg->ki = ki; + pid_cfg->kd = kd; +} + +/** + * Set sample period for PID control. + */ +INLINE void pid_control_setPeriod(PidCfg *pid_cfg, mtime_t sample_period) +{ + pid_cfg->sample_period = sample_period; +} + +/** + * Clear a pid control structure + */ +INLINE void pid_control_reset(PidContext *pid_ctx) +{ + pid_ctx->i_state = 0; + pid_ctx->prev_err = 0; +} + +piddata_t pid_control_update(PidContext *pid_ctx, piddata_t target, piddata_t curr_pos); +void pid_control_init(PidContext *pid_ctx, const PidCfg *pid_cfg); + +#endif /* ALGO_PID_CONTROL_H */ diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.c new file mode 100644 index 0000000..fff8a6c --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.c @@ -0,0 +1,200 @@ +/*! + * \file + * <!-- + * Copyright 2004, 2008 Develer S.r.l. (http://www.develer.com/) + * All Rights Reserved. + * --> + * + * \brief Compute, save and load ramps for stepper motors (implementation) + * + * + * \author Simone Zinanni <s.z...@de...> + * \author Bernie Innocenti <be...@co...> + * \author Giovanni Bajo <ra...@de...> + * \author Daniele Basile <as...@de...> + * + * + * The formula used by the ramp is the following: + * + * <pre> + * a * b + * f(t) = ------------- + * lerp(a,b,t) + * </pre> + * + * Where <code>a</code> and <code>b</code> are the maximum and minimum speed + * respectively (minimum and maximum wavelength respectively), and <code>lerp</code> + * is a linear interpolation with a factor: + * + * <pre> + * lerp(a,b,t) = a + t * (b - a) = (a * (1 - t)) + (b * t) + * </pre> + * + * <code>t</code> must be in the [0,1] interval. It is easy to see that the + * following holds true: + * + * <pre> + * f(0) = b, f(1) = a + * </pre> + * + * And that the function is monotonic. So, the function effectively interpolates + * between the maximum and minimum speed through its domain ([0,1] -> [b,a]). + * + * The curve drawn by this function is similar to 1 / (sqrt(n)), so it is slower + * than a linear acceleration (which would be 1/n). + * + * The floating point version uses a slightly modified function which accepts + * the parameter in the domain [0, MT] (where MT is maxTime, the length of the + * ramp, which is a setup parameter for the ramp). This is done to reduce the + * number of operations per step. The formula looks like this: + * + * <pre> + * a * b * MT + * g(t) = ---------------------------- + * (a * MT) + t * (b - a) + * </pre> + * + * It can be shown that this <code>g(t) = f(t * MT)</code>. The denominator + * is a linear interpolation in the range [b*MT, a*MT], as t moves in the + * interval [0, MT]. So the interpolation interval of the function is again + * [b, a]. The implementation caches the value of the numerator and parts + * of the denominator, so that the formula becomes: + * + * <pre> + * alpha = a * b * MT + * beta = a * MT + * gamma = b - a + * + * alpha + * g(t) = ---------------------- + * beta + t * gamma + * </pre> + * + * and <code>t</code> is exactly the parameter that ramp_evaluate() gets, + * that is the current time (in range [0, MT]). The operations performed + * for each step are just an addition, a multiplication and a division. + * + * The fixed point version of the formula instead transforms the original + * function as follows: + * + * <pre> + * a * b a + * f(t) = ------------------------- = -------------------- + * a a + * b * ( - * (1 - t) + t ) - * (1 - t) + t + * b b + * </pre> + * + * <code>t</code> must be computed by dividing the current time (24 bit integer) + * by the maximum time (24 bit integer). This is done by precomputing the + * reciprocal of the maximum time as a 0.32 fixed point number, and multiplying + * it to the current time. Multiplication is performed 8-bits a time by + * FIX_MULT32(), so that we end up with a 0.16 fixed point number for + * <code>t</code> (and <code>1-t</code> is just its twos-complement negation). + * <code>a/b</code> is in the range [0,1] (because a is always less than b, + * being the minimum wavelength), so it is precomputed as a 0.16 fixed point. + * The final step is then computing the denominator and executing the division + * (32 cycles using the 1-step division instruction in the DSP). + * + * The assembly implementation is needed for efficiency, but a C version of it + * can be easily written, in case it is needed in the future. + * + */ + +#include "ramp.h" +#include <cfg/debug.h> + +#include <string.h> // memcpy() + +void ramp_compute(struct Ramp *ramp, uint32_t clocksRamp, uint16_t clocksMinWL, uint16_t clocksMaxWL) +{ + ASSERT(clocksMaxWL >= clocksMinWL); + + // Save values in ramp struct + ramp->clocksRamp = clocksRamp; + ramp->clocksMinWL = clocksMinWL; + ramp->clocksMaxWL = clocksMaxWL; + +#if RAMP_USE_FLOATING_POINT + ramp->precalc.gamma = ramp->clocksMaxWL - ramp->clocksMinWL; + ramp->precalc.beta = (float)ramp->clocksMinWL * (float)ramp->clocksRamp; + ramp->precalc.alpha = ramp->precalc.beta * (float)ramp->clocksMaxWL; + +#else + ramp->precalc.max_div_min = ((uint32_t)clocksMinWL << 16) / (uint32_t)clocksMaxWL; + + /* Calcola 1/total_time in fixed point .32. Assumiamo che la rampa possa al + * massimo avere 25 bit (cioé valore in tick fino a 2^25, che con il + * prescaler=3 sono circa 7 secondi). Inoltre, togliamo qualche bit di precisione + * da destra (secondo quanto specificato in RAMP_CLOCK_SHIFT_PRECISION). + */ + ASSERT(ramp->clocksRamp < (1UL << (24 + RAMP_CLOCK_SHIFT_PRECISION))); + ramp->precalc.inv_total_time = 0xFFFFFFFFUL / (ramp->clocksRamp >> RAMP_CLOCK_SHIFT_PRECISION); + ASSERT(ramp->precalc.inv_total_time < 0x1000000UL); + +#endif +} + + +void ramp_setup(struct Ramp* ramp, uint32_t length, uint32_t minFreq, uint32_t maxFreq) +{ + uint32_t minWL, maxWL; + + minWL = TIME2CLOCKS(FREQ2MICROS(maxFreq)); + maxWL = TIME2CLOCKS(FREQ2MICROS(minFreq)); + + ASSERT2(minWL < 65536UL, "Maximum frequency too high"); + ASSERT2(maxWL < 65536UL, "Minimum frequency too high"); + ASSERT(maxFreq > minFreq); + + ramp_compute( + ramp, + TIME2CLOCKS(length), + TIME2CLOCKS(FREQ2MICROS(maxFreq)), + TIME2CLOCKS(FREQ2MICROS(minFreq)) + ); +} + +void ramp_default(struct Ramp *ramp) +{ + ramp_setup(ramp, RAMP_DEF_TIME, RAMP_DEF_MINFREQ, RAMP_DEF_MAXFREQ); +} + +#if RAMP_USE_FLOATING_POINT + +float ramp_evaluate(const struct Ramp* ramp, float curClock) +{ + return ramp->precalc.alpha / (curClock * ramp->precalc.gamma + ramp->precalc.beta); +} + +#else + +INLINE uint32_t fix_mult32(uint32_t m1, uint32_t m2) +{ + uint32_t accum = 0; + accum += m1 * ((m2 >> 0) & 0xFF); + accum >>= 8; + accum += m1 * ((m2 >> 8) & 0xFF); + accum >>= 8; + accum += m1 * ((m2 >> 16) & 0xFF); + return accum; +} + +// a*b >> 16 +INLINE uint16_t fix_mult16(uint16_t a, uint32_t b) +{ + return (b*(uint32_t)a) >> 16; +} + +uint16_t FAST_FUNC ramp_evaluate(const struct Ramp* ramp, uint32_t curClock) +{ + uint16_t t = FIX_MULT32(curClock >> RAMP_CLOCK_SHIFT_PRECISION, ramp->precalc.inv_total_time); + uint16_t denom = fix_mult16((uint16_t)~t + 1, ramp->precalc.max_div_min) + t; + uint16_t cur_delta = ((uint32_t)ramp->clocksMinWL << 16) / denom; + + return cur_delta; +} + +#endif + + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.h b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.h new file mode 100644 index 0000000..ad3c919 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp.h @@ -0,0 +1,166 @@ +/** + * \file + * <!-- + * Copyright 2004, 2008 Develer S.r.l. (http://www.develer.com/) + * All Rights Reserved. + * --> + * + * \brief Compute, save and load ramps for stepper motors. + * + * The acceleration ramp is used to properly accelerate a stepper motor. The main + * entry point is the function ramp_evaluate(), which must be called at every step + * of the motor: it gets as input the time elapsed since the stepper started + * accelerating, and returns the time to wait before sending the next step. A pseudo + * usage pattern is as follows: + * + * <pre> + * float time = 0; + * while (1) + * { + * float delta = ramp_evaluate(&my_ramp, time); + * sleep(delta); + * do_motor_step(); + * time += delta; + * } + * </pre> + * + * A similar pattern can be used to decelerate (it is sufficient to move the total + * time backward, such as "time -= delta"). + * + * The ramp can be configured with ramp_setup(), providing it with the minimum and + * maximum operating frequency of the motor, and the total acceleration time in + * milliseconds (that is, the time that will be needed to accelerate from the + * minimum frequency to the maximum frequency). + * + * Both a very precise floating point and a very fast fixed point implementation + * of the ramp evaluation are provided. The fixed point is hand-optimized assembly + * for DSP56000 (but a portable C version of it can be easily written, see the + * comments in the code). + * + * + * \author Simone Zinanni <s.z...@de...> + * \author Giovanni Bajo <ra...@de...> + * \author Daniele Basile <as...@de...> + * + * $WIZ$ module_name = "ramp" + * $WIZ$ module_configuration = "bertos/cfg/cfg_ramp.h" + */ + +#ifndef ALGO_RAMP_H +#define ALGO_RAMP_H + +#include "hw/hw_stepper.h" + +#include "cfg/cfg_ramp.h" + +#include <cfg/compiler.h> + + +/** + * Convert microseconds to timer clock ticks + */ +#define TIME2CLOCKS(micros) ((uint32_t)(micros) * (STEPPER_CLOCK / 1000000)) + +/** + * Convert timer clock ticks back to microseconds + */ +#define CLOCKS2TIME(clocks) ((uint32_t)(clocks) / (STEPPER_CLOCK / 1000000)) + +/** + * Convert microseconds to Hz + */ +#define MICROS2FREQ(micros) (1000000UL / ((uint32_t)(micros))) + +/** + * Convert frequency (in Hz) to time (in microseconds) + */ +#define FREQ2MICROS(hz) (1000000UL / ((uint32_t)(hz))) + +/** + * Multiply \p a and \p b two integer at 32 bit and extract the high 16 bit word. + */ +#define FIX_MULT32(a,b) (((uint64_t)(a)*(uint32_t)(b)) >> 16) + +/** + * Structure holding pre-calculated data for speeding up real-time evaluation + * of the ramp. This structure is totally different between the fixed and the + * floating point version of the code. + * + * Consult the file-level documentation of ramp.c for more information about + * the values of this structure. + */ +struct RampPrecalc +{ +#if RAMP_USE_FLOATING_POINT + float beta; + float alpha; + float gamma; +#else + uint16_t max_div_min; + uint32_t inv_total_time; +#endif +}; + + +/** + * Ramp structure + */ +struct Ramp +{ + uint32_t clocksRamp; + uint16_t clocksMinWL; + uint16_t clocksMaxWL; + + struct RampPrecalc precalc; ///< pre-calculated values for speed +}; + + +/* + * Function prototypes + */ +void ramp_compute( + struct Ramp * ramp, + uint32_t clocksInRamp, + uint16_t clocksInMinWavelength, + uint16_t clocksInMaxWavelength); + + +/** Setup an acceleration ramp for a stepper motor + * + * \param ramp Ramp to fill + * \param length Length of the ramp (milliseconds) + * \param minFreq Minimum operating frequency of the motor (hertz) + * \param maxFreq Maximum operating frequency of the motor (hertz) + * + */ +void ramp_setup(struct Ramp* ramp, uint32_t length, uint32_t minFreq, uint32_t maxFreq); + + +/** + * Initialize a new ramp with default values + */ +void ramp_default(struct Ramp *ramp); + + +/** + * Evaluate the ramp at the given point. Given a \a ramp, and the current \a clock since + * the start of the acceleration, compute the next step, that is the interval at which + * send the signal to the motor. + * + * \note The fixed point version does not work when curClock is zero. Anyway, + * the first step is always clocksMaxWL, as stored within the ramp structure. + */ +#if RAMP_USE_FLOATING_POINT + float ramp_evaluate(const struct Ramp* ramp, float curClock); +#else + uint16_t ramp_evaluate(const struct Ramp* ramp, uint32_t curClock); +#endif + + +/** Self test */ +int ramp_testSetup(void); +int ramp_testRun(void); +int ramp_testTearDown(void); + +#endif /* ALGO_RAMP_H */ + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp_test.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp_test.c new file mode 100644 index 0000000..0e7d58c --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/ramp_test.c @@ -0,0 +1,186 @@ +/*! + * \file + * <!-- + * Copyright 2004, 2008 Develer S.r.l. (http://www.develer.com/) + * All Rights Reserved. + * --> + * + * \brief Test for compute, save and load ramps for stepper motors (implementation) + * + * + * \author Simone Zinanni <s.z...@de...> + * \author Bernie Innocenti <be...@co...> + * \author Giovanni Bajo <ra...@de...> + * \author Daniele Basile <as...@de...> + * + * + * The formula used by the ramp is the following: + * + * <pre> + * a * b + * f(t) = ------------- + * lerp(a,b,t) + * </pre> + * + * Where <code>a</code> and <code>b</code> are the maximum and minimum speed + * respectively (minimum and maximum wavelength respectively), and <code>lerp</code> + * is a linear interpolation with a factor: + * + * <pre> + * lerp(a,b,t) = a + t * (b - a) = (a * (1 - t)) + (b * t) + * </pre> + * + * <code>t</code> must be in the [0,1] interval. It is easy to see that the + * following holds true: + * + * <pre> + * f(0) = b, f(1) = a + * </pre> + * + * And that the function is monotonic. So, the function effectively interpolates + * between the maximum and minimum speed through its domain ([0,1] -> [b,a]). + * + * The curve drawn by this function is similar to 1 / (sqrt(n)), so it is slower + * than a linear acceleration (which would be 1/n). + * + * The floating point version uses a slightly modified function which accepts + * the parameter in the domain [0, MT] (where MT is maxTime, the length of the + * ramp, which is a setup parameter for the ramp). This is done to reduce the + * number of operations per step. The formula looks like this: + * + * <pre> + * a * b * MT + * g(t) = ---------------------------- + * (a * MT) + t * (b - a) + * </pre> + * + * It can be shown that this <code>g(t) = f(t * MT)</code>. The denominator + * is a linear interpolation in the range [b*MT, a*MT], as t moves in the + * interval [0, MT]. So the interpolation interval of the function is again + * [b, a]. The implementation caches the value of the numerator and parts + * of the denominator, so that the formula becomes: + * + * <pre> + * alpha = a * b * MT + * beta = a * MT + * gamma = b - a + * + * alpha + * g(t) = ---------------------- + * beta + t * gamma + * </pre> + * + * and <code>t</code> is exactly the parameter that ramp_evaluate() gets, + * that is the current time (in range [0, MT]). The operations performed + * for each step are just an addition, a multiplication and a division. + * + * The fixed point version of the formula instead transforms the original + * function as follows: + * + * <pre> + * a * b a + * f(t) = ------------------------- = -------------------- + * a a + * b * ( - * (1 - t) + t ) - * (1 - t) + t + * b b + * </pre> + * + * <code>t</code> must be computed by dividing the current time (24 bit integer) + * by the maximum time (24 bit integer). This is done by precomputing the + * reciprocal of the maximum time as a 0.32 fixed point number, and multiplying + * it to the current time. Multiplication is performed 8-bits a time by + * FIX_MULT32(), so that we end up with a 0.16 fixed point number for + * <code>t</code> (and <code>1-t</code> is just its twos-complement negation). + * <code>a/b</code> is in the range [0,1] (because a is always less than b, + * being the minimum wavelength), so it is precomputed as a 0.16 fixed point. + * The final step is then computing the denominator and executing the division + * (32 cycles using the 1-step division instruction in the DSP). + * + * The assembly implementation is needed for efficiency, but a C version of it + * can be easily written, in case it is needed in the future. + * + */ + +#include "ramp.h" +#include <cfg/debug.h> +#include <cfg/test.h> + + +static bool ramp_test_single(uint32_t minFreq, uint32_t maxFreq, uint32_t length) +{ + struct Ramp r; + uint16_t cur, old; + uint32_t clock; + uint32_t oldclock; + + ramp_setup(&r, length, minFreq, maxFreq); + + cur = old = r.clocksMaxWL; + clock = 0; + oldclock = 0; + + kprintf("testing ramp: (length=%lu, min=%lu, max=%lu)\n", (unsigned long)length, (unsigned long)minFreq, (unsigned long)maxFreq); + kprintf(" [length=%lu, max=%04x, min=%04x]\n", (unsigned long)r.clocksRamp, r.clocksMaxWL, r.clocksMinWL); + + int i = 0; + int nonbyte = 0; + + while (clock + cur < r.clocksRamp) + { + oldclock = clock; + old = cur; + + clock += cur; + cur = ramp_evaluate(&r, clock); + + if (old < cur) + { + uint16_t t1 = FIX_MULT32(oldclock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); + uint16_t t2 = FIX_MULT32(clock >> RAMP_CLOCK_SHIFT_PRECISION, r.precalc.inv_total_time); + uint16_t denom1 = FIX_MULT32((uint16_t)((~t1) + 1), r.precalc.max_div_min) + t1; + uint16_t denom2 = FIX_MULT32((uint16_t)((~t2) + 1), r.precalc.max_div_min) + t2; + + kprintf(" Failed: %04x @ %lu --> %04x @ %lu\n", old, (unsigned long)oldclock, cur, (unsigned long)clock); + kprintf(" T: %04x -> %04x\n", t1, t2); + kprintf(" DENOM: %04x -> %04x\n", denom1, denom2); + + cur = ramp_evaluate(&r, clock); + return false; + } + i++; + if ((old-cur) >= 256) + nonbyte++; + } + + + + kprintf("Test finished: %04x @ %lu [min=%04x, totlen=%lu, numsteps:%d, nonbyte:%d]\n", cur, (unsigned long)clock, r.clocksMinWL, (unsigned long)r.clocksRamp, i, nonbyte); + + return true; +} + +int ramp_testSetup(void) +{ + kdbg_init(); + return 0; +} + +int ramp_testTearDown(void) +{ + return 0; +} + +int ramp_testRun(void) +{ + #define TEST_RAMP(min, max, len) do { \ + if (!ramp_test_single(min, max, len)) \ + return -1; \ + } while(0) + + TEST_RAMP(200, 5000, 3000000); + TEST_RAMP(1000, 2000, 1000000); + + return 0; +} + +TEST_MAIN(ramp); diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/rand.c b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/rand.c new file mode 100644 index 0000000..901e23f --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/bertos/algo/rand.c @@ -0,0 +1,52 @@ +/** + * \file + * <!-- + * This file is part of BeRTOS. + * + * Bertos is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * As a special exception, you may use this file as part of a free software + * library without restriction. Specifically, if other files ins... [truncated message content] |
From: Olivier B. <Ba...@us...> - 2011-05-29 22:24:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 1ed43bec7729c6f008dcd6d1fde00c24e44a4854 (commit) from 3a6ff5c10518195cb32e982dd6650e87d204f66f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1ed43bec7729c6f008dcd6d1fde00c24e44a4854 Author: Olivier BICHLER <oli...@cr...> Date: Mon May 30 00:23:56 2011 +0200 [Sensor Actuator] Added PCB PDF exports + minor fix in silkscreen ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Sensor_Actuator/PCB/PDF/Bottom Layer.pdf b/elec/boards/Sensor_Actuator/PCB/PDF/Bottom Layer.pdf new file mode 100644 index 0000000..e5b5b10 Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/PDF/Bottom Layer.pdf differ diff --git a/elec/boards/Sensor_Actuator/PCB/PDF/Drill Drawing.pdf b/elec/boards/Sensor_Actuator/PCB/PDF/Drill Drawing.pdf new file mode 100644 index 0000000..8192cc4 Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/PDF/Drill Drawing.pdf differ diff --git a/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Bottom.pdf b/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Bottom.pdf new file mode 100644 index 0000000..bb243a6 Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Bottom.pdf differ diff --git a/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Top.pdf b/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Top.pdf new file mode 100644 index 0000000..250918e Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/PDF/Silkscreen Top.pdf differ diff --git a/elec/boards/Sensor_Actuator/PCB/PDF/Top Layer.pdf b/elec/boards/Sensor_Actuator/PCB/PDF/Top Layer.pdf new file mode 100644 index 0000000..ee587d0 Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/PDF/Top Layer.pdf differ diff --git a/elec/boards/Sensor_Actuator/PCB/SENSOR ACTUATOR-1_1.MAX b/elec/boards/Sensor_Actuator/PCB/SENSOR ACTUATOR-1_1.MAX new file mode 100644 index 0000000..5ba7811 Binary files /dev/null and b/elec/boards/Sensor_Actuator/PCB/SENSOR ACTUATOR-1_1.MAX differ hooks/post-receive -- krobot |
From: Pierre C. <Ba...@us...> - 2011-05-29 17:23:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 3a6ff5c10518195cb32e982dd6650e87d204f66f (commit) from 97c00ff7a3292278cb11474f3432f40d9f9a09fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3a6ff5c10518195cb32e982dd6650e87d204f66f Author: chambart <cha...@cr...> Date: Sun May 29 19:23:10 2011 +0200 [info] avoid wall in pathfinding ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_pathfinding.ml b/info/control2011/src/lib/krobot_pathfinding.ml index 47f77d8..be9b3fa 100644 --- a/info/control2011/src/lib/krobot_pathfinding.ml +++ b/info/control2011/src/lib/krobot_pathfinding.ml @@ -129,7 +129,8 @@ include Tangentes type board = { src : point; dst : point; - obstacles : circle list; } + obstacles : circle list; + box : point*point } type tangente = { orig : point; @@ -143,16 +144,17 @@ type result = { path : segment list; length : float } +let middle s p = + ( scal + (vect s.p1 s.p2) + (vect s.p1 p) >= 0. ) + && ( scal + (vect s.p2 s.p1) + (vect s.p2 p) >= 0. ) + + let distance' s nv p = - let middle = - ( scal - (vect s.p1 s.p2) - (vect s.p1 p) >= 0. ) - && ( scal - (vect s.p2 s.p1) - (vect s.p2 p) >= 0. ) - in - if middle + if middle s p then abs_float (scal (turn_trigo nv) (vect s.p1 p)) else @@ -233,6 +235,9 @@ let intersect l1 l2 = let after {p1;p2} p = scal (vect p1 p2) (vect p2 p) >= 0. +let in_box (p1,p2) p = + p1.px <= p.px && p1.py <= p.py && p2.px >= p.px && p2.py >= p.py + let make_tangente b t c ({p1;p2} as s) = if (scal (line s).v (vect t.contact t.circle.c) >= 0.) && (check_segment_circle b (t.circle,c) s) @@ -242,7 +247,8 @@ let make_tangente b t c ({p1;p2} as s) = match intersect l1 l2 with | None -> None | Some inter -> - if (after {p1 = t.orig;p2 = t.contact} inter) + if (in_box b.box inter) + && (after {p1 = t.orig;p2 = t.contact} inter) && (check_segment_circle b (t.circle,c) {p1 = inter; p2 = t.contact}) then Some { distance = norm (vect t.orig inter) +. t.distance; @@ -336,8 +342,14 @@ let v_of_vertice { Krobot_geom.x; y } = let vertice_of_seg { p1 = {px;py} } = { Krobot_geom.x = px; y = py } -let find_path ~src ~dst objects = - let b = { src = v_of_vertice src; - dst = v_of_vertice dst; - obstacles = List.map (fun (v,r) -> { c = v_of_vertice v; r }) objects; } in - map_option (fun res -> List.rev_map vertice_of_seg res.path) (fst (stepn b 10)) +let find_path ~src ~dst (box_min,box_max) objects = + let box = (v_of_vertice box_min, v_of_vertice box_max) in + let dst = v_of_vertice dst in + if not (in_box box dst) + then None + else + let b = { src = v_of_vertice src; + dst; + obstacles = List.map (fun (v,r) -> { c = v_of_vertice v; r }) objects; + box } in + map_option (fun res -> List.rev_map vertice_of_seg res.path) (fst (stepn b 10)) diff --git a/info/control2011/src/lib/krobot_pathfinding.mli b/info/control2011/src/lib/krobot_pathfinding.mli index 3719e4c..1b6644d 100644 --- a/info/control2011/src/lib/krobot_pathfinding.mli +++ b/info/control2011/src/lib/krobot_pathfinding.mli @@ -1,6 +1,9 @@ +open Krobot_geom + val find_path : - src:Krobot_geom.vertice -> - dst:Krobot_geom.vertice -> - ( Krobot_geom.vertice * float ) list -> - Krobot_geom.vertice list option + src:vertice -> + dst:vertice -> + vertice * vertice -> + ( vertice * float ) list -> + vertice list option diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index 312deea..b47756e 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -71,9 +71,13 @@ let border_safety_distance = sqrt (sqr robot_size /. 2.) +. 0.05 let object_safety_distance = object_radius +. robot_size /. 2. let find_path planner src dst = - let objects = List.filter (fun obj -> distance dst obj >= object_radius) planner.objects in + let objects = List.filter (fun obj -> distance dst obj >= object_safety_distance) planner.objects in match Krobot_pathfinding.find_path ~src ~dst + ({ x = border_safety_distance; + y = border_safety_distance}, + { x = world_width -. border_safety_distance; + y = world_height -. border_safety_distance}) (List.map (fun v -> v,object_safety_distance) objects) with | None -> [] hooks/post-receive -- krobot |
From: Pierre C. <Ba...@us...> - 2011-05-29 16:36:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 97c00ff7a3292278cb11474f3432f40d9f9a09fb (commit) from 23679818e579d02c51823757eac4e73395bfacbd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 97c00ff7a3292278cb11474f3432f40d9f9a09fb Author: chambart <cha...@cr...> Date: Sun May 29 18:31:00 2011 +0200 [info] change the pathfinding algorithm ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index 337a6f5..f70581e 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -38,6 +38,8 @@ Library krobot Krobot_bus, Krobot_message, Krobot_geom, + Krobot_solve, + Krobot_pathfinding, Krobot_config CSources: krobot_message_stubs.c @@ -153,7 +155,7 @@ Executable "krobot-planner" Install: true CompiledObject: best MainIs: krobot_planner.ml - BuildDepends: krobot, lwt.syntax, ocamlgraph + BuildDepends: krobot, lwt.syntax Executable "krobot-objects" Path: src/tools diff --git a/info/control2011/_tags b/info/control2011/_tags index 14d98e6..b7b7b29 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 2b0a35e51cf2e902c1aae093db385268) +# DO NOT EDIT (digest: b3a149aa36135c075418226bdf8c680d) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -44,11 +44,9 @@ <examples/dump_can.{native,byte}>: pkg_lwt.react # Executable krobot-planner <src/tools/krobot_planner.{native,byte}>: use_krobot -<src/tools/krobot_planner.{native,byte}>: pkg_ocamlgraph <src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix <src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_planner.{native,byte}>: pkg_lwt.react -<src/tools/*.ml{,i}>: pkg_ocamlgraph # Executable krobot-record <src/tools/krobot_record.{native,byte}>: use_krobot <src/tools/krobot_record.{native,byte}>: pkg_lwt.unix diff --git a/info/control2011/krobot-api.odocl b/info/control2011/krobot-api.odocl index 1e10a3e..089c86e 100644 --- a/info/control2011/krobot-api.odocl +++ b/info/control2011/krobot-api.odocl @@ -1,9 +1,11 @@ # OASIS_START -# DO NOT EDIT (digest: 802a60f0417652c8e0b1a85294fd57f0) +# DO NOT EDIT (digest: a359da43dcf8c8c6335f80cc41192c30) src/lib/Krobot_can src/lib/Krobot_bus src/lib/Krobot_message src/lib/Krobot_geom +src/lib/Krobot_solve +src/lib/Krobot_pathfinding src/lib/Krobot_config src/can/Krobot_can_bus # OASIS_STOP diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 5fd4717..c4bd087 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,7 +1,7 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: d2e269dc4718223067ec6884e511c44b) *) +(* DO NOT EDIT (digest: fd331bd6e5dd6cce06b8b38cd2cc1f54) *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISGettext.ml" let ns_ str = str @@ -24,7 +24,7 @@ module OASISGettext = struct end module OASISExpr = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISExpr.ml" @@ -115,7 +115,7 @@ end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) @@ -212,7 +212,7 @@ end module MyOCamlbuildFindlib = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild @@ -321,7 +321,7 @@ module MyOCamlbuildFindlib = struct end module MyOCamlbuildBase = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall @@ -336,7 +336,7 @@ module MyOCamlbuildBase = struct type name = string type tag = string -# 55 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 55 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index b4b7d73..c7a5e35 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,14 +1,14 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 710ef41bf3f100a1f1ecd818da6623e3) *) +(* DO NOT EDIT (digest: 65ad0f8cf4ed7e4123fb286c493fdac9) *) (* Regenerated by OASIS v0.2.1~alpha1 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISGettext.ml" let ns_ str = str @@ -31,7 +31,7 @@ module OASISGettext = struct end module OASISContext = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISContext.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISContext.ml" open OASISGettext @@ -86,7 +86,7 @@ module OASISContext = struct end module OASISUtils = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUtils.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISUtils.ml" module MapString = Map.Make(String) @@ -225,7 +225,7 @@ module OASISUtils = struct end module PropList = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/PropList.ml" open OASISGettext @@ -260,7 +260,7 @@ module PropList = struct let clear t = Hashtbl.clear t -# 66 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" +# 66 "/home/chambart/bordel/oasis_0/src/oasis/PropList.ml" end module Schema = @@ -501,7 +501,7 @@ module PropList = struct end module OASISMessage = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISMessage.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISMessage.ml" open OASISGettext @@ -550,7 +550,7 @@ module OASISMessage = struct end module OASISVersion = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISVersion.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISVersion.ml" open OASISGettext @@ -738,7 +738,7 @@ module OASISVersion = struct end module OASISLicense = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLicense.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISLicense.ml" (** License for _oasis fields @author Sylvain Le Gall @@ -771,7 +771,7 @@ module OASISLicense = struct end module OASISExpr = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISExpr.ml" @@ -861,7 +861,7 @@ module OASISExpr = struct end module OASISTypes = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISTypes.ml" @@ -938,7 +938,7 @@ module OASISTypes = struct type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list -# 102 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" +# 102 "/home/chambart/bordel/oasis_0/src/oasis/OASISTypes.ml" type 'a conditional = 'a OASISExpr.choices @@ -1095,7 +1095,7 @@ module OASISTypes = struct end module OASISUnixPath = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUnixPath.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISUnixPath.ml" type unix_filename = string type unix_dirname = string @@ -1174,7 +1174,7 @@ module OASISUnixPath = struct end module OASISSection = struct -# 1 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSection.ml" +# 1 "/home/chambart/bordel/oasis_0/src/oasis/OASISSection.ml" open OASISTypes let section_kind_common = @@ -1228,12 +1228,12 @@ module OASISSection = struct end module OASISBuildSection = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISBuildSection.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISBuildSection.ml" end module OASISExecutable = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExecutable.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISExecutable.ml" open OASISTypes @@ -1264,7 +1264,7 @@ module OASISExecutable = struct end module OASISLibrary = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLibrary.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISLibrary.ml" open OASISTypes open OASISUtils @@ -1555,33 +1555,33 @@ module OASISLibrary = struct end module OASISFlag = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISFlag.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISFlag.ml" end module OASISPackage = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISPackage.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSourceRepository.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISSourceRepository.ml" end module OASISTest = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTest.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISTest.ml" end module OASISDocument = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISDocument.ml" +# 21 "/home/chambart/bordel/oasis_0/src/oasis/OASISDocument.ml" end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) @@ -1678,7 +1678,7 @@ end module BaseContext = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseContext.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseContext.ml" open OASISContext @@ -1689,7 +1689,7 @@ module BaseContext = struct end module BaseMessage = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseMessage.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseMessage.ml" (** Message to user, overrid for Base @author Sylvain Le Gall @@ -1710,7 +1710,7 @@ module BaseMessage = struct end module BaseFilePath = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseFilePath.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseFilePath.ml" open Filename @@ -1742,7 +1742,7 @@ module BaseFilePath = struct end module BaseEnv = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnv.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseEnv.ml" open OASISGettext open OASISUtils @@ -2197,7 +2197,7 @@ module BaseEnv = struct end module BaseExec = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseExec.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseExec.ml" open OASISGettext open OASISUtils @@ -2257,7 +2257,7 @@ module BaseExec = struct end module BaseFileUtil = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseFileUtil.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseFileUtil.ml" open OASISGettext @@ -2435,7 +2435,7 @@ module BaseFileUtil = struct end module BaseArgExt = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseArgExt.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseArgExt.ml" open OASISUtils open OASISGettext @@ -2463,7 +2463,7 @@ module BaseArgExt = struct end module BaseCheck = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseCheck.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseCheck.ml" open BaseEnv open BaseMessage @@ -2589,7 +2589,7 @@ module BaseCheck = struct end module BaseOCamlcConfig = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseOCamlcConfig.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseOCamlcConfig.ml" open BaseEnv @@ -2699,7 +2699,7 @@ module BaseOCamlcConfig = struct end module BaseStandardVar = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseStandardVar.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseStandardVar.ml" open OASISGettext @@ -2958,7 +2958,7 @@ module BaseStandardVar = struct end module BaseFileAB = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseFileAB.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseFileAB.ml" open BaseEnv open OASISGettext @@ -3006,7 +3006,7 @@ module BaseFileAB = struct end module BaseLog = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseLog.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseLog.ml" open OASISUtils @@ -3125,7 +3125,7 @@ module BaseLog = struct end module BaseBuilt = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseBuilt.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseBuilt.ml" open OASISTypes open OASISGettext @@ -3272,7 +3272,7 @@ module BaseBuilt = struct end module BaseCustom = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseCustom.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseCustom.ml" open BaseEnv open BaseMessage @@ -3322,7 +3322,7 @@ module BaseCustom = struct end module BaseDynVar = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseDynVar.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseDynVar.ml" open OASISTypes @@ -3366,7 +3366,7 @@ module BaseDynVar = struct end module BaseTest = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseTest.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseTest.ml" open BaseEnv open BaseMessage @@ -3448,7 +3448,7 @@ module BaseTest = struct end module BaseDoc = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseDoc.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseDoc.ml" open BaseEnv open BaseMessage @@ -3478,7 +3478,7 @@ module BaseDoc = struct end module BaseSetup = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseSetup.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseSetup.ml" open BaseEnv open BaseMessage @@ -3896,7 +3896,7 @@ module BaseSetup = struct end module BaseDev = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseDev.ml" +# 21 "/home/chambart/bordel/oasis_0/src/base/BaseDev.ml" @@ -3954,7 +3954,7 @@ end module InternalConfigurePlugin = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/internal/InternalConfigurePlugin.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/internal/InternalConfigurePlugin.ml" (** Configure using internal scheme @author Sylvain Le Gall @@ -4170,7 +4170,7 @@ module InternalConfigurePlugin = struct end module InternalInstallPlugin = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/internal/InternalInstallPlugin.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/internal/InternalInstallPlugin.ml" (** Install using internal scheme @author Sylvain Le Gall @@ -4574,7 +4574,7 @@ end module OCamlbuildCommon = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/OCamlbuildCommon.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/OCamlbuildCommon.ml" (** Functions common to OCamlbuild build and doc plugin *) @@ -4674,7 +4674,7 @@ module OCamlbuildCommon = struct end module OCamlbuildPlugin = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" (** Build using ocamlbuild @author Sylvain Le Gall @@ -4846,7 +4846,7 @@ module OCamlbuildPlugin = struct end module OCamlbuildDocPlugin = struct -# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" +# 21 "/home/chambart/bordel/oasis_0/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall @@ -5004,6 +5004,8 @@ let setup_t = "Krobot_bus"; "Krobot_message"; "Krobot_geom"; + "Krobot_solve"; + "Krobot_pathfinding"; "Krobot_config" ]; lib_internal_modules = []; @@ -5113,8 +5115,7 @@ let setup_t = bs_build_depends = [ InternalLibrary "krobot"; - FindlibPackage ("lwt.syntax", None); - FindlibPackage ("ocamlgraph", None) + FindlibPackage ("lwt.syntax", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"]; bs_c_sources = []; diff --git a/info/control2011/src/lib/krobot.mllib b/info/control2011/src/lib/krobot.mllib index a445537..350b267 100644 --- a/info/control2011/src/lib/krobot.mllib +++ b/info/control2011/src/lib/krobot.mllib @@ -1,8 +1,10 @@ # OASIS_START -# DO NOT EDIT (digest: cd69d2910ad86f88b392f7a3935ab5c4) +# DO NOT EDIT (digest: b2880f314f76dff19566bda211d28310) Krobot_can Krobot_bus Krobot_message Krobot_geom +Krobot_solve +Krobot_pathfinding Krobot_config # OASIS_STOP diff --git a/info/control2011/src/lib/krobot_pathfinding.ml b/info/control2011/src/lib/krobot_pathfinding.ml new file mode 100644 index 0000000..47f77d8 --- /dev/null +++ b/info/control2011/src/lib/krobot_pathfinding.ml @@ -0,0 +1,343 @@ +let rec map_filter f = function + | [] -> [] + | t::q -> + match f t with + | None -> map_filter f q + | Some v -> v::(map_filter f q) + +let map_option f = function + | None -> None + | Some v -> Some (f v) + +let iter_option f = function + | None -> () + | Some v -> f v + +module Vect = struct + + type point = { px : float; py : float } + type vect = { vx : float; vy : float } + type circle = { c : point; r : float } + type segment = { p1 : point; p2 : point } + type line = { p : point; v : vect } + + let epsilon = 0.0000000001 + + let vect p1 p2 = { vx = p2.px -. p1.px; vy = p2.py -. p1.py } + + let ( +! ) p v = { px = v.vx +. p.px; py = v.vy +. p.py } + let ( -! ) p v = { px = p.px -. v.vx; py = p.py -. v.vy } + + let ( +| ) v1 v2 = { vx = v1.vx +. v2.vx; vy = v1.vy +. v2.vy } + let ( -| ) v1 v2 = { vx = v1.vx -. v2.vx; vy = v1.vy -. v2.vy } + let ( *@ ) n v = { vx = n *. v.vx; vy = n *. v.vy } + let norm2 { vx; vy } = vx*.vx +. vy*.vy + let norm v = sqrt (norm2 v) + let unitaire v = ( 1. /. (norm v) ) *@ v + let turn_trigo { vx; vy } = { vx = -. vy; vy = vx } + let turn_antitrigo { vx; vy } = { vx = vy; vy = -. vx } + let line s = { p = s.p1; v = vect s.p1 s.p2 } + let scal v1 v2 = v1.vx *. v2.vx +. v1.vy *. v2.vy + let colineaire v1 v2 = abs_float (v1.vx *. v2.vy -. v1.vy *. v2.vx) < epsilon + + let distance s p = + let middle = + ( scal + (vect s.p1 s.p2) + (vect s.p1 p) >= 0. ) + && ( scal + (vect s.p2 s.p1) + (vect s.p2 p) >= 0. ) + in + if middle + then + let l = line s in + let nv = unitaire l.v in + abs_float (scal (turn_trigo nv) (vect s.p1 p)) + else + min (norm (vect s.p1 p)) (norm (vect s.p2 p)) + +end + +module Tangentes = struct + open Vect + + type 'a opt = + | One of 'a + | Two of ('a * 'a) + + let map_opt f = function + | One v -> One (f v) + | Two (v1,v2) -> Two (f v1,f v2) + + let iter_opt f = function + | One v -> f v + | Two (v1,v2) -> f v1; f v2 + + let p_iso c1 c2 = + if c1.r <> c2.r + then + let cm,cM = if c1.r < c2.r then c1,c2 else c2,c1 in + let ba = vect cM.c cm.c in + let p1 = cm.c +! (( cm.r /. ( cM.r -. cm.r ) ) *@ ba) in + let p2 = cM.c +! (( cM.r /. ( cM.r +. cm.r ) ) *@ ba) in + Two (p1,p2) + else + let ba = vect c1.c c2.c in + One (c1.c +! ( 0.5 *@ ba )) + + let tangentes_point_circle p c = + let pc = vect p c.c in + let pc2 = norm2 pc in + let r2 = c.r *. c.r in + let y = sqrt ((r2 *. pc2) /. (pc2 -. r2)) in + let u = turn_trigo (unitaire pc) in + let v = y *@ u in + let s1,s2 = { p1 = p; p2 = c.c +! v }, { p1 = p; p2 = c.c -! v } in + let l1 = line s1 + and l2 = line s2 in + let v1 = c.r *@ (unitaire (turn_trigo l1.v)) in + let v2 = c.r *@ (unitaire (turn_antitrigo l2.v)) in + { p1 = p; p2 = c.c +! v1 }, + { p1 = p; p2 = c.c +! v2 } + + let tangentes_same_size c1 c2 = + let ab = vect c1.c c2.c in + let v = c1.r *@ (turn_trigo (unitaire ab)) in + { p1 = c1.c +! v; p2 = c2.c +! v }, + { p1 = c1.c -! v; p2 = c2.c -! v } + + let tangentes c1 c2 = + let tan p c1 c2 = + let s1,s2 = tangentes_point_circle p c1 in + let s3,s4 = tangentes_point_circle p c2 in + { p1 = s1.p2; p2 = s3.p2 }, + { p1 = s2.p2; p2 = s4.p2 } + in + let ((s1,s2),(s3,s4)) = + match (p_iso c1 c2) with + | One p -> tan p c1 c2, tangentes_same_size c1 c2 + | Two (p1,p2) -> tan p1 c1 c2, tan p2 c1 c2 + in + [s1;s2;s3;s4] + +end + +include Krobot_solve +include Vect +include Tangentes + +type board = { src : point; + dst : point; + obstacles : circle list; } + +type tangente = + { orig : point; + contact : point; + dir : vect; + distance : float; (* distance du point d'origine *) + circle : circle; + prec : tangente list; } + +type result = + { path : segment list; + length : float } + +let distance' s nv p = + let middle = + ( scal + (vect s.p1 s.p2) + (vect s.p1 p) >= 0. ) + && ( scal + (vect s.p2 s.p1) + (vect s.p2 p) >= 0. ) + in + if middle + then + abs_float (scal (turn_trigo nv) (vect s.p1 p)) + else + sqrt ((min (norm2 (vect s.p1 p)) (norm2 (vect s.p2 p)))) + +let check_segment b s = + let l = line s in + let nv = unitaire l.v in + let rec check = function + | [] -> true + | t::q -> + if distance' s nv t.c < t.r -. epsilon + then false + else check q + in + check b.obstacles + +let check_segment_1circle b c1 s = + let rec check = function + | [] -> true + | t::q -> + if t = c1 + then check q + else + if distance s t.c < t.r + then false + else check q + in + check b.obstacles + +let check_segment_circle b (c1,c2) s = + let rec check = function + | [] -> true + | t::q -> + if t = c1 || t = c2 + then check q + else + if distance s t.c < t.r + then false + else check q + in + check b.obstacles + +let start_list b = + let aux c {p1;p2} = + { orig = p1; + contact = p2; + dir = vect p1 p2; + distance = 0.; + circle = c; + prec = []; } + in + if check_segment b {p1 = b.src; p2 = b.dst} + then + (Some { length = norm (vect b.src b.dst); + path = [{p1 = b.dst; p2 = b.src}] },[]) + else + (None, + List.flatten + (List.map + (fun c -> + let (s1,s2) = tangentes_point_circle b.src c in + List.map (aux c) + (List.filter (check_segment_1circle b c) [s1;s2]) + ) b.obstacles)) + +let intersect l1 l2 = + if colineaire l1.v l2.v + then None + else let v = [| l2.p.px -. l1.p.px; l2.p.py -. l1.p.py |] in + let m = [| [| l1.v.vx ; l2.v.vx |]; [| l1.v.vy ; l2.v.vy |] |] in + let k1,k2 = + match solve m v with + | [| k1 ; k2 |] -> k1,k2 + | _ -> assert false in + Some (l1.p +! k1 *@ l1.v) + +let after {p1;p2} p = + scal (vect p1 p2) (vect p2 p) >= 0. + +let make_tangente b t c ({p1;p2} as s) = + if (scal (line s).v (vect t.contact t.circle.c) >= 0.) + && (check_segment_circle b (t.circle,c) s) + then + let l1 = { p = t.orig; v = t.dir } in + let l2 = line s in + match intersect l1 l2 with + | None -> None + | Some inter -> + if (after {p1 = t.orig;p2 = t.contact} inter) + && (check_segment_circle b (t.circle,c) {p1 = inter; p2 = t.contact}) + then + Some { distance = norm (vect t.orig inter) +. t.distance; + orig = inter; + contact = p2; + circle = c; + dir = l2.v; + prec = t::t.prec} + else None + else None + +let make_tangente' b t c = + map_filter (make_tangente b t c) (tangentes t.circle c) + +let make_tangentes b t = + let aux1 t c = map_filter (make_tangente b t c) (tangentes t.circle c) in + List.flatten (List.map (aux1 t) b.obstacles) + +let make_result b inter t = + let points = b.dst::inter::(List.map (fun t -> t.orig) (t::t.prec)) in + let rec couples = function + | [] | [_] -> [] + | p1::p2::l -> {p1;p2}::(couples (p2::l)) in + { length = norm (vect t.orig inter) + +. norm (vect inter b.dst) + +. t.distance; + path = couples points} + +let reach_tangente' b t = + let (s1,s2) = tangentes_point_circle b.dst t.circle in + let tan_line = { p = t.orig; v = t.dir } in + let check_seg s = + match intersect tan_line (line s) with + | None -> None + | Some inter -> + if (check_segment_1circle b t.circle { p1 = t.contact; p2 = inter }) + && (check_segment_1circle b t.circle { p1 = b.dst; p2 = inter }) + then Some (make_result b inter t) + else None + in + map_filter check_seg [s1;s2] + +let reach b tl = + let l = List.flatten (List.map (reach_tangente' b) tl) in + match l with + | [] -> None + | t::q -> + Some + (List.fold_left + (fun t1 t2 -> if t1.length < t2.length then t1 else t2) t q) + +let filter_tangents b min_reach tl = + List.filter (fun t -> t.distance +. + norm (vect t.orig t.contact) +. + norm (vect t.contact b.dst) < min_reach.length) tl + +let tangentes_step b tl = + let aux1 t c = map_filter (make_tangente b t c) (tangentes t.circle c) in + let aux2 t = List.map (aux1 t) b.obstacles in + List.flatten (List.flatten (List.map aux2 tl)) + +let min_result r1 r2 = match r1,r2 with + | None, _ -> r2 + | _, None -> r1 + | Some v1, Some v2 when v1.length < v2.length -> r1 + | _ -> r2 + +let step b (r,tl) = + let tl = tangentes_step b tl in + let r = min_result (reach b tl) r in + let tl = match r with + | None -> tl + | Some r -> filter_tangents b r tl in + (r,tl) + +let stepn b n = + let rec stepn n (r,tl) = + if n = 0 then (r,tl) + else stepn (n-1) (step b (r,tl)) + in + let (r,tl) = start_list b in + let r = min_result (reach b tl) r in + let tl = match r with + | None -> tl + | Some r -> filter_tangents b r tl in + stepn n (r,tl) + +let v_of_vertice { Krobot_geom.x; y } = + { px = x; py = y } + +let vertice_of_seg { p1 = {px;py} } = + { Krobot_geom.x = px; y = py } + +let find_path ~src ~dst objects = + let b = { src = v_of_vertice src; + dst = v_of_vertice dst; + obstacles = List.map (fun (v,r) -> { c = v_of_vertice v; r }) objects; } in + map_option (fun res -> List.rev_map vertice_of_seg res.path) (fst (stepn b 10)) diff --git a/info/control2011/src/lib/krobot_pathfinding.mli b/info/control2011/src/lib/krobot_pathfinding.mli new file mode 100644 index 0000000..3719e4c --- /dev/null +++ b/info/control2011/src/lib/krobot_pathfinding.mli @@ -0,0 +1,6 @@ + +val find_path : + src:Krobot_geom.vertice -> + dst:Krobot_geom.vertice -> + ( Krobot_geom.vertice * float ) list -> + Krobot_geom.vertice list option diff --git a/info/control2011/src/lib/krobot_solve.ml b/info/control2011/src/lib/krobot_solve.ml new file mode 100644 index 0000000..f04d786 --- /dev/null +++ b/info/control2011/src/lib/krobot_solve.ml @@ -0,0 +1,93 @@ +let epsilon = 0.0000000001 + +let add_l ~m ~v i (n,j) = + let a = Array.init (Array.length m.(i)) + (fun k -> m.(i).(k) +. n *. m.(j).(k)) in + let m = Array.init (Array.length m) + (fun k -> if k <> i then m.(k) else a) in + let v = Array.init (Array.length v) + (fun k -> if k <> i then v.(k) else v.(i) +. n *. v.(j)) in + m,v + +let remove_l ~m ~v i = + let rec remove_l ~m ~v i j = + if j >= Array.length m + then m,v + else + let m,v = add_l ~m ~v j (-. (m.(j).(i) /. m.(i).(i)),i) in + remove_l ~m ~v i (j+1) in + remove_l ~m ~v i (i+1) + +let switch_a a i j = + Array.init (Array.length a) + (function + | k when k = i -> a.(j) + | k when k = j -> a.(i) + | k -> a.(k)) + +let switch_l ~m ~v i j = + switch_a m i j, + switch_a v i j + +let reord_l ~m ~v i = + let rec reord_l ~m ~v j = + if j >= Array.length m + then m,v + else + if abs_float (m.(j).(i)) < epsilon + then reord_l ~m ~v (j+1) + else switch_l ~m ~v i j + in + reord_l ~m ~v i + +let triangle m v = + let rec triangle m v i = + if i >= Array.length m - 1 + then m,v + else + let m,v = reord_l ~m ~v i in + if abs_float (m.(i).(i)) <= epsilon + then triangle m v (i+1) + else + let m,v = remove_l ~m ~v i in + triangle m v (i+1) + in + triangle m v 0 + +let apply_res m v i = + let r = v.(i) /. m.(i).(i) in + let v = Array.init (Array.length v) + (fun k -> + if k >= i + then + if k = i + then v.(k) /. m.(i).(i) + else v.(k) + else v.(k) -. m.(k).(i) *. r) in + let m = Array.init (Array.length m) + (fun k -> + if k = i + then Array.init (Array.length m.(k)) + (fun l -> if l = i then 1. else 0.) + else Array.init (Array.length m.(k)) + (fun l -> + if l = i + then 0. + else m.(k).(l) )) in + m,v + +let solve m v = + let m,v = triangle m v in + let rec solve m v i = + if i < 0 + then m,v + else + let m,v = apply_res m v i in + solve m v (i-1) + in + snd (solve m v (Array.length m - 1)) + +let mult m v = + Array.init (Array.length m) + (fun k -> Array.fold_left (+.) 0. + (Array.mapi (fun i n -> v.(i) *. n) m.(k))) diff --git a/info/control2011/src/lib/krobot_solve.mli b/info/control2011/src/lib/krobot_solve.mli new file mode 100644 index 0000000..b594202 --- /dev/null +++ b/info/control2011/src/lib/krobot_solve.mli @@ -0,0 +1,6 @@ + +val mult : float array array -> float array -> float array +(** [mult m v] matrix multiplication *) + +val solve : float array array -> float array -> float array +(** [solve m v] finds [x] such that [mult m x = v] *) diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index f68832d..312deea 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -62,40 +62,6 @@ type planner = { | Motion planning | +-----------------------------------------------------------------+ *) -module Vertice_set = Set.Make(struct type t = vertice let compare = compare end) -module Vertice_map = Map.Make(struct type t = vertice let compare = compare end) - -module Dijkstra = - Graph.Path.Dijkstra - (struct - type t = Vertice_set.t Vertice_map.t - - module V = struct - type t = vertice - let compare = Pervasives.compare - let hash = Hashtbl.hash - let equal = (=) - end - - module E = struct - type t = vertice * vertice - type label = float - let label (a, b) = distance a b - let dst (a, b) = b - end - - let iter_succ_e f graph v = - Vertice_set.iter (fun v' -> f (v, v')) (Vertice_map.find v graph) - end) - (struct - type label = float - type t = float - let weight d = d - let compare a b = compare a b - let add a b = a +. b - let zero = 0. - end) - let sqr x = x *. x (* Distance from borders to the robot. *) @@ -104,84 +70,14 @@ let border_safety_distance = sqrt (sqr robot_size /. 2.) +. 0.05 (* Minimum distance from the center of objects to the center robot. *) let object_safety_distance = object_radius +. robot_size /. 2. -(* Test whether there is an intersection between the line (va, vb) and - one of the objects. *) -let rec intersection va vb objects = - match objects with - | [] -> - false - | vc :: rest -> - (* Compute coefficients of the polynomial. *) - let a = sqr (distance va vb) - and b = -2. *. prod (vector va vc) (vector va vb) - and c = sqr (distance va vc) -. sqr object_safety_distance in - let delta = sqr b -. 4. *. a *. c in - if delta < 0. then - intersection va vb rest - else - let k1 = (-. b -. sqrt delta) /. (2. *. a) - and k2 = (-. b +. sqrt delta) /. (2. *. a) in - if (k1 >= 0. && k1 <= 1.) || (k2 >= 0. && k2 <= 1.) then - true - else - intersection va vb rest - let find_path planner src dst = - (* Remove the destination object from obstacles. *) let objects = List.filter (fun obj -> distance dst obj >= object_radius) planner.objects in - (* Build bounding boxes. *) - let r1 = object_radius +. robot_size in - let r2 = object_radius +. robot_size *. 3. /. 4. in - let vertices = - List.fold_left - (fun set obj -> - let add x y set = - if (x >= border_safety_distance - && x <= world_width -. border_safety_distance - && y >= border_safety_distance - && y <= world_height -. border_safety_distance) then - Vertice_set.add { x; y } set - else - set - in - let set = add obj.x (obj.y -. r1) set in - let set = add (obj.x +. r1) obj.y set in - let set = add obj.x (obj.y +. r1) set in - let set = add (obj.x -. r1) obj.y set in - let set = add obj.x (obj.y -. r2) set in - let set = add (obj.x +. r2) obj.y set in - let set = add obj.x (obj.y +. r2) set in - let set = add (obj.x -. r2) obj.y set in - set) - Vertice_set.empty objects - in - (* Add the source and the destination. *) - let vertices = Vertice_set.add src (Vertice_set.add dst vertices) in - (* Build the graph. *) - let graph = - Vertice_set.fold - (fun va map -> - let successors = - Vertice_set.fold - (fun vb set -> - if va <> vb then - if intersection va vb planner.objects then - set - else - Vertice_set.add vb set - else - set) - vertices Vertice_set.empty - in - Vertice_map.add va successors map) - vertices Vertice_map.empty - in - try - (* Compute the shortest path. *) - let path, weight = Dijkstra.shortest_path graph src dst in - List.map (fun (a, b) -> b) path - with Not_found -> - [] + match + Krobot_pathfinding.find_path ~src ~dst + (List.map (fun v -> v,object_safety_distance) objects) + with + | None -> [] + | Some l -> l (* +-----------------------------------------------------------------+ | Primitives | hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-29 15:28:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 23679818e579d02c51823757eac4e73395bfacbd (commit) from 1d0c8230aad0db42e828d14eed6bc7728308ceb7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 23679818e579d02c51823757eac4e73395bfacbd Author: Jérémie Dimino <je...@di...> Date: Sun May 29 17:27:54 2011 +0200 [info] keep krobot-objects for testing ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index f75063a..337a6f5 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -155,6 +155,13 @@ Executable "krobot-planner" MainIs: krobot_planner.ml BuildDepends: krobot, lwt.syntax, ocamlgraph +Executable "krobot-objects" + Path: src/tools + Install: true + CompiledObject: best + MainIs: krobot_objects.ml + BuildDepends: krobot, lwt.syntax + Executable "krobot-webcam" Path: src/tools Install: true diff --git a/info/control2011/_tags b/info/control2011/_tags index f229535..14d98e6 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 658e3c296fe6ed07c286a18053ad18f1) +# DO NOT EDIT (digest: 2b0a35e51cf2e902c1aae093db385268) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -97,6 +97,11 @@ <src/tools/krobot_webcam.{native,byte}>: pkg_lwt.unix <src/tools/krobot_webcam.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_webcam.{native,byte}>: pkg_lwt.react +# Executable krobot-objects +<src/tools/krobot_objects.{native,byte}>: use_krobot +<src/tools/krobot_objects.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_objects.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_objects.{native,byte}>: pkg_lwt.react # Executable krobot-replay <src/tools/krobot_replay.{native,byte}>: use_krobot <src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 1270096..b4b7d73 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 9b4431568a1901300432755d30aeb373) *) +(* DO NOT EDIT (digest: 710ef41bf3f100a1f1ecd818da6623e3) *) (* Regenerated by OASIS v0.2.1~alpha1 Visit http://oasis.forge.ocamlcore.org for more information and @@ -5388,6 +5388,34 @@ let setup_t = {exec_custom = false; exec_main_is = "krobot_webcam.ml"; }); Executable ({ + cs_name = "krobot-objects"; + cs_data = PropList.Data.create (); + cs_plugin_data = []; + }, + { + bs_build = [(OASISExpr.EBool true, true)]; + bs_install = [(OASISExpr.EBool true, true)]; + bs_path = "src/tools"; + bs_compiled_object = Best; + bs_build_depends = + [ + InternalLibrary "krobot"; + FindlibPackage ("lwt.syntax", None) + ]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])]; + }, + {exec_custom = false; exec_main_is = "krobot_objects.ml"; + }); + Executable + ({ cs_name = "krobot-replay"; cs_data = PropList.Data.create (); cs_plugin_data = []; diff --git a/info/control2011/src/tools/krobot_objects.ml b/info/control2011/src/tools/krobot_objects.ml new file mode 100644 index 0000000..0c2d681 --- /dev/null +++ b/info/control2011/src/tools/krobot_objects.ml @@ -0,0 +1,115 @@ +(* + * krobot_objects.ml + * ----------------- + * Copyright : (c) 2011, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* Service handling the position of the objects on the board. *) + +open Lwt +open Lwt_react +open Krobot_bus +open Krobot_geom + +let section = Lwt_log.Section.make "krobot(objects)" + +(* +-----------------------------------------------------------------+ + | Types | + +-----------------------------------------------------------------+ *) + +type objects = { + bus : Krobot_bus.t; + (* The message bus used to communicate with the robot. *) + + mutable objects : vertice list; + (* The list of objects on the board. *) +} + +(* +-----------------------------------------------------------------+ + | Message handling | + +-----------------------------------------------------------------+ *) + +let handle_message objects (timestamp, message) = + match message with + | Kill "objects" -> + exit 0 + + | Send -> + ignore ( + let ts = Unix.gettimeofday () in + Krobot_bus.send objects.bus (ts, Objects objects.objects) + ) + + | _ -> + () + +(* +-----------------------------------------------------------------+ + | Command-line arguments | + +-----------------------------------------------------------------+ *) + +let fork = ref true + +let options = Arg.align [ + "-no-fork", Arg.Clear fork, " Run in foreground"; +] + +let usage = "\ +Usage: krobot-planner [options] +options are:" + +(* +-----------------------------------------------------------------+ + | Entry point | + +-----------------------------------------------------------------+ *) + +lwt () = + Arg.parse options ignore usage; + + (* Display all informative messages. *) + Lwt_log.append_rule "*" Lwt_log.Info; + + (* Open the krobot bus. *) + lwt bus = Krobot_bus.get () in + + (* Fork if not prevented. *) + if !fork then Lwt_daemon.daemonize (); + + (* Kill any running planner. *) + lwt () = Krobot_bus.send bus (Unix.gettimeofday (), Krobot_bus.Kill "objects") in + + (* Create a new planner. *) + let objects = { + bus; + objects = [ + { x = 0.800; y = 0.350 }; + { x = 1.150; y = 0.350 }; + { x = 1.850; y = 0.350 }; + { x = 2.200; y = 0.350 }; + { x = 1.500; y = 1.050 }; + { x = 0.800; y = 1.400 }; + { x = 2.200; y = 1.400 }; + { x = 1.150; y = 1.750 }; + { x = 1.850; y = 1.750 }; + { x = 0.200; y = 0.290 }; + { x = 0.200; y = 0.570 }; + { x = 0.200; y = 0.850 }; + { x = 0.200; y = 1.130 }; + { x = 0.200; y = 1.410 }; + { x = 2.800; y = 0.290 }; + { x = 2.800; y = 0.570 }; + { x = 2.800; y = 0.850 }; + { x = 2.800; y = 1.130 }; + { x = 2.800; y = 1.410 }; + ]; + } in + + (* Handle krobot message. *) + E.keep (E.map (handle_message objects) (Krobot_bus.recv bus)); + + (* Sends initial objects. *) + lwt () = Krobot_bus.send objects.bus (Unix.gettimeofday (), Objects objects.objects) in + + (* Wait forever. *) + fst (wait ()) hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-29 14:19:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 1d0c8230aad0db42e828d14eed6bc7728308ceb7 (commit) from 038fccc6bbf8b374593b12eb2bfd4cf793b8477e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1d0c8230aad0db42e828d14eed6bc7728308ceb7 Author: Jérémie Dimino <je...@di...> Date: Sun May 29 16:18:26 2011 +0200 [vision] add calibration for calibrating the webcam ----------------------------------------------------------------------- Changes: diff --git a/info/vision/coupe2011/Makefile b/info/vision/coupe2011/Makefile index 15ccf16..1556513 100644 --- a/info/vision/coupe2011/Makefile +++ b/info/vision/coupe2011/Makefile @@ -1,4 +1,4 @@ -OBJECTS = camfilter capture capturevideo findBallse fiteellipse_cam fiteellipse_camfilter +OBJECTS = camfilter capture capturevideo findBallse fiteellipse_cam fiteellipse_camfilter calibration CC = g++ CFLAGS = -ggdb `pkg-config --cflags opencv` LDFLAGS = `pkg-config --libs opencv` diff --git a/info/vision/coupe2011/calibration.c b/info/vision/coupe2011/calibration.c new file mode 100644 index 0000000..903e699 --- /dev/null +++ b/info/vision/coupe2011/calibration.c @@ -0,0 +1,118 @@ +/* + * calibration.c + * ------------- + * Copyright : (c) 2011, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + */ + +/* Calibrate the webcam. + + Usage: calibrate [display] [source] +*/ + +#include <cv.h> +#include <highgui.h> +#include <stdio.h> + +int main(int argc, char **argv) +{ + /* Whether to display the result. */ + int display = argc >= 2 ? atoi(argv[1]) : 0; + + /* The source webcam. */ + int source = argc >= 3 ? atoi(argv[2]) : 0; + + /* Open the webcam. */ + CvCapture *capture = cvCaptureFromCAM(source); + + /* Query one frame from the webcam. */ + IplImage *image = cvQueryFrame(capture); + + /* Create the HSV image. */ + IplImage *hsv_image = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3); + + /* Convert the image to HSV. */ + cvCvtColor(image, hsv_image, CV_BGR2HSV); + + /* Keep only red pixels. */ + for (int i = 0; i < hsv_image->width * hsv_image->height; i++) { + int hue = hsv_image->imageData[3 * i]; + if (hue > 10 && hue < 170) { + /* Remove non-red pixels. */ + hsv_image->imageData[3 * i + 0] = 0; + hsv_image->imageData[3 * i + 1] = 0; + hsv_image->imageData[3 * i + 2] = 0; + } + } + + /* Create the grayscale image. */ + IplImage *gray_image = cvCreateImage(cvGetSize(hsv_image), IPL_DEPTH_8U, 1); + + /* Convert the image to grayscale. */ + cvCvtColor(hsv_image, gray_image, CV_BGR2GRAY); + + /* Create the black and white image. */ + IplImage *bw_image = cvCreateImage(cvGetSize(gray_image), IPL_DEPTH_8U, 1); + + /* Threshold the image. */ + cvThreshold(gray_image, bw_image, 50, 255, CV_THRESH_BINARY); + + /* Create the eroded image. */ + IplImage *eroded = cvCreateImage(cvGetSize(bw_image), IPL_DEPTH_8U, 1); + + /* Erode the image. */ + cvErode(bw_image, eroded, NULL, 1); + + /* Create the dilated image. */ + IplImage *dilated = cvCreateImage(cvGetSize(eroded), IPL_DEPTH_8U, 1); + + /* Dilate the image. */ + cvDilate(eroded, dilated, NULL, 1); + + /* Create the image for storing edges. */ + IplImage *edges = cvCreateImage(cvGetSize(dilated), IPL_DEPTH_8U, 1); + + /* Find edges. */ + cvCanny(dilated, edges, 50, 200, 3); + + /* Create a memory storage for storing lines. */ + CvMemStorage* storage = cvCreateMemStorage(0); + + /* Detect lines. */ + CvSeq *lines = cvHoughLines2(edges, storage, CV_HOUGH_PROBABILISTIC, 1, CV_PI / 180, 80, 30, 10); + + /* Print the result on stdout. */ + printf("lines count = %d\n", lines->total); + + /* Display the result. */ + if (display) { + /* Create a temporary grayscale. */ + IplImage *tmp_image = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1); + + /* Convert the source to grayscale. */ + cvCvtColor(image, tmp_image, CV_BGR2GRAY); + + /* Create the image to display. */ + IplImage *draw_image = cvCreateImage(cvGetSize(tmp_image), IPL_DEPTH_8U, 3); + + /* Add color channels to the grayscale image. */ + cvCvtColor(tmp_image, draw_image, CV_GRAY2BGR); + + /* Draw lines. */ + for (int i = 0; i < lines->total; i++) { + CvPoint* line = (CvPoint*)cvGetSeqElem(lines,i); + cvLine(draw_image, line[0], line[1], CV_RGB(255, 0, 0), 1, 8); + } + + cvShowImage("calibration_bw", dilated); + cvShowImage("calibration", draw_image); + while (cvWaitKey(0) != 'q'); + } + + /* We are done using the webcam. */ + cvReleaseCapture(&capture); + + return 0; +} hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-28 20:27:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 038fccc6bbf8b374593b12eb2bfd4cf793b8477e (commit) from 1e3124e9a7bb03d9c9e7d2ba729a716f55d20488 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 038fccc6bbf8b374593b12eb2bfd4cf793b8477e Author: Jérémie Dimino <je...@di...> Date: Sat May 28 22:26:22 2011 +0200 [krobot_planner] remove the destination object from obstacles when planning a path ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index 32bcd4a..f68832d 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -127,6 +127,8 @@ let rec intersection va vb objects = intersection va vb rest let find_path planner src dst = + (* Remove the destination object from obstacles. *) + let objects = List.filter (fun obj -> distance dst obj >= object_radius) planner.objects in (* Build bounding boxes. *) let r1 = object_radius +. robot_size in let r2 = object_radius +. robot_size *. 3. /. 4. in @@ -151,7 +153,7 @@ let find_path planner src dst = let set = add obj.x (obj.y +. r2) set in let set = add (obj.x -. r2) obj.y set in set) - Vertice_set.empty planner.objects + Vertice_set.empty objects in (* Add the source and the destination. *) let vertices = Vertice_set.add src (Vertice_set.add dst vertices) in @@ -179,7 +181,7 @@ let find_path planner src dst = let path, weight = Dijkstra.shortest_path graph src dst in List.map (fun (a, b) -> b) path with Not_found -> - [dst] + [] (* +-----------------------------------------------------------------+ | Primitives | hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-28 11:05:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 1e3124e9a7bb03d9c9e7d2ba729a716f55d20488 (commit) via ec9cbc16966f5950708e4f6f593cf4527944940c (commit) via b7d01c1695f4e3a5c7882e53cea6ab279c9e843a (commit) via 48cd5913a78258b2b46d4f4ad5380d9285af8f96 (commit) from 5df552366b95a2043d03913e69553e04cf78bb3f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1e3124e9a7bb03d9c9e7d2ba729a716f55d20488 Author: Jérémie Dimino <je...@di...> Date: Sat May 28 13:04:37 2011 +0200 [vision] install findBallse as krobot-find-objects commit ec9cbc16966f5950708e4f6f593cf4527944940c Author: Jérémie Dimino <je...@di...> Date: Sat May 28 13:04:20 2011 +0200 [findBallse] print a separator between each frames commit b7d01c1695f4e3a5c7882e53cea6ab279c9e843a Author: Jérémie Dimino <je...@di...> Date: Sat May 28 13:03:22 2011 +0200 [info] add krobot-webcam for parsing data from the webcam analyser and remove krobot-objects commit 48cd5913a78258b2b46d4f4ad5380d9285af8f96 Author: Jérémie Dimino <je...@di...> Date: Fri May 27 20:16:53 2011 +0200 [vision] fix camfilter ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index 90561d3..f75063a 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -155,11 +155,11 @@ Executable "krobot-planner" MainIs: krobot_planner.ml BuildDepends: krobot, lwt.syntax, ocamlgraph -Executable "krobot-objects" +Executable "krobot-webcam" Path: src/tools Install: true CompiledObject: best - MainIs: krobot_objects.ml + MainIs: krobot_webcam.ml BuildDepends: krobot, lwt.syntax Executable "krobot-kill" diff --git a/info/control2011/_tags b/info/control2011/_tags index bd0db84..f229535 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 52f8c36639e5a9f5ad9d72f069f8491a) +# DO NOT EDIT (digest: 658e3c296fe6ed07c286a18053ad18f1) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -92,11 +92,11 @@ <examples/*.ml{,i}>: pkg_lwt.unix <examples/*.ml{,i}>: pkg_lwt.syntax <examples/*.ml{,i}>: pkg_lwt.react -# Executable krobot-objects -<src/tools/krobot_objects.{native,byte}>: use_krobot -<src/tools/krobot_objects.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_objects.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_objects.{native,byte}>: pkg_lwt.react +# Executable krobot-webcam +<src/tools/krobot_webcam.{native,byte}>: use_krobot +<src/tools/krobot_webcam.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_webcam.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_webcam.{native,byte}>: pkg_lwt.react # Executable krobot-replay <src/tools/krobot_replay.{native,byte}>: use_krobot <src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index d186921..1270096 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: b415f0d22b968b7ffae162be7c9780ab) *) +(* DO NOT EDIT (digest: 9b4431568a1901300432755d30aeb373) *) (* Regenerated by OASIS v0.2.1~alpha1 Visit http://oasis.forge.ocamlcore.org for more information and @@ -5361,7 +5361,7 @@ let setup_t = {exec_custom = false; exec_main_is = "send_can.ml"; }); Executable ({ - cs_name = "krobot-objects"; + cs_name = "krobot-webcam"; cs_data = PropList.Data.create (); cs_plugin_data = []; }, @@ -5385,8 +5385,7 @@ let setup_t = bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])]; }, - {exec_custom = false; exec_main_is = "krobot_objects.ml"; - }); + {exec_custom = false; exec_main_is = "krobot_webcam.ml"; }); Executable ({ cs_name = "krobot-replay"; diff --git a/info/control2011/src/tools/krobot_objects.ml b/info/control2011/src/tools/krobot_objects.ml deleted file mode 100644 index 0c2d681..0000000 --- a/info/control2011/src/tools/krobot_objects.ml +++ /dev/null @@ -1,115 +0,0 @@ -(* - * krobot_objects.ml - * ----------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(* Service handling the position of the objects on the board. *) - -open Lwt -open Lwt_react -open Krobot_bus -open Krobot_geom - -let section = Lwt_log.Section.make "krobot(objects)" - -(* +-----------------------------------------------------------------+ - | Types | - +-----------------------------------------------------------------+ *) - -type objects = { - bus : Krobot_bus.t; - (* The message bus used to communicate with the robot. *) - - mutable objects : vertice list; - (* The list of objects on the board. *) -} - -(* +-----------------------------------------------------------------+ - | Message handling | - +-----------------------------------------------------------------+ *) - -let handle_message objects (timestamp, message) = - match message with - | Kill "objects" -> - exit 0 - - | Send -> - ignore ( - let ts = Unix.gettimeofday () in - Krobot_bus.send objects.bus (ts, Objects objects.objects) - ) - - | _ -> - () - -(* +-----------------------------------------------------------------+ - | Command-line arguments | - +-----------------------------------------------------------------+ *) - -let fork = ref true - -let options = Arg.align [ - "-no-fork", Arg.Clear fork, " Run in foreground"; -] - -let usage = "\ -Usage: krobot-planner [options] -options are:" - -(* +-----------------------------------------------------------------+ - | Entry point | - +-----------------------------------------------------------------+ *) - -lwt () = - Arg.parse options ignore usage; - - (* Display all informative messages. *) - Lwt_log.append_rule "*" Lwt_log.Info; - - (* Open the krobot bus. *) - lwt bus = Krobot_bus.get () in - - (* Fork if not prevented. *) - if !fork then Lwt_daemon.daemonize (); - - (* Kill any running planner. *) - lwt () = Krobot_bus.send bus (Unix.gettimeofday (), Krobot_bus.Kill "objects") in - - (* Create a new planner. *) - let objects = { - bus; - objects = [ - { x = 0.800; y = 0.350 }; - { x = 1.150; y = 0.350 }; - { x = 1.850; y = 0.350 }; - { x = 2.200; y = 0.350 }; - { x = 1.500; y = 1.050 }; - { x = 0.800; y = 1.400 }; - { x = 2.200; y = 1.400 }; - { x = 1.150; y = 1.750 }; - { x = 1.850; y = 1.750 }; - { x = 0.200; y = 0.290 }; - { x = 0.200; y = 0.570 }; - { x = 0.200; y = 0.850 }; - { x = 0.200; y = 1.130 }; - { x = 0.200; y = 1.410 }; - { x = 2.800; y = 0.290 }; - { x = 2.800; y = 0.570 }; - { x = 2.800; y = 0.850 }; - { x = 2.800; y = 1.130 }; - { x = 2.800; y = 1.410 }; - ]; - } in - - (* Handle krobot message. *) - E.keep (E.map (handle_message objects) (Krobot_bus.recv bus)); - - (* Sends initial objects. *) - lwt () = Krobot_bus.send objects.bus (Unix.gettimeofday (), Objects objects.objects) in - - (* Wait forever. *) - fst (wait ()) diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index f980c86..32bcd4a 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -481,8 +481,5 @@ lwt () = (* Handle krobot message. *) E.keep (E.map (handle_message planner) (Krobot_bus.recv bus)); - (* Ask for objects. *) - lwt () = Krobot_bus.send bus (Unix.gettimeofday (), Send) in - (* Wait forever. *) fst (wait ()) diff --git a/info/control2011/src/tools/krobot_webcam.ml b/info/control2011/src/tools/krobot_webcam.ml new file mode 100644 index 0000000..b1cf643 --- /dev/null +++ b/info/control2011/src/tools/krobot_webcam.ml @@ -0,0 +1,91 @@ +(* + * krobot_webcam.ml + * ---------------- + * Copyright : (c) 2011, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* Read webcam output and send results. *) + +open Lwt +open Lwt_react +open Krobot_bus +open Krobot_geom + +let section = Lwt_log.Section.make "krobot(webcam)" + +(* +-----------------------------------------------------------------+ + | Parsing | + +-----------------------------------------------------------------+ *) + +let rec parse bus objects ic = + (* Read one line from the object finder. *) + lwt line = Lwt_io.read_line ic in + if line = "=====" then begin + (* If it is a new frame, send current objects. *) + ignore (Krobot_bus.send bus (Unix.gettimeofday (), Objects objects)); + parse bus [] ic + end else begin + (* Otherwise read one and add it to the current list of objects. *) + let cx, cy, w, h, alpha = Scanf.sscanf line "%d %d %d %d %f" (fun cx cy w h alpha -> (cx, cy, w, h, alpha)) in + parse bus ({ x = float cx; y = float cy } :: objects) ic + end + +(* +-----------------------------------------------------------------+ + | Message handling | + +-----------------------------------------------------------------+ *) + +let handle_message bus (timestamp, message) = + match message with + | Kill "webcam" -> + exit 0 + + | _ -> + () + +(* +-----------------------------------------------------------------+ + | Command-line arguments | + +-----------------------------------------------------------------+ *) + +let fork = ref true + +let options = Arg.align [ + "-no-fork", Arg.Clear fork, " Run in foreground"; +] + +let usage = "\ +Usage: krobot-webcam [options] +options are:" + +(* +-----------------------------------------------------------------+ + | Entry point | + +-----------------------------------------------------------------+ *) + +lwt () = + Arg.parse options ignore usage; + + (* Display all informative messages. *) + Lwt_log.append_rule "*" Lwt_log.Info; + + (* Open the krobot bus. *) + lwt bus = Krobot_bus.get () in + + (* Fork if not prevented. *) + if !fork then Lwt_daemon.daemonize (); + + (* Kill any running webcam handler. *) + lwt () = Krobot_bus.send bus (Unix.gettimeofday (), Krobot_bus.Kill "webcam") in + + (* Handle krobot message. *) + E.keep (E.map (handle_message bus) (Krobot_bus.recv bus)); + + (* Launch the objects finder. *) + let process = Lwt_process.open_process_in ("krobot-find-objects", [|"krobot-find-objects"|]) in + + (* Read the first separator. *) + lwt _ = Lwt_io.read_line process#stdout in + + (* Parse forever. *) + parse bus [] process#stdout diff --git a/info/vision/coupe2011/Makefile b/info/vision/coupe2011/Makefile index 838279c..15ccf16 100644 --- a/info/vision/coupe2011/Makefile +++ b/info/vision/coupe2011/Makefile @@ -2,8 +2,12 @@ OBJECTS = camfilter capture capturevideo findBallse fiteellipse_cam fiteellipse_ CC = g++ CFLAGS = -ggdb `pkg-config --cflags opencv` LDFLAGS = `pkg-config --libs opencv` +PREFIX = $(HOME) all: $(OBJECTS) clean: rm -f $(OBJECTS) + +install: + install -m 0755 findBallse $(PREFIX)/bin/krobot-find-objects diff --git a/info/vision/coupe2011/camfilter.c b/info/vision/coupe2011/camfilter.c index f90c95f..d2077f3 100644 --- a/info/vision/coupe2011/camfilter.c +++ b/info/vision/coupe2011/camfilter.c @@ -261,7 +261,6 @@ void process_image(int h) } // Free memory. - free(imCont->roi); imCont->roi = NULL; free(PointArray); free(PointArray2D32f); free(box); @@ -269,6 +268,7 @@ void process_image(int h) } // On libère la mémoire + free(imCont->roi); imCont->roi = NULL; cvReleaseMemStorage(&stor); cvReleaseImage(&image02); } diff --git a/info/vision/coupe2011/findBallse.c b/info/vision/coupe2011/findBallse.c index 8c98664..d5abdb9 100644 --- a/info/vision/coupe2011/findBallse.c +++ b/info/vision/coupe2011/findBallse.c @@ -159,6 +159,9 @@ void process_image() stor = cvCreateMemStorage(0); cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor); + /* Print a separator. */ + printf("====="); + if (cont) { // Threshold the source image. This needful for cvFindContours(). cvThreshold( image03, image02, params.threshold, 255, CV_THRESH_BINARY ); hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2011-05-28 08:52:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 5df552366b95a2043d03913e69553e04cf78bb3f (commit) from 680647577e28cc060a5c859db28d900d1d4305b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5df552366b95a2043d03913e69553e04cf78bb3f Author: Jérémie Dimino <je...@di...> Date: Sat May 28 10:44:33 2011 +0200 [info] use oasis 0.2.1 ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_tags b/info/control2011/_tags index 20c227a..bd0db84 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,10 +2,22 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 1d3ff08546f26990d32be2616f7495bc) +# DO NOT EDIT (digest: 52f8c36639e5a9f5ad9d72f069f8491a) +# Ignore VCS directories, you can use the same kind of rule outside +# OASIS_START/STOP if you want to exclude directories that contains +# useless stuff for the build process +<**/.svn>: -traverse +<**/.svn>: not_hygienic +".bzr": -traverse +".bzr": not_hygienic +".hg": -traverse +".hg": not_hygienic +".git": -traverse +".git": not_hygienic +"_darcs": -traverse +"_darcs": not_hygienic # Library krobot "src/lib": include -"src/lib/krobot.cmxs": use_krobot <src/lib/krobot.{cma,cmxa}>: use_libkrobot <src/lib/*.ml{,i}>: pkg_lwt.unix <src/lib/*.ml{,i}>: pkg_lwt.syntax @@ -15,7 +27,6 @@ "src/lib/krobot_message_stubs.c": pkg_lwt.react # Library krobot-can "src/can": include -"src/can/krobot-can.cmxs": use_krobot-can <src/can/krobot-can.{cma,cmxa}>: use_libkrobot-can <src/can/*.ml{,i}>: use_krobot <src/can/*.ml{,i}>: pkg_lwt.unix @@ -25,27 +36,29 @@ "src/can/can_stubs.c": pkg_lwt.unix "src/can/can_stubs.c": pkg_lwt.syntax "src/can/can_stubs.c": pkg_lwt.react -# Executable krobot-dump -<src/tools/krobot_dump.{native,byte}>: use_krobot -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.react -# Executable krobot-dump-encoders -<src/tools/krobot_dump_encoders.{native,byte}>: use_krobot -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.react -# Executable krobot-driver -<src/driver/krobot_driver.{native,byte}>: use_krobot-can -<src/driver/krobot_driver.{native,byte}>: use_krobot -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.unix -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.syntax -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.react -<src/driver/*.ml{,i}>: use_krobot-can -<src/driver/*.ml{,i}>: use_krobot -<src/driver/*.ml{,i}>: pkg_lwt.unix -<src/driver/*.ml{,i}>: pkg_lwt.syntax -<src/driver/*.ml{,i}>: pkg_lwt.react +# Executable dump-can +<examples/dump_can.{native,byte}>: use_krobot-can +<examples/dump_can.{native,byte}>: use_krobot +<examples/dump_can.{native,byte}>: pkg_lwt.unix +<examples/dump_can.{native,byte}>: pkg_lwt.syntax +<examples/dump_can.{native,byte}>: pkg_lwt.react +# Executable krobot-planner +<src/tools/krobot_planner.{native,byte}>: use_krobot +<src/tools/krobot_planner.{native,byte}>: pkg_ocamlgraph +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.react +<src/tools/*.ml{,i}>: pkg_ocamlgraph +# Executable krobot-record +<src/tools/krobot_record.{native,byte}>: use_krobot +<src/tools/krobot_record.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_record.{native,byte}>: pkg_lwt.react +# Executable krobot-simulator +<src/tools/krobot_simulator.{native,byte}>: use_krobot +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react # Executable krobot-viewer <src/tools/krobot_viewer.{native,byte}>: use_krobot <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.unix @@ -74,11 +87,21 @@ <examples/send_can.{native,byte}>: pkg_lwt.unix <examples/send_can.{native,byte}>: pkg_lwt.syntax <examples/send_can.{native,byte}>: pkg_lwt.react +<examples/*.ml{,i}>: use_krobot-can +<examples/*.ml{,i}>: use_krobot +<examples/*.ml{,i}>: pkg_lwt.unix +<examples/*.ml{,i}>: pkg_lwt.syntax +<examples/*.ml{,i}>: pkg_lwt.react # Executable krobot-objects <src/tools/krobot_objects.{native,byte}>: use_krobot <src/tools/krobot_objects.{native,byte}>: pkg_lwt.unix <src/tools/krobot_objects.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_objects.{native,byte}>: pkg_lwt.react +# Executable krobot-replay +<src/tools/krobot_replay.{native,byte}>: use_krobot +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.react # Executable krobot-kill <src/tools/krobot_kill.{native,byte}>: use_krobot <src/tools/krobot_kill.{native,byte}>: pkg_lwt.unix @@ -91,34 +114,6 @@ <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.react <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.glib <src/tools/krobot_plot_battery.{native,byte}>: pkg_cairo.lablgtk2 -# Executable krobot-replay -<src/tools/krobot_replay.{native,byte}>: use_krobot -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.react -# Executable dump-can -<examples/dump_can.{native,byte}>: use_krobot-can -<examples/dump_can.{native,byte}>: use_krobot -<examples/dump_can.{native,byte}>: pkg_lwt.unix -<examples/dump_can.{native,byte}>: pkg_lwt.syntax -<examples/dump_can.{native,byte}>: pkg_lwt.react -<examples/*.ml{,i}>: use_krobot-can -<examples/*.ml{,i}>: use_krobot -<examples/*.ml{,i}>: pkg_lwt.unix -<examples/*.ml{,i}>: pkg_lwt.syntax -<examples/*.ml{,i}>: pkg_lwt.react -# Executable krobot-planner -<src/tools/krobot_planner.{native,byte}>: use_krobot -<src/tools/krobot_planner.{native,byte}>: pkg_ocamlgraph -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.react -<src/tools/*.ml{,i}>: pkg_ocamlgraph -# Executable krobot-record -<src/tools/krobot_record.{native,byte}>: use_krobot -<src/tools/krobot_record.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_record.{native,byte}>: pkg_lwt.react # Executable krobot-plot <src/tools/krobot_plot.{native,byte}>: use_krobot <src/tools/krobot_plot.{native,byte}>: pkg_lwt.unix @@ -128,13 +123,29 @@ <src/tools/krobot_plot.{native,byte}>: pkg_cairo.lablgtk2 <src/tools/*.ml{,i}>: pkg_lwt.glib <src/tools/*.ml{,i}>: pkg_cairo.lablgtk2 -# Executable krobot-simulator -<src/tools/krobot_simulator.{native,byte}>: use_krobot -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react +# Executable krobot-dump +<src/tools/krobot_dump.{native,byte}>: use_krobot +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.react +# Executable krobot-dump-encoders +<src/tools/krobot_dump_encoders.{native,byte}>: use_krobot +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.react <src/tools/*.ml{,i}>: use_krobot <src/tools/*.ml{,i}>: pkg_lwt.unix <src/tools/*.ml{,i}>: pkg_lwt.syntax <src/tools/*.ml{,i}>: pkg_lwt.react +# Executable krobot-driver +<src/driver/krobot_driver.{native,byte}>: use_krobot-can +<src/driver/krobot_driver.{native,byte}>: use_krobot +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.unix +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.syntax +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.react +<src/driver/*.ml{,i}>: use_krobot-can +<src/driver/*.ml{,i}>: use_krobot +<src/driver/*.ml{,i}>: pkg_lwt.unix +<src/driver/*.ml{,i}>: pkg_lwt.syntax +<src/driver/*.ml{,i}>: pkg_lwt.react # OASIS_STOP diff --git a/info/control2011/configure b/info/control2011/configure index 6719c7c..97ed012 100755 --- a/info/control2011/configure +++ b/info/control2011/configure @@ -1,8 +1,27 @@ #!/bin/sh # OASIS_START -# DO NOT EDIT (digest: ed33e59fe00e48bc31edf413bbc8b8d6) +# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7) set -e -ocaml setup.ml -configure $* +FST=true +for i in "$@"; do + if $FST; then + set -- + FST=false + fi + + case $i in + --*=*) + ARG=${i%%=*} + VAL=${i##*=} + set -- "$@" "$ARG" "$VAL" + ;; + *) + set -- "$@" "$i" + ;; + esac +done + +ocaml setup.ml -configure "$@" # OASIS_STOP diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 73d0550..5fd4717 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,12 +1,12 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 6313720c4a9fa3712417ffee35de107d) *) +(* DO NOT EDIT (digest: d2e269dc4718223067ec6884e511c44b) *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" - let ns_ str = + let ns_ str = str - let s_ str = + let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = @@ -18,13 +18,13 @@ module OASISGettext = struct else fmt2^^"" - let init = + let init = [] end module OASISExpr = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" @@ -46,18 +46,18 @@ module OASISExpr = struct type 'a choices = (t * 'a) list let eval var_get t = - let rec eval' = + let rec eval' = function | EBool b -> b - | ENot e -> + | ENot e -> not (eval' e) | EAnd (e1, e2) -> (eval' e1) && (eval' e2) - | EOr (e1, e2) -> + | EOr (e1, e2) -> (eval' e1) || (eval' e2) | EFlag nm -> @@ -76,19 +76,19 @@ module OASISExpr = struct eval' t let choose ?printer ?name var_get lst = - let rec choose_aux = + let rec choose_aux = function | (cond, vl) :: tl -> - if eval var_get cond then - vl + if eval var_get cond then + vl else choose_aux tl | [] -> - let str_lst = + let str_lst = if lst = [] then s_ "<empty>" else - String.concat + String.concat (s_ ", ") (List.map (fun (cond, vl) -> @@ -97,10 +97,10 @@ module OASISExpr = struct | None -> s_ "<no printer>") lst) in - match name with + match name with | Some nm -> failwith - (Printf.sprintf + (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> @@ -115,14 +115,14 @@ end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = - Filename.concat + Filename.concat (Sys.getcwd ()) "setup.data" @@ -138,23 +138,23 @@ module BaseEnvLight = struct let line = ref 1 in - let st_line = + let st_line = Stream.from (fun _ -> try - match Stream.next st with + match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in - let lexer = + let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = - match Stream.npeek 3 lexer with + match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> - Stream.junk lexer; - Stream.junk lexer; + Stream.junk lexer; + Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> @@ -177,8 +177,8 @@ module BaseEnvLight = struct end else begin - failwith - (Printf.sprintf + failwith + (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end @@ -188,23 +188,23 @@ module BaseEnvLight = struct let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try + (fun var -> + try var_expand (MapString.find var env) with Not_found -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf "No variable %s defined when trying to expand %S." - var + var str)) str; Buffer.contents buff in var_expand (MapString.find name env) - let var_choose lst env = + let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst @@ -212,7 +212,7 @@ end module MyOCamlbuildFindlib = struct -# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild @@ -311,6 +311,7 @@ module MyOCamlbuildFindlib = struct * the "threads" package using the previous plugin. *) flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); + flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]) @@ -320,7 +321,7 @@ module MyOCamlbuildFindlib = struct end module MyOCamlbuildBase = struct -# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall @@ -335,7 +336,7 @@ module MyOCamlbuildBase = struct type name = string type tag = string -# 55 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 55 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 33d9d54..d186921 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,19 +1,19 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: b50f9201082ebd643759d008620ee0bf) *) +(* DO NOT EDIT (digest: b415f0d22b968b7ffae162be7c9780ab) *) (* - Regenerated by OASIS v0.2.0 + Regenerated by OASIS v0.2.1~alpha1 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" - let ns_ str = + let ns_ str = str - let s_ str = + let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = @@ -25,19 +25,19 @@ module OASISGettext = struct else fmt2^^"" - let init = + let init = [] end module OASISContext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISContext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISContext.ml" - open OASISGettext + open OASISGettext type level = [ `Debug - | `Info + | `Info | `Warning | `Error] @@ -46,25 +46,21 @@ module OASISContext = struct verbose: bool; debug: bool; ignore_plugins: bool; - printf: level -> string -> unit; + printf: level -> string -> unit; } - let printf lvl str = - let beg = - match lvl with + let printf lvl str = + let beg = + match lvl with | `Error -> s_ "E: " | `Warning -> s_ "W: " | `Info -> s_ "I: " | `Debug -> s_ "D: " in - match lvl with - | `Error -> - prerr_endline (beg^str) - | _ -> - print_endline (beg^str) + prerr_endline (beg^str) let default = - ref + ref { verbose = true; debug = false; @@ -72,8 +68,8 @@ module OASISContext = struct printf = printf; } - let quiet = - {!default with + let quiet = + {!default with verbose = false; debug = false; } @@ -90,7 +86,7 @@ module OASISContext = struct end module OASISUtils = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISUtils.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUtils.ml" module MapString = Map.Make(String) @@ -103,7 +99,7 @@ module OASISUtils = struct module SetString = Set.Make(String) let set_string_add_list st lst = - List.fold_left + List.fold_left (fun acc e -> SetString.add e acc) st lst @@ -113,15 +109,15 @@ module OASISUtils = struct SetString.empty - let compare_csl s1 s2 = + let compare_csl s1 s2 = String.compare (String.lowercase s1) (String.lowercase s2) - module HashStringCsl = + module HashStringCsl = Hashtbl.Make (struct type t = string - let equal s1 s2 = + let equal s1 s2 = (String.lowercase s1) = (String.lowercase s2) let hash s = @@ -135,16 +131,16 @@ module OASISUtils = struct let rec split_aux acc pos = if pos < str_len then ( - let pos_sep = + let pos_sep = try String.index_from str pos sep with Not_found -> str_len in - let part = - String.sub str pos (pos_sep - pos) + let part = + String.sub str pos (pos_sep - pos) in - let acc = + let acc = part :: acc in if pos_sep >= str_len then @@ -170,14 +166,14 @@ module OASISUtils = struct split_aux [] 0 - let varname_of_string ?(hyphen='_') s = + let varname_of_string ?(hyphen='_') s = if String.length s = 0 then begin - invalid_arg "varname_of_string" + invalid_arg "varname_of_string" end else begin - let buff = + let buff = Buffer.create (String.length s) in (* Start with a _ if digit *) @@ -186,10 +182,10 @@ module OASISUtils = struct String.iter (fun c -> - if ('a' <= c && c <= 'z') - || - ('A' <= c && c <= 'Z') - || + if ('a' <= c && c <= 'z') + || + ('A' <= c && c <= 'Z') + || ('0' <= c && c <= '9') then Buffer.add_char buff c else @@ -199,8 +195,8 @@ module OASISUtils = struct String.lowercase (Buffer.contents buff) end - let varname_concat ?(hyphen='_') p s = - let p = + let varname_concat ?(hyphen='_') p s = + let p = let p_len = String.length p in @@ -209,7 +205,7 @@ module OASISUtils = struct else p in - let s = + let s = let s_len = String.length s in @@ -221,34 +217,21 @@ module OASISUtils = struct Printf.sprintf "%s%c%s" p hyphen s - let is_varname str = + let is_varname str = str = varname_of_string str - let failwithf1 fmt a = - failwith (Printf.sprintf fmt a) - - let failwithf2 fmt a b = - failwith (Printf.sprintf fmt a b) - - let failwithf3 fmt a b c = - failwith (Printf.sprintf fmt a b c) - - let failwithf4 fmt a b c d = - failwith (Printf.sprintf fmt a b c d) - - let failwithf5 fmt a b c d e = - failwith (Printf.sprintf fmt a b c d e) + let failwithf fmt = Printf.ksprintf failwith fmt end module PropList = struct -# 21 "/home/dim/sources/oasis/src/oasis/PropList.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" open OASISGettext type name = string - exception Not_set of name * string option + exception Not_set of name * string option exception No_printer of name exception Unknown_field of name * name @@ -268,7 +251,7 @@ module PropList = struct module Data = struct - type t = + type t = (name, unit -> unit) Hashtbl.t let create () = @@ -277,10 +260,10 @@ module PropList = struct let clear t = Hashtbl.clear t -# 59 "/home/dim/sources/oasis/src/oasis/PropList.ml" +# 66 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" end - module Schema = + module Schema = struct type ('ctxt, 'extra) value = @@ -299,43 +282,43 @@ module PropList = struct name_norm: string -> string; } - let create ?(case_insensitive=false) nm = + let create ?(case_insensitive=false) nm = { name = nm; fields = Hashtbl.create 13; order = Queue.create (); - name_norm = - (if case_insensitive then + name_norm = + (if case_insensitive then String.lowercase else fun s -> s); } - let add t nm set get extra help = - let key = + let add t nm set get extra help = + let key = t.name_norm nm in if Hashtbl.mem t.fields key then failwith - (Printf.sprintf + (Printf.sprintf (f_ "Field '%s' is already defined in schema '%s'") nm t.name); - Hashtbl.add - t.fields - key + Hashtbl.add + t.fields + key { - set = set; - get = get; + set = set; + get = get; help = help; extra = extra; }; - Queue.add nm t.order + Queue.add nm t.order let mem t nm = - Hashtbl.mem t.fields nm + Hashtbl.mem t.fields nm - let find t nm = + let find t nm = try Hashtbl.find t.fields (t.name_norm nm) with Not_found -> @@ -345,28 +328,28 @@ module PropList = struct (find t nm).get data let set t data nm ?context x = - (find t nm).set - data - ?context + (find t nm).set + data + ?context x let fold f acc t = - Queue.fold + Queue.fold (fun acc k -> let v = find t k in f acc k v.extra v.help) - acc + acc t.order let iter f t = - fold + fold (fun () -> f) () t - let name t = + let name t = t.name end @@ -383,7 +366,7 @@ module PropList = struct extra: 'extra; } - let new_id = + let new_id = let last_id = ref 0 in @@ -391,20 +374,20 @@ module PropList = struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = (* Default value container *) - let v = - ref None + let v = + ref None in (* If name is not given, create unique one *) - let nm = - match name with + let nm = + match name with | Some s -> s | None -> Printf.sprintf "_anon_%d" (new_id ()) in (* Last chance to get a value: the default *) - let default () = - match default with + let default () = + match default with | Some d -> d | None -> raise (Not_set (nm, Some (s_ "no default value"))) in @@ -412,22 +395,22 @@ module PropList = struct (* Get data *) let get data = (* Get value *) - try + try (Hashtbl.find data nm) (); - match !v with - | Some x -> x + match !v with + | Some x -> x | None -> default () with Not_found -> default () in (* Set data *) - let set data ?context x = - let x = - match update with + let set data ?context x = + let x = + match update with | Some f -> begin - try + try f ?context (get data) x with Not_set _ -> x @@ -435,21 +418,21 @@ module PropList = struct | None -> x in - Hashtbl.replace - data - nm - (fun () -> v := Some x) + Hashtbl.replace + data + nm + (fun () -> v := Some x) in (* Parse string value, if possible *) let parse = - match parse with - | Some f -> + match parse with + | Some f -> f | None -> fun ?context s -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf (f_ "Cannot parse field '%s' when setting value %S") nm s) @@ -474,8 +457,8 @@ module PropList = struct print (get data) in - begin - match schema with + begin + match schema with | Some t -> Schema.add t nm sets gets extra help | None -> @@ -491,7 +474,7 @@ module PropList = struct extra = extra; } - let fset data t ?context x = + let fset data t ?context x = t.set data ?context x let fget data t = @@ -501,7 +484,7 @@ module PropList = struct t.sets data ?context s let fgets data t = - t.gets data + t.gets data end @@ -509,7 +492,7 @@ module PropList = struct struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = - let fld = + let fld = Field.create ?schema ?name ?parse ?print ?default ?update ?help extra in fun data -> Field.fget data fld @@ -518,20 +501,20 @@ module PropList = struct end module OASISMessage = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISMessage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISMessage.ml" open OASISGettext open OASISContext let generic_message ~ctxt lvl fmt = - let cond = - match lvl with + let cond = + match lvl with | `Debug -> ctxt.debug | _ -> ctxt.verbose in - Printf.ksprintf - (fun str -> + Printf.ksprintf + (fun str -> if cond then begin ctxt.printf lvl str @@ -541,7 +524,7 @@ module OASISMessage = struct let debug ~ctxt fmt = generic_message ~ctxt `Debug fmt - let info ~ctxt fmt = + let info ~ctxt fmt = generic_message ~ctxt `Info fmt let warning ~ctxt fmt = @@ -551,10 +534,10 @@ module OASISMessage = struct generic_message ~ctxt `Error fmt - let string_of_exception e = - try + let string_of_exception e = + try PropList.string_of_exception e - with + with | Failure s -> s | e -> @@ -567,7 +550,7 @@ module OASISMessage = struct end module OASISVersion = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISVersion.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISVersion.ml" open OASISGettext @@ -577,7 +560,7 @@ module OASISVersion = struct type t = string - type comparator = + type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t @@ -595,17 +578,17 @@ module OASISVersion = struct ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') let is_special = - function + function | '.' | '+' | '-' | '~' -> true | _ -> false let rec version_compare v1 v2 = if v1 <> "" || v2 <> "" then begin - (* Compare ascii string, using special meaning for version + (* Compare ascii string, using special meaning for version * related char *) - let val_ascii c = + let val_ascii c = if c = '~' then -1 else if is_digit c then 0 else if c = '\000' then 0 @@ -619,16 +602,16 @@ module OASISVersion = struct let p = ref 0 in (** Compare ascii part *) - let compare_vascii () = + let compare_vascii () = let cmp = ref 0 in - while !cmp = 0 && - !p < len1 && !p < len2 && - not (is_digit v1.[!p] && is_digit v2.[!p]) do + while !cmp = 0 && + !p < len1 && !p < len2 && + not (is_digit v1.[!p] && is_digit v2.[!p]) do cmp := (val_ascii v1.[!p]) - (val_ascii v2.[!p]); incr p done; if !cmp = 0 && !p < len1 && !p = len2 then - val_ascii v1.[!p] + val_ascii v1.[!p] else if !cmp = 0 && !p = len1 && !p < len2 then - (val_ascii v2.[!p]) else @@ -636,17 +619,21 @@ module OASISVersion = struct in (** Compare digit part *) - let compare_digit () = + let compare_digit () = let extract_int v p = let start_p = !p in - while !p < String.length v && is_digit v.[!p] do + while !p < String.length v && is_digit v.[!p] do incr p done; - match String.sub v start_p (!p - start_p) with - | "" -> 0, - v - | s -> int_of_string s, - String.sub v !p ((String.length v) - !p) + let substr = + String.sub v !p ((String.length v) - !p) + in + let res = + match String.sub v start_p (!p - start_p) with + | "" -> 0 + | s -> int_of_string s + in + res, substr in let i1, tl1 = extract_int v1 (ref !p) in let i2, tl2 = extract_int v2 (ref !p) in @@ -656,7 +643,7 @@ module OASISVersion = struct match compare_vascii () with | 0 -> begin - match compare_digit () with + match compare_digit () with | 0, tl1, tl2 -> if tl1 <> "" && is_digit tl1.[0] then 1 @@ -677,13 +664,13 @@ module OASISVersion = struct let version_of_string str = - String.iter + String.iter (fun c -> if is_alpha c || is_digit c || is_special c then () else failwith - (Printf.sprintf + (Printf.sprintf (f_ "Char %C is not allowed in version '%s'") c str)) str; @@ -692,10 +679,10 @@ module OASISVersion = struct let string_of_version t = t - let chop t = - try - let pos = - String.rindex t '.' + let chop t = + try + let pos = + String.rindex t '.' in String.sub t 0 pos with Not_found -> @@ -719,25 +706,25 @@ module OASISVersion = struct (comparator_apply v op1) && (comparator_apply v op2) let rec string_of_comparator = - function + function | VGreater v -> "> "^(string_of_version v) | VEqual v -> "= "^(string_of_version v) | VLesser v -> "< "^(string_of_version v) | VGreaterEqual v -> ">= "^(string_of_version v) | VLesserEqual v -> "<= "^(string_of_version v) - | VOr (c1, c2) -> + | VOr (c1, c2) -> (string_of_comparator c1)^" || "^(string_of_comparator c2) - | VAnd (c1, c2) -> + | VAnd (c1, c2) -> (string_of_comparator c1)^" && "^(string_of_comparator c2) let rec varname_of_comparator = - let concat p v = + let concat p v = OASISUtils.varname_concat - p - (OASISUtils.varname_of_string + p + (OASISUtils.varname_of_string (string_of_version v)) in - function + function | VGreater v -> concat "gt" v | VLesser v -> concat "lt" v | VEqual v -> concat "eq" v @@ -751,7 +738,7 @@ module OASISVersion = struct end module OASISLicense = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISLicense.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLicense.ml" (** License for _oasis fields @author Sylvain Le Gall @@ -763,13 +750,13 @@ module OASISLicense = struct type license_exception = string - type license_version = + type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion - type license_dep_5 = + type license_dep_5 = { license: license; exceptions: license_exception list; @@ -784,7 +771,7 @@ module OASISLicense = struct end module OASISExpr = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" @@ -806,18 +793,18 @@ module OASISExpr = struct type 'a choices = (t * 'a) list let eval var_get t = - let rec eval' = + let rec eval' = function | EBool b -> b - | ENot e -> + | ENot e -> not (eval' e) | EAnd (e1, e2) -> (eval' e1) && (eval' e2) - | EOr (e1, e2) -> + | EOr (e1, e2) -> (eval' e1) || (eval' e2) | EFlag nm -> @@ -836,19 +823,19 @@ module OASISExpr = struct eval' t let choose ?printer ?name var_get lst = - let rec choose_aux = + let rec choose_aux = function | (cond, vl) :: tl -> - if eval var_get cond then - vl + if eval var_get cond then + vl else choose_aux tl | [] -> - let str_lst = + let str_lst = if lst = [] then s_ "<empty>" else - String.concat + String.concat (s_ ", ") (List.map (fun (cond, vl) -> @@ -857,10 +844,10 @@ module OASISExpr = struct | None -> s_ "<no printer>") lst) in - match name with + match name with | Some nm -> failwith - (Printf.sprintf + (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> @@ -874,7 +861,7 @@ module OASISExpr = struct end module OASISTypes = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" @@ -900,34 +887,34 @@ module OASISTypes = struct | Best - type dependency = + type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option | InternalLibrary of name type tool = | ExternalTool of name - | InternalExecutable of name + | InternalExecutable of name - type vcs = - | Darcs - | Git - | Svn - | Cvs - | Hg - | Bzr - | Arch + type vcs = + | Darcs + | Git + | Svn + | Cvs + | Hg + | Bzr + | Arch | Monotone | OtherVCS of url - type plugin_kind = - [ `Configure - | `Build - | `Doc - | `Test - | `Install + type plugin_kind = + [ `Configure + | `Build + | `Doc + | `Test + | `Install | `Extra ] @@ -947,18 +934,18 @@ module OASISTypes = struct type 'a plugin = 'a * name * OASISVersion.t option - type all_plugin = plugin_kind plugin + type all_plugin = plugin_kind plugin type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list -# 102 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" +# 102 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" type 'a conditional = 'a OASISExpr.choices - type custom = + type custom = { pre_command: (command_line option) conditional; - post_command: (command_line option) conditional; + post_command: (command_line option) conditional; } @@ -989,7 +976,7 @@ module OASISTypes = struct } - type library = + type library = { lib_modules: string list; lib_internal_modules: string list; @@ -998,19 +985,19 @@ module OASISTypes = struct lib_findlib_containers: findlib_name list; } - type executable = + type executable = { exec_custom: bool; exec_main_is: unix_filename; } - type flag = + type flag = { flag_description: string option; flag_default: bool conditional; } - type source_repository = + type source_repository = { src_repo_type: vcs; src_repo_location: url; @@ -1021,7 +1008,7 @@ module OASISTypes = struct src_repo_subdir: unix_filename option; } - type test = + type test = { test_type: [`Test] plugin; test_command: command_line conditional; @@ -1065,6 +1052,9 @@ module OASISTypes = struct | Doc of common_section * doc + type section_kind = + [ `Library | `Executable | `Flag | `SrcRepo | `Test | `Doc ] + type package = { oasis_version: OASISVersion.t; @@ -1105,7 +1095,7 @@ module OASISTypes = struct end module OASISUnixPath = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISUnixPath.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUnixPath.ml" type unix_filename = string type unix_dirname = string @@ -1117,7 +1107,7 @@ module OASISUnixPath = struct let parent_dir_name = ".." - let concat f1 f2 = + let concat f1 f2 = if f1 = current_dir_name then f2 else if f2 = current_dir_name then @@ -1142,7 +1132,7 @@ module OASISUnixPath = struct current_dir_name let basename f = - try + try let pos_start = (String.rindex f '/') + 1 in @@ -1151,14 +1141,14 @@ module OASISUnixPath = struct f let chop_extension f = - try + try let last_dot = String.rindex f '.' in let sub = String.sub f 0 last_dot in - try + try let last_slash = String.rindex f '/' in @@ -1184,44 +1174,36 @@ module OASISUnixPath = struct end module OASISSection = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISSection.ml" - - (** Manipulate section - @author Sylvain Le Gall - *) - +# 1 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSection.ml" open OASISTypes - type section_kind = - | KLibrary - | KExecutable - | KFlag - | KSrcRepo - | KTest - | KDoc - - (** Extract generic information - *) let section_kind_common = function | Library (cs, _, _) -> - KLibrary, cs + `Library, cs | Executable (cs, _, _) -> - KExecutable, cs + `Executable, cs | Flag (cs, _) -> - KFlag, cs + `Flag, cs | SrcRepo (cs, _) -> - KSrcRepo, cs + `SrcRepo, cs | Test (cs, _) -> - KTest, cs + `Test, cs | Doc (cs, _) -> - KDoc, cs + `Doc, cs - (** Common section of a section - *) let section_common sct = snd (section_kind_common sct) + let section_common_set cs = + function + | Library (_, bs, lib) -> Library (cs, bs, lib) + | Executable (_, bs, exec) -> Executable (cs, bs, exec) + | Flag (_, flg) -> Flag (cs, flg) + | SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo) + | Test (_, tst) -> Test (cs, tst) + | Doc (_, doc) -> Doc (cs, doc) + (** Key used to identify section *) let section_id sct = @@ -1235,23 +1217,23 @@ module OASISSection = struct section_id sct in (match k with - | KLibrary -> "library" - | KExecutable -> "executable" - | KFlag -> "flag" - | KSrcRepo -> "src repository" - | KTest -> "test" - | KDoc -> "doc") + | `Library -> "library" + | `Executable -> "executable" + | `Flag -> "flag" + | `SrcRepo -> "src repository" + | `Test -> "test" + | `Doc -> "doc") ^" "^nm end module OASISBuildSection = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISBuildSection.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISBuildSection.ml" end module OASISExecutable = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExecutable.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExecutable.ml" open OASISTypes @@ -1282,7 +1264,7 @@ module OASISExecutable = struct end module OASISLibrary = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISLibrary.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLibrary.ml" open OASISTypes open OASISUtils @@ -1290,20 +1272,20 @@ module OASISLibrary = struct type library_name = name - let generated_unix_files ~ctxt (cs, bs, lib) - source_file_exists is_native ext_lib ext_dll = + let generated_unix_files ~ctxt (cs, bs, lib) + source_file_exists is_native ext_lib ext_dll = (* The headers that should be compiled along *) - let headers = + let headers = List.fold_left (fun hdrs modul -> - try - let base_fn = + try + let base_fn = List.find - (fun fn -> + (fun fn -> source_file_exists (fn^".ml") || source_file_exists (fn^".mli") || source_file_exists (fn^".mll") || - source_file_exists (fn^".mly")) + source_file_exists (fn^".mly")) (List.map (OASISUnixPath.concat bs.bs_path) [modul; @@ -1336,9 +1318,9 @@ module OASISLibrary = struct [cs.cs_name^".cma"] :: acc in let native acc = - [cs.cs_name^".cmxs"] :: [cs.cs_name^".cmxa"] :: [cs.cs_name^(ext_lib ())] :: acc + [cs.cs_name^".cmxa"] :: [cs.cs_name^(ext_lib ())] :: acc in - match bs.bs_compiled_object with + match bs.bs_compiled_object with | Native -> byte (native acc_nopath) | Best when is_native () -> @@ -1348,7 +1330,7 @@ module OASISLibrary = struct in (* Add C library to be built *) - let acc_nopath = + let acc_nopath = if bs.bs_c_sources <> [] then begin ["lib"^cs.cs_name^(ext_lib ())] @@ -1370,12 +1352,12 @@ module OASISLibrary = struct headers - type group_t = + type group_t = | Container of findlib_name * (group_t list) - | Package of (findlib_name * + | Package of (findlib_name * common_section * - build_section * - library * + build_section * + library * (group_t list)) let group_libs pkg = @@ -1386,11 +1368,11 @@ module OASISLibrary = struct function | Library (cs, bs, lib) -> begin - match lib.lib_findlib_parent with + match lib.lib_findlib_parent with | Some p_nm -> begin let children = - try + try MapString.find p_nm mp with Not_found -> [] @@ -1408,7 +1390,7 @@ module OASISLibrary = struct (* Compute findlib name of a single node *) let findlib_name (cs, _, lib) = - match lib.lib_findlib_name with + match lib.lib_findlib_name with | Some nm -> nm | None -> cs.cs_name in @@ -1421,10 +1403,10 @@ module OASISLibrary = struct | [] -> Package (findlib_name acc, cs, bs, lib, - (try - List.rev_map + (try + List.rev_map (fun ((_, _, child_lib) as child_acc) -> - tree_of_library + tree_of_library child_lib.lib_findlib_containers child_acc) (MapString.find cs.cs_name children) @@ -1477,7 +1459,7 @@ module OASISLibrary = struct (** Compute internal to findlib library matchings, including subpackage and return a map of it. *) - let findlib_name_map pkg = + let findlib_name_map pkg = (* Compute names in a tree *) let rec findlib_names_aux path mp grp = @@ -1485,7 +1467,7 @@ module OASISLibrary = struct match grp with | Container (fndlb_nm, children) -> fndlb_nm, children, mp - + | Package (fndlb_nm, {cs_name = nm}, _, _, children) -> fndlb_nm, children, (MapString.add nm (path, fndlb_nm) mp) in @@ -1508,47 +1490,47 @@ module OASISLibrary = struct let findlib_of_name ?(recurse=false) map nm = - try - let (path, fndlb_nm) = + try + let (path, fndlb_nm) = MapString.find nm map in - match path with + match path with | Some pth when recurse -> pth^"."^fndlb_nm | _ -> fndlb_nm with Not_found -> - failwithf1 + failwithf (f_ "Unable to translate internal library '%s' to findlib name") nm let name_findlib_map pkg = - let mp = + let mp = findlib_name_map pkg in MapString.fold - (fun nm _ acc -> + (fun nm _ acc -> let fndlb_nm_full = - findlib_of_name - ~recurse:true - mp + findlib_of_name + ~recurse:true + mp nm in MapString.add fndlb_nm_full nm acc) mp MapString.empty - let findlib_of_group = + let findlib_of_group = function - | Container (fndlb_nm, _) + | Container (fndlb_nm, _) | Package (fndlb_nm, _, _, _, _) -> fndlb_nm let root_of_group grp = let rec root_lib_aux = - function + function | Container (_, children) -> - root_lib_lst children + root_lib_lst children | Package (_, cs, bs, lib, children) -> - if lib.lib_findlib_parent = None then + if lib.lib_findlib_parent = None then cs, bs, lib else root_lib_lst children @@ -1565,7 +1547,7 @@ module OASISLibrary = struct try root_lib_aux grp with Not_found -> - failwithf1 + failwithf (f_ "Unable to determine root library of findlib library '%s'") (findlib_of_group grp) @@ -1573,40 +1555,40 @@ module OASISLibrary = struct end module OASISFlag = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISFlag.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISFlag.ml" end module OASISPackage = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISPackage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISSourceRepository.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSourceRepository.ml" end module OASISTest = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISTest.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTest.ml" end module OASISDocument = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISDocument.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISDocument.ml" end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = - Filename.concat + Filename.concat (Sys.getcwd ()) "setup.data" @@ -1622,23 +1604,23 @@ module BaseEnvLight = struct let line = ref 1 in - let st_line = + let st_line = Stream.from (fun _ -> try - match Stream.next st with + match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in - let lexer = + let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = - match Stream.npeek 3 lexer with + match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> - Stream.junk lexer; - Stream.junk lexer; + Stream.junk lexer; + Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> @@ -1661,8 +1643,8 @@ module BaseEnvLight = struct end else begin - failwith - (Printf.sprintf + failwith + (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end @@ -1672,23 +1654,23 @@ module BaseEnvLight = struct let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try + (fun var -> + try var_expand (MapString.find var env) with Not_found -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf "No variable %s defined when trying to expand %S." - var + var str)) str; Buffer.contents buff in var_expand (MapString.find name env) - let var_choose lst env = + let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst @@ -1696,20 +1678,20 @@ end module BaseContext = struct -# 21 "/home/dim/sources/oasis/src/base/BaseContext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseContext.ml" - open OASISContext + open OASISContext - let args = args + let args = args let default = default end module BaseMessage = struct -# 21 "/home/dim/sources/oasis/src/base/BaseMessage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseMessage.ml" - (** Message to user, overrid for Base + (** Message to user, overrid for Base @author Sylvain Le Gall *) open OASISMessage @@ -1728,7 +1710,7 @@ module BaseMessage = struct end module BaseFilePath = struct -# 21 "/home/dim/sources/oasis/src/base/BaseFilePath.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseFilePath.ml" open Filename @@ -1736,7 +1718,7 @@ module BaseFilePath = struct module Unix = OASISUnixPath let make = - function + function | [] -> invalid_arg "BaseFilename.make" | hd :: tl -> @@ -1760,16 +1742,15 @@ module BaseFilePath = struct end module BaseEnv = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnv.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnv.ml" - open OASISTypes open OASISGettext open OASISUtils open PropList module MapString = BaseEnvLight.MapString - type origin_t = + type origin_t = | ODefault | OGetEnv | OFileLoad @@ -1795,36 +1776,36 @@ module BaseEnv = struct Schema.create "environment" (* Environment data *) - let env = + let env = Data.create () (* Environment data from file *) - let env_from_file = + let env_from_file = ref MapString.empty (* Lexer for var *) - let var_lxr = + let var_lxr = Genlex.make_lexer [] let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try - (* TODO: this is a quick hack to allow calling Test.Command + (fun var -> + try + (* TODO: this is a quick hack to allow calling Test.Command * without defining executable name really. I.e. if there is * an exec Executable toto, then $(toto) should be replace * by its real name. It is however useful to have this function - * for other variable that depend on the host and should be + * for other variable that depend on the host and should be * written better than that. *) let st = var_lxr (Stream.of_string var) in - match Stream.npeek 3 st with + match Stream.npeek 3 st with | [Genlex.Ident "utoh"; Genlex.Ident nm] -> BaseFilePath.of_unix (var_get nm) | [Genlex.Ident "utoh"; Genlex.String s] -> @@ -1836,18 +1817,18 @@ module BaseEnv = struct | [Genlex.Ident nm] -> var_get nm | _ -> - failwithf2 + failwithf (f_ "Unknown expression '%s' in variable expansion of %s.") var str - with + with | Unknown_field (_, _) -> - failwithf2 + failwithf (f_ "No variable %s defined when trying to expand %S.") - var + var str - | Stream.Error e -> - failwithf3 + | Stream.Error e -> + failwithf (f_ "Syntax error when parsing '%s' when trying to \ expand %S: %s") var @@ -1857,12 +1838,12 @@ module BaseEnv = struct Buffer.contents buff and var_get name = - let vl = - try + let vl = + try Schema.get schema env name with Unknown_field _ as e -> begin - try + try MapString.find name !env_from_file with Not_found -> raise e @@ -1871,30 +1852,30 @@ module BaseEnv = struct var_expand vl let var_choose ?printer ?name lst = - OASISExpr.choose + OASISExpr.choose ?printer ?name - var_get + var_get lst - let var_protect vl = - let buff = + let var_protect vl = + let buff = Buffer.create (String.length vl) in String.iter - (function + (function | '$' -> Buffer.add_string buff "\\$" | c -> Buffer.add_char buff c) vl; Buffer.contents buff - let var_define - ?(hide=false) - ?(dump=true) + let var_define + ?(hide=false) + ?(dump=true) ?short_desc ?(cli=CLINone) ?arg_help - ?group + ?group name (* TODO: type constraint on the fact that name must be a valid OCaml id *) dflt = @@ -1907,7 +1888,7 @@ module BaseEnv = struct ] in - let extra = + let extra = { hide = hide; dump = dump; @@ -1917,15 +1898,15 @@ module BaseEnv = struct } in - (* Try to find a value that can be defined + (* Try to find a value that can be defined *) - let var_get_low lst = + let var_get_low lst = let errors, res = List.fold_left (fun (errors, res) (_, v) -> if res = None then begin - try + try errors, Some (Lazy.force v) with | Not_found -> @@ -1940,15 +1921,15 @@ module BaseEnv = struct ([], None) (List.sort (fun (o1, _) (o2, _) -> - if o1 < o2 then + if o1 < o2 then 1 else if o1 = o2 then 0 - else + else -1) lst) in - match res, errors with + match res, errors with | Some v, _ -> v | None, [] -> @@ -1958,12 +1939,12 @@ module BaseEnv = struct in let help = - match short_desc with + match short_desc with | Some fs -> Some fs | None -> None in - let var_get_lst = + let var_get_lst = FieldRO.create ~schema ~name @@ -1978,14 +1959,14 @@ module BaseEnv = struct fun () -> var_expand (var_get_low (var_get_lst env)) - let var_redefine + let var_redefine ?hide ?dump ?short_desc ?cli ?arg_help - ?group - name + ?group + name dflt = if Schema.mem schema name then begin @@ -1994,22 +1975,22 @@ module BaseEnv = struct end else begin - var_define + var_define ?hide ?dump ?short_desc ?cli ?arg_help - ?group - name + ?group + name dflt end - let var_ignore (e : unit -> string) = + let var_ignore (e : unit -> str... [truncated message content] |
From: Xavier L. <Ba...@us...> - 2011-05-27 20:23:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 680647577e28cc060a5c859db28d900d1d4305b6 (commit) via eac9c56632f80565e97b7770b945c9ac0f3fff38 (commit) from ac58fcf9777f7ccd645c408224c34dc2c5f3ce85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 680647577e28cc060a5c859db28d900d1d4305b6 Author: Xavier Lagorce <Xav...@cr...> Date: Sat May 21 18:13:38 2011 +0200 [Controller_Motor_STM32] Modifications for 2011 Krobot and more odometry params. commit eac9c56632f80565e97b7770b945c9ac0f3fff38 Author: Xavier Lagorce <Xav...@cr...> Date: Mon May 2 16:25:53 2011 +0200 [Controller_Motor_STM32] Added an holonomic drive generator. + refactored differential drive generator. ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.c index bc54d89..0d1145a 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.c @@ -61,9 +61,49 @@ command_generator_t* new_dd_generator(command_generator_t *generator, return generator; } +command_generator_t* new_hd_generator(command_generator_t *generator, + command_generator_t *linear_pos_x, + command_generator_t *linear_speed_x, + command_generator_t *linear_pos_y, + command_generator_t *linear_speed_y, + command_generator_t *rotational_pos, + command_generator_t *rotational_speed, + float wheel_radius, float struct_radius, float max_speed, + uint8_t type) { + switch (type) { + case 1: // Back wheel + generator->type.t = GEN_HD_B; + break; + case 2: // Right-front wheel + generator->type.t = GEN_HD_RF; + break; + case 3: // Left-front wheel + generator->type.t = GEN_HD_LF; + break; + default: + return NULL; + break; + } + generator->type.callback.type = GEN_CALLBACK_NONE; + generator->hd.linear_pos_x = linear_pos_x; + generator->hd.linear_speed_x = linear_speed_x; + generator->hd.linear_pos_x = linear_pos_y; + generator->hd.linear_speed_x = linear_speed_y; + generator->hd.rotational_pos = rotational_pos; + generator->hd.rotational_speed = rotational_speed; + generator->hd.wheel_radius = wheel_radius; + generator->hd.struct_radius = struct_radius; + generator->hd.max_speed = max_speed; + + return generator; +} + command_generator_t* adjust_value(command_generator_t *generator, float value) { - if (generator->type.t != GEN_DD_RIGHT && generator->type.t != GEN_DD_LEFT) { + uint8_t type = generator->type.t; + + if (type != GEN_DD_RIGHT && type != GEN_DD_LEFT + && type != GEN_HD_B && type != GEN_HD_RF && type != GEN_HD_LF) { generator->type.last_output = value; return generator; } else { @@ -120,7 +160,7 @@ command_generator_t* remove_callback(command_generator_t *generator) { float get_output_value(command_generator_t *generator) { int32_t cur_time; - float speed, dt, u1, u2; + float speed, dt, u1, u2, u_x, u_y, w; if (generator->type.state != GEN_STATE_RUNNING) return generator->type.last_output; @@ -143,31 +183,56 @@ float get_output_value(command_generator_t *generator) { generator->ramp2.last_time = cur_time; break; case GEN_DD_RIGHT: + case GEN_DD_LEFT: // Update position generators to allow callbacks get_output_value(generator->dd.linear_pos); get_output_value(generator->dd.rotational_pos); // Compute output u1 = get_output_value(generator->dd.linear_speed); u2 = get_output_value(generator->dd.rotational_speed); - generator->type.last_output = (2.0*u1+u2*generator->dd.shaft_width) / (2.0 * generator->dd.wheel_radius); + switch (generator->type.t) { + case GEN_DD_RIGHT: + generator->type.last_output = (2.0*u1+u2*generator->dd.shaft_width) / (2.0 * generator->dd.wheel_radius); + break; + case GEN_DD_LEFT: + generator->type.last_output = (2.0*u1-u2*generator->dd.shaft_width) / (2.0 * generator->dd.wheel_radius); + break; + } if (generator->type.last_output >= 0) { generator->type.last_output = MIN(generator->type.last_output, generator->dd.max_speed); } else { generator->type.last_output = MAX(generator->type.last_output, -generator->dd.max_speed); } break; - case GEN_DD_LEFT: + case GEN_HD_B: + case GEN_HD_RF: + case GEN_HD_LF: // Update position generators to allow callbacks - get_output_value(generator->dd.linear_pos); - get_output_value(generator->dd.rotational_pos); + get_output_value(generator->hd.linear_pos_x); + get_output_value(generator->hd.linear_pos_y); + get_output_value(generator->hd.rotational_pos); // Compute output - u1 = get_output_value(generator->dd.linear_speed); - u2 = get_output_value(generator->dd.rotational_speed); - generator->type.last_output = (2.0*u1-u2*generator->dd.shaft_width) / (2.0 * generator->dd.wheel_radius); + u_x = get_output_value(generator->hd.linear_speed_x); + u_y = get_output_value(generator->hd.linear_speed_y); + w = get_output_value(generator->hd.rotational_speed); + switch (generator->type.t) { + case GEN_HD_B: + generator->type.last_output = + (u_x + w*generator->hd.struct_radius) / generator->hd.wheel_radius; + break; + case GEN_HD_RF: + generator->type.last_output = + (-u_x/2.0 + u_y*sqrt(3.0)/2.0 + w*generator->hd.struct_radius) / generator->hd.wheel_radius; + break; + case GEN_HD_LF: + generator->type.last_output = + (-u_x/2.0 - u_y*sqrt(3.0)/2.0 + w*generator->hd.struct_radius) / generator->hd.wheel_radius; + break; + } if (generator->type.last_output >= 0) { - generator->type.last_output = MIN(generator->type.last_output, generator->dd.max_speed); + generator->type.last_output = MIN(generator->type.last_output, generator->hd.max_speed); } else { - generator->type.last_output = MAX(generator->type.last_output, -generator->dd.max_speed); + generator->type.last_output = MAX(generator->type.last_output, -generator->hd.max_speed); } break; } diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.h b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.h index 28aa810..3fa2b6a 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.h +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/command_generator.h @@ -26,6 +26,9 @@ // drive. #define GEN_DD_RIGHT 5 // Outputs the right wheel speed for a differential // drive. +#define GEN_HD_B 6 // Outpus the back wheel speed for an holonomic drive. +#define GEN_HD_RF 7 // Outpus the right-front wheel speed for an holonomic drive. +#define GEN_HD_LF 8 // Outpus the left-front wheel speed for an holonomic drive. // Generator states #define GEN_STATE_PAUSE 0 // The output is freezed. @@ -80,6 +83,19 @@ typedef struct { float max_speed; } dd_generator_t; +typedef struct { + placeholder_generator_t gen; + command_generator_t *linear_pos_x; + command_generator_t *linear_speed_x; + command_generator_t *linear_pos_y; + command_generator_t *linear_speed_y; + command_generator_t *rotational_pos; + command_generator_t *rotational_speed; + float wheel_radius; + float struct_radius; + float max_speed; +} hd_generator_t; + // Usable generator meta-type union _command_generator_t { placeholder_generator_t type; @@ -87,6 +103,7 @@ union _command_generator_t { ramp_generator_t ramp; ramp2_generator_t ramp2; dd_generator_t dd; + hd_generator_t hd; }; /* Initializes a new Constant Generator. @@ -136,6 +153,40 @@ command_generator_t* new_dd_generator(command_generator_t *generator, float wheel_radius, float shaft_width, float max_speed, uint8_t type); +/* Initializes a new Holonomic Drive generator. + * - generator : pointer to the generator to initialize + * - linear_pos_x : pointer to the generator giving the integrates of linear_speed_x. This + * generator will be called at each computation to allow update in parallel + * with linear_speed. + * - linear_speed_x : pointer to the generator giving the linear speed along the x axis of + * the drive. + * - linear_pos_y : pointer to the generator giving the integrates of linear_speed_y. This + * generator will be called at each computation to allow update in parallel + * with linear_speed. + * - linear_speed_y : pointer to the generator giving the linear speed along the y axis of + * the drive. + * - rotational_pos : pointer to the generator giving the integrates of rotational_speed. This + * generator will be called at each computation to allow update in parallel + * with rotational_speed. + * - rotational_speed : pointer to the generator giving the rotational speed of the drive. + * - wheel_radius : radius of the wheels. + * - struct_radius : radius of the holonomic drive. + * - max_speed : maximum wheel speed (in rad/s). + * - type : + * o 1 is the back wheel + * o 2 is the right-front wheel + * o 3 is the left-front wheel + */ +command_generator_t* new_hd_generator(command_generator_t *generator, + command_generator_t *linear_pos_x, + command_generator_t *linear_speed_x, + command_generator_t *linear_pos_y, + command_generator_t *linear_speed_y, + command_generator_t *rotational_pos, + command_generator_t *rotational_speed, + float wheel_radius, float struct_radius, float max_speed, + uint8_t type); + /* * Adjusts the current output value of 'generator' to 'value'. */ diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c index 4b10660..5ec825e 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c @@ -18,7 +18,7 @@ #include "differential_drive.h" #define WHEEL_RADIUS 0.049245 -#define SHAFT_WIDTH 0.259 +#define SHAFT_WIDTH 0.150 PROC_DEFINE_STACK(stack_ind, KERN_MINSTACKSIZE * 2); @@ -64,17 +64,18 @@ static void init(void) params.l0[0] = 0.0236; params.l0[1] = 3.9715; params.T = 0.005; - // Initialize left motor - params.motor = MOTOR3; - params.encoder = ENCODER3; - mc_new_controller(¶ms, dd_get_left_wheel_generator(), CONTROLLER_MODE_NORMAL); // Initialize right motor params.motor = MOTOR4; params.encoder = ENCODER4; mc_new_controller(¶ms, dd_get_right_wheel_generator(), CONTROLLER_MODE_NORMAL); + // Initialize left motor + params.motor = MOTOR3; + params.encoder = ENCODER3; + params.encoder_gain = 2.0*M_PI/2000.0/15.0; // Left motor is reversed + mc_new_controller(¶ms, dd_get_left_wheel_generator(), CONTROLLER_MODE_NORMAL); // Start odometry - odometryInit(1e-3, WHEEL_RADIUS, SHAFT_WIDTH, -2.0*M_PI/2000.0/15.0); + odometryInit(1e-3, WHEEL_RADIUS, SHAFT_WIDTH, 2.0*M_PI/2000.0/15.0, -2.0*M_PI/2000.0/15.0); // Blink to say we are ready for (uint8_t i=0; i < 5; i++) { diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.c index ab0f7eb..3c26212 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.c @@ -13,7 +13,7 @@ PROC_DEFINE_STACK(stack_odometry, KERN_MINSTACKSIZE * 8); typedef struct { robot_state_t robot_state; - float wheel_radius, shaft_width, encoder_gain; + float wheel_radius, shaft_width, left_encoder_gain, right_encoder_gain; float Ts; uint8_t enable; uint8_t running; @@ -23,7 +23,7 @@ odometry_state_t state; static void NORETURN odometry_process(void); -void odometryInit(float Ts, float wheel_radius, float shaft_width, float encoder_gain) { +void odometryInit(float Ts, float wheel_radius, float shaft_width, float left_encoder_gain, float right_encoder_gain) { // Initialize initial state state.robot_state.x = 0.; @@ -33,7 +33,8 @@ void odometryInit(float Ts, float wheel_radius, float shaft_width, float encoder // Initialize robot parameters state.wheel_radius = wheel_radius; state.shaft_width = shaft_width; - state.encoder_gain = encoder_gain; + state.left_encoder_gain = left_encoder_gain; + state.right_encoder_gain = right_encoder_gain; state.Ts = Ts; // Start odometry process @@ -95,8 +96,8 @@ static void NORETURN odometry_process(void) { if (delta_r > 0) delta_r = delta_r - 65535; } - delta_l *= state.encoder_gain; - delta_r *= state.encoder_gain; + delta_l *= state.left_encoder_gain; + delta_r *= state.right_encoder_gain; last_pos_l = pos_l; last_pos_r = pos_r; diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.h b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.h index 0e780a1..2d378a0 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.h +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/odometry.h @@ -20,7 +20,7 @@ typedef struct { float theta; } robot_state_t; -void odometryInit(float Ts, float wheel_radius, float shaft_width, float encoder_gain); +void odometryInit(float Ts, float wheel_radius, float shaft_width, float left_encoder_gain, float right_encoder_gain); void odo_disable(void); void odo_restart(void); hooks/post-receive -- krobot |