Reception de deux CDC
This commit is contained in:
parent
6f6340abe1
commit
dcc3889845
34
main.c
34
main.c
@ -6,40 +6,48 @@
|
|||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define NB_MORCEAUX 100
|
||||||
|
|
||||||
absolute_time_t envoie_nb_char(int nb_char);
|
absolute_time_t envoie_nb_char(int nb_char);
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
absolute_time_t measured_time_us;
|
absolute_time_t measured_time_us;
|
||||||
absolute_time_t temps_moyen, temps_max;
|
absolute_time_t temps_moyen, temps_max, temps_m[NB_MORCEAUX];
|
||||||
|
absolute_time_t current_time_us, start_time_us;
|
||||||
int nb_ech = 10;
|
int nb_ech = 10;
|
||||||
|
int taille_morceau = 120;
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
while(1){
|
while(1){
|
||||||
temps_moyen = 0;
|
temps_moyen = 0;
|
||||||
temps_max = 0;
|
temps_max = 0;
|
||||||
for(int nb_char = 1; nb_char < 1000; nb_char+= 1){
|
for(int i = 1; i < NB_MORCEAUX; i++){
|
||||||
temps_moyen = 0;
|
temps_moyen = 0;
|
||||||
temps_max = 0;
|
temps_max = 0;
|
||||||
for(int ech=0; ech<nb_ech; ech ++){
|
start_time_us = get_absolute_time();
|
||||||
measured_time_us = envoie_nb_char(nb_char);
|
temps_m[i] = envoie_nb_char(taille_morceau);
|
||||||
if(measured_time_us > temps_max){
|
current_time_us = get_absolute_time();
|
||||||
temps_max = measured_time_us;
|
sleep_ms(1);
|
||||||
}
|
|
||||||
temps_moyen += measured_time_us;
|
|
||||||
}
|
|
||||||
temps_moyen = temps_moyen / nb_ech;
|
|
||||||
printf(">temps:%d:%lld#us\n", nb_char, temps_moyen);
|
|
||||||
printf(">temps_max:%d:%lld#us\n", nb_char, temps_max);
|
|
||||||
sleep_ms(5);
|
|
||||||
}
|
}
|
||||||
|
for(int i = 1; i < NB_MORCEAUX; i++){
|
||||||
|
printf(">temps:%d:%lld#us\n", i, temps_m[i]);
|
||||||
|
}
|
||||||
|
printf(">temps_d:%lld\n", current_time_us - start_time_us);
|
||||||
|
|
||||||
sleep_ms(50);
|
sleep_ms(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absolute_time_t envoie_nb_char(int nb_char) {
|
absolute_time_t envoie_nb_char(int nb_char) {
|
||||||
absolute_time_t current_time_us, start_time_us;
|
absolute_time_t current_time_us, start_time_us;
|
||||||
|
int j=0;
|
||||||
char message[10000];
|
char message[10000];
|
||||||
for(int i=0; i<10000; i++){
|
for(int i=0; i<10000; i++){
|
||||||
|
/*j++;
|
||||||
|
if(j>25){
|
||||||
|
j=0;
|
||||||
|
}
|
||||||
|
message[i]= j + 'a';*/
|
||||||
message[i]= i%26 + 'a';
|
message[i]= i%26 + 'a';
|
||||||
}
|
}
|
||||||
if (nb_char == 0){
|
if (nb_char == 0){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user