doogle999.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef USERSPACE
  2. #define USERSPACE
  3. #include "quantum.h"
  4. #define NO_ACTION_ONESHOT
  5. #define NO_ACTION_MACRO
  6. #define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
  7. // Layer the calculator is on
  8. #define CALC_LAYER 2
  9. // 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
  10. #define CALC_FORCE_NUM_LOCK_INSIDE_CALC true
  11. #define CALC_FORCE_NUM_LOCK_OUTSIDE_CALC true
  12. // Maximum number of characters the calculator can have
  13. #define CALC_BUFFER_SIZE 32
  14. // Minimum width of the printed text / the number of decimal places
  15. #define CALC_PRINT_SIZE 6
  16. /*-----
  17. Special
  18. -----*/
  19. #define CALC_CHAR_BEG '('
  20. #define CALC_CHAR_END ')'
  21. #define CALC_CHAR_DEC '.'
  22. /*-----
  23. Operators - Can add more here such as modulo %, factorial !
  24. -----*/
  25. #define CALC_CHAR_ADD '+'
  26. #define CALC_PRIO_ADD 1
  27. #define CALC_CHAR_SUB '-'
  28. #define CALC_PRIO_SUB 1
  29. #define CALC_CHAR_MUL '*'
  30. #define CALC_PRIO_MUL 2
  31. #define CALC_CHAR_DIV '/'
  32. #define CALC_PRIO_DIV 2
  33. #define CALC_CHAR_EXP '^'
  34. #define CALC_PRIO_EXP 3
  35. /*-----
  36. Functions
  37. -----*/
  38. #define CALC_CHAR_SIN 's'
  39. #define CALC_CHAR_COS 'c'
  40. #define CALC_CHAR_TAN 't'
  41. #define CALC_CHAR_ASN 'S'
  42. #define CALC_CHAR_ACS 'C'
  43. #define CALC_CHAR_ATN 'T'
  44. #define CALC_CHAR_LGE 'l'
  45. #define CALC_CHAR_LOG 'L'
  46. #define CALC_CHAR_SQT 'q'
  47. /*-----
  48. Constants
  49. -----*/
  50. #define CALC_CHAR_EUL 'e'
  51. #define CALC_VALU_EUL 2.71828182845904523536
  52. #define CALC_CHAR_PI 'p'
  53. #define CALC_VALU_PI 3.14159265358979323846
  54. struct OP // Operator/function
  55. {
  56. char c;
  57. unsigned char priority;
  58. bool ltr;
  59. };
  60. union TokenRaw // A token after the input has been processed, can either be a number or an operator/function
  61. {
  62. double num;
  63. struct OP op;
  64. };
  65. struct Token // Encapsulator
  66. {
  67. bool isNum;
  68. union TokenRaw raw;
  69. };
  70. enum CalcFunctions // Hardware calculator key functionality
  71. {
  72. CALC = SAFE_RANGE,
  73. ENDCALC
  74. };
  75. #endif