arduino / arduino/ArduinoCore-API
Templated map() function
Đang mở
- Ngôn ngữ chính
- C++
- Star
- 306
- Fork
- 150
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hello !
Apologies if this is a duplicate, but I couldn't find any previous discussions on github about it.
Is there a reason why map() isn't templated to provide maximum awesomeness??
Something as simple as this, would get rid of surprises when trying to use map() to scale to [0,1]:
```
template
T map(T x, T in_min, T in_max, T out_min, T out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.