BLE switch interface with GROVE joystic for micro:bit http://mahoro-ba.net/e2073.html

Dependencies:   microbit

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers KeyValueInt.h Source File

KeyValueInt.h

00001 //=================================
00002 //  Class KeyValueInt
00003 //=================================
00004 //    The MIT License (MIT)   Copyright (c) 2018 Masatomo Kojima
00005 
00006 #ifndef   KEY_VALUE_INT
00007 #define   KEY_VALUE_INT
00008 
00009 class KeyValueInt {
00010     private:
00011         int min;
00012         int max;
00013         bool rotation;
00014 
00015     public:
00016         const char *key;
00017         char disp;
00018         int value;
00019         int range(int data);
00020         int set(int data);
00021         void inc(int delta=1);
00022         void dec(int delta=1);
00023 
00024     KeyValueInt(const char *key, char disp=0, int value=0, int min=0, int max=4095, bool rotation=false);
00025     
00026 };
00027 
00028 #endif // KEY_VALUE_INT