Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:c8be6b1554d9, committed 2018-10-08
- Comitter:
- kenken0721
- Date:
- Mon Oct 08 08:05:20 2018 +0000
- Parent:
- 3:6d9d5cae1db7
- Commit message:
Changed in this revision
| kbt.cpp | Show annotated file Show diff for this revision Revisions of this file |
| kbt.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/kbt.cpp Sun Aug 19 04:39:34 2018 +0000
+++ b/kbt.cpp Mon Oct 08 08:05:20 2018 +0000
@@ -3,7 +3,7 @@
#include "mbed.h"
-long KBT::map(long x, long in_min, long in_max, long out_min, long out_max){
+double KBT::map(double x, double in_min, double in_max, double out_min, double out_max){
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@@ -47,7 +47,7 @@
return Button[num];
}
-int KBT::stick(int num){
+double KBT::stick(int num){
return Stick[num - 14];
}
--- a/kbt.h Sun Aug 19 04:39:34 2018 +0000
+++ b/kbt.h Mon Oct 08 08:05:20 2018 +0000
@@ -29,13 +29,13 @@
class KBT{
public :
bool Button[14];
- int Stick[4];
+ double Stick[4];
int open_data[8];
KBT(PinName TX, PinName RX);
void init(long baudrate);
bool button(int num);
- int stick(int num);
+ double stick(int num);
void putc(int val);
private :
@@ -49,7 +49,7 @@
int data[8];
int check[9];
- long map(long x, long in_min, long in_max, long out_min, long out_max);
+ double map(double x, double in_min, double in_max, double out_min, double out_max);
void bitcheck();
void intSerial();
void numinit();