My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

rotary_encoder.h 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /*****************************************************************************
  24. * @file lcd/e3v2/jyersui/rotary_encoder.h
  25. * @brief Rotary encoder functions
  26. ****************************************************************************/
  27. #include "../../../inc/MarlinConfig.h"
  28. /*********************** Encoder Set ***********************/
  29. typedef struct {
  30. bool enabled = false;
  31. int encoderMoveValue = 0;
  32. millis_t lastEncoderTime = 0;
  33. } ENCODER_Rate;
  34. extern ENCODER_Rate EncoderRate;
  35. typedef enum {
  36. ENCODER_DIFF_NO = 0, // no state
  37. ENCODER_DIFF_CW = 1, // clockwise rotation
  38. ENCODER_DIFF_CCW = 2, // counterclockwise rotation
  39. ENCODER_DIFF_ENTER = 3 // click
  40. } ENCODER_DiffState;
  41. // Encoder initialization
  42. void Encoder_Configuration();
  43. // Analyze encoder value and return state
  44. ENCODER_DiffState Encoder_ReceiveAnalyze();
  45. /*********************** Encoder LED ***********************/
  46. #if PIN_EXISTS(LCD_LED)
  47. #define LED_NUM 4
  48. #define LED_DATA_HIGH WRITE(LCD_LED_PIN, 1)
  49. #define LED_DATA_LOW WRITE(LCD_LED_PIN, 0)
  50. #define RGB_SCALE_R10_G7_B5 1
  51. #define RGB_SCALE_R10_G7_B4 2
  52. #define RGB_SCALE_R10_G8_B7 3
  53. #define RGB_SCALE_NEUTRAL_WHITE RGB_SCALE_R10_G7_B5
  54. #define RGB_SCALE_WARM_WHITE RGB_SCALE_R10_G7_B4
  55. #define RGB_SCALE_COOL_WHITE RGB_SCALE_R10_G8_B7
  56. extern unsigned int LED_DataArray[LED_NUM];
  57. // LED light operation
  58. void LED_Action();
  59. // LED initialization
  60. void LED_Configuration();
  61. // LED write data
  62. void LED_WriteData();
  63. // LED control
  64. // RGB_Scale: RGB color ratio
  65. // luminance: brightness (0~0xFF)
  66. void LED_Control(const uint8_t RGB_Scale, const uint8_t luminance);
  67. // LED gradient control
  68. // RGB_Scale: RGB color ratio
  69. // luminance: brightness (0~0xFF)
  70. // change_Time: gradient time (ms)
  71. void LED_GraduallyControl(const uint8_t RGB_Scale, const uint8_t luminance, const uint16_t change_Interval);
  72. #endif // LCD_LED