diff options
Diffstat (limited to 'users/doogle999/doogle999.h')
| -rw-r--r-- | users/doogle999/doogle999.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/users/doogle999/doogle999.h b/users/doogle999/doogle999.h new file mode 100644 index 000000000..7ed38fbcc --- /dev/null +++ b/users/doogle999/doogle999.h | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | #ifndef USERSPACE | ||
| 2 | #define USERSPACE | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | #define NO_ACTION_ONESHOT | ||
| 7 | #define NO_ACTION_MACRO | ||
| 8 | |||
| 9 | #define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) | ||
| 10 | |||
| 11 | // Layer the calculator is on | ||
| 12 | #define CALC_LAYER 2 | ||
| 13 | |||
| 14 | // Inside is whether when you are in calc mode it should automatically force numlock, outside is whether it should do it outside of calculator mode | ||
| 15 | #define CALC_FORCE_NUM_LOCK_INSIDE_CALC true | ||
| 16 | #define CALC_FORCE_NUM_LOCK_OUTSIDE_CALC true | ||
| 17 | |||
| 18 | // Maximum number of characters the calculator can have | ||
| 19 | #define CALC_BUFFER_SIZE 32 | ||
| 20 | |||
| 21 | // Minimum width of the printed text / the number of decimal places | ||
| 22 | #define CALC_PRINT_SIZE 6 | ||
| 23 | |||
| 24 | /*----- | ||
| 25 | Special | ||
| 26 | -----*/ | ||
| 27 | #define CALC_CHAR_BEG '(' | ||
| 28 | #define CALC_CHAR_END ')' | ||
| 29 | #define CALC_CHAR_DEC '.' | ||
| 30 | |||
| 31 | /*----- | ||
| 32 | Operators - Can add more here such as modulo %, factorial ! | ||
| 33 | -----*/ | ||
| 34 | #define CALC_CHAR_ADD '+' | ||
| 35 | #define CALC_PRIO_ADD 1 | ||
| 36 | |||
| 37 | #define CALC_CHAR_SUB '-' | ||
| 38 | #define CALC_PRIO_SUB 1 | ||
| 39 | |||
| 40 | #define CALC_CHAR_MUL '*' | ||
| 41 | #define CALC_PRIO_MUL 2 | ||
| 42 | |||
| 43 | #define CALC_CHAR_DIV '/' | ||
| 44 | #define CALC_PRIO_DIV 2 | ||
| 45 | |||
| 46 | #define CALC_CHAR_EXP '^' | ||
| 47 | #define CALC_PRIO_EXP 3 | ||
| 48 | |||
| 49 | /*----- | ||
| 50 | Functions | ||
| 51 | -----*/ | ||
| 52 | #define CALC_CHAR_SIN 's' | ||
| 53 | #define CALC_CHAR_COS 'c' | ||
| 54 | #define CALC_CHAR_TAN 't' | ||
| 55 | |||
| 56 | #define CALC_CHAR_ASN 'S' | ||
| 57 | #define CALC_CHAR_ACS 'C' | ||
| 58 | #define CALC_CHAR_ATN 'T' | ||
| 59 | |||
| 60 | #define CALC_CHAR_LGE 'l' | ||
| 61 | #define CALC_CHAR_LOG 'L' | ||
| 62 | |||
| 63 | #define CALC_CHAR_SQT 'q' | ||
| 64 | |||
| 65 | /*----- | ||
| 66 | Constants | ||
| 67 | -----*/ | ||
| 68 | #define CALC_CHAR_EUL 'e' | ||
| 69 | #define CALC_VALU_EUL 2.71828182845904523536 | ||
| 70 | |||
| 71 | #define CALC_CHAR_PI 'p' | ||
| 72 | #define CALC_VALU_PI 3.14159265358979323846 | ||
| 73 | |||
| 74 | struct OP // Operator/function | ||
| 75 | { | ||
| 76 | char c; | ||
| 77 | unsigned char priority; | ||
| 78 | bool ltr; | ||
| 79 | }; | ||
| 80 | |||
| 81 | union TokenRaw // A token after the input has been processed, can either be a number or an operator/function | ||
| 82 | { | ||
| 83 | double num; | ||
| 84 | struct OP op; | ||
| 85 | }; | ||
| 86 | |||
| 87 | struct Token // Encapsulator | ||
| 88 | { | ||
| 89 | bool isNum; | ||
| 90 | union TokenRaw raw; | ||
| 91 | }; | ||
| 92 | |||
| 93 | enum CalcFunctions // Hardware calculator key functionality | ||
| 94 | { | ||
| 95 | CALC = SAFE_RANGE, | ||
| 96 | ENDCALC | ||
| 97 | }; | ||
| 98 | |||
| 99 | #endif | ||
