/* Get the mapped of a number given an input and output range  */
int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out)
/* Get the mapped of a number given an input and output range  */
int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out)
{
    if(x >= max_in) return max_out;
    if(x <= min_in) return min_out;
    int32_t delta_in = max_in - min_in;
    int32_t delta_out = max_out - min_out;
    return ((x - min_in) * delta_out) / delta_in + min_out;
}