Paint for the FRDM-KL25Z
Dependencies: mbed TFT_fonts SPI_TFT_ILI9341
Diff: touch.cpp
- Revision:
- 2:fe018965e46c
- Parent:
- 1:33506fcfdd95
- Child:
- 3:1396bac4ae71
diff -r 33506fcfdd95 -r fe018965e46c touch.cpp --- a/touch.cpp Mon Jan 07 16:15:52 2019 +0000 +++ b/touch.cpp Tue Jan 08 06:56:55 2019 +0000 @@ -18,7 +18,7 @@ AnalogIn _a(a); AnalogIn _i(i); wait_us(10); - return _a.read_u16(); + return (int)_a.read_u16(); } @@ -29,6 +29,6 @@ else return 0; }*/ -int map(int value, int fromSource, int toSource, int fromTarget, int toTarget){ +int map(float value, float fromSource, float toSource, float fromTarget, float toTarget){ return (value - fromSource) / (toSource - fromSource) * (toTarget - fromTarget) + fromTarget; } \ No newline at end of file