45 lines
932 B
C
45 lines
932 B
C
|
#include "pico/stdlib.h"
|
||
|
#include <stdio.h>
|
||
|
|
||
|
uint32_t temps_cycle_min = UINT32_MAX;
|
||
|
uint32_t temps_cycle_max=0;
|
||
|
int lock=0;
|
||
|
|
||
|
void temps_cycle_check(){
|
||
|
static uint32_t temps_old;
|
||
|
uint32_t temps, temps_cycle;
|
||
|
|
||
|
temps = time_us_32();
|
||
|
temps_cycle = temps - temps_old;
|
||
|
|
||
|
if(temps_cycle < temps_cycle_min){
|
||
|
temps_cycle_min = temps_cycle;
|
||
|
}
|
||
|
|
||
|
if(temps_cycle > temps_cycle_max){
|
||
|
temps_cycle_max = temps_cycle;
|
||
|
}
|
||
|
temps_old=time_us_32();
|
||
|
}
|
||
|
|
||
|
void temps_cycle_reset(){
|
||
|
temps_cycle_min = UINT32_MAX;
|
||
|
temps_cycle_max=0;
|
||
|
}
|
||
|
|
||
|
void temps_cycle_display(){
|
||
|
uint32_t temps;
|
||
|
temps = time_us_32()/1000;
|
||
|
printf(">T_cycle_min(us):%ld:%d\n", temps, temps_cycle_min);
|
||
|
printf(">T_cycle_max(us):%ld:%d\n", temps, temps_cycle_max);
|
||
|
temps_cycle_reset();
|
||
|
}
|
||
|
|
||
|
uint32_t temps_cycle_get_min(){
|
||
|
return temps_cycle_min;
|
||
|
}
|
||
|
|
||
|
uint32_t temps_cycle_get_max(){
|
||
|
return temps_cycle_max;
|
||
|
}
|