main/main.c
long map(long x, long in_min, long in_max, long out_min, long out_max) {
    long divisor = (in_max - in_min);
    if(divisor == 0){
        return -1; //AVR returns -1, SAM returns 0
    }
    return (x - in_min) * (out_max - out_min) / divisor + out_min;
}
// helper function for working with audio data
helper function for working with audio data
helper function for working with audio data
long map(long x, long in_min, long in_max, long out_min, long out_max) {
    long divisor = (in_max - in_min);
    if(divisor == 0){
        return -1; 
    }
    return (x - in_min) * (out_max - out_min) / divisor + out_min;
}
long map ( long x , long in_min , long in_max , long out_min , long out_max ) { long divisor = ( in_max - in_min ) ; if ( divisor == 0 ) { return -1 ; } return ( x - in_min ) * ( out_max - out_min ) / divisor + out_min ; }
helper function for working with audio data
helper function for working with audio data
//AVR returns -1, SAM returns 0