BLE switch interface using micro:bit with 3 tact switches or 3 Makey Makey sensors
KeyValueInt.h@3:d8fd4efb63cc, 2019-06-11 (annotated)
- Committer:
- masakjm
- Date:
- Tue Jun 11 18:08:53 2019 +0000
- Revision:
- 3:d8fd4efb63cc
- Parent:
- 1:9d0e2e5b5d25
Change the usage of timer.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masakjm | 1:9d0e2e5b5d25 | 1 | //================================= |
masakjm | 1:9d0e2e5b5d25 | 2 | // Class KeyValueInt |
masakjm | 1:9d0e2e5b5d25 | 3 | //================================= |
masakjm | 1:9d0e2e5b5d25 | 4 | // The MIT License (MIT) Copyright (c) 2018 Masatomo Kojima |
masakjm | 1:9d0e2e5b5d25 | 5 | |
masakjm | 1:9d0e2e5b5d25 | 6 | #ifndef KEY_VALUE_INT |
masakjm | 1:9d0e2e5b5d25 | 7 | #define KEY_VALUE_INT |
masakjm | 1:9d0e2e5b5d25 | 8 | |
masakjm | 1:9d0e2e5b5d25 | 9 | class KeyValueInt { |
masakjm | 1:9d0e2e5b5d25 | 10 | private: |
masakjm | 1:9d0e2e5b5d25 | 11 | int min; |
masakjm | 1:9d0e2e5b5d25 | 12 | int max; |
masakjm | 1:9d0e2e5b5d25 | 13 | bool rotation; |
masakjm | 1:9d0e2e5b5d25 | 14 | |
masakjm | 1:9d0e2e5b5d25 | 15 | public: |
masakjm | 1:9d0e2e5b5d25 | 16 | const char *key; |
masakjm | 1:9d0e2e5b5d25 | 17 | char disp; |
masakjm | 1:9d0e2e5b5d25 | 18 | int value; |
masakjm | 1:9d0e2e5b5d25 | 19 | int range(int data); |
masakjm | 1:9d0e2e5b5d25 | 20 | int set(int data); |
masakjm | 1:9d0e2e5b5d25 | 21 | void inc(int delta=1); |
masakjm | 1:9d0e2e5b5d25 | 22 | void dec(int delta=1); |
masakjm | 1:9d0e2e5b5d25 | 23 | |
masakjm | 1:9d0e2e5b5d25 | 24 | KeyValueInt(const char *key, char disp=0, int value=0, int min=0, int max=4095, bool rotation=false); |
masakjm | 1:9d0e2e5b5d25 | 25 | |
masakjm | 1:9d0e2e5b5d25 | 26 | }; |
masakjm | 1:9d0e2e5b5d25 | 27 | |
masakjm | 1:9d0e2e5b5d25 | 28 | #endif // KEY_VALUE_INT |