Kiibohd Controller
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* Copyright (C) 2016 by Jacob Alexander
  2. *
  3. * This file is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This file is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this file. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. // ----- Includes -----
  17. // Compiler Includes
  18. #include <Lib/ScanLib.h>
  19. // Project Includes
  20. #include <cli.h>
  21. #include <led.h>
  22. #include <print.h>
  23. #include <matrix_scan.h>
  24. #include <macro.h>
  25. #include <output_com.h>
  26. // Local Includes
  27. #include "scan_loop.h"
  28. // ----- Function Declarations -----
  29. // ----- Variables -----
  30. // Number of scans since the last USB send
  31. uint16_t Scan_scanCount = 0;
  32. // ----- Functions -----
  33. // Setup
  34. inline void Scan_setup()
  35. {
  36. // Setup cap sense matrix pins for scanning
  37. Matrix_setup();
  38. // Reset scan count
  39. Scan_scanCount = 0;
  40. }
  41. // Main Detection Loop
  42. inline uint8_t Scan_loop()
  43. {
  44. Matrix_scan( Scan_scanCount++ );
  45. return 0;
  46. }
  47. // Signal from Macro Module that all keys have been processed (that it knows about)
  48. inline void Scan_finishedWithMacro( uint8_t sentKeys )
  49. {
  50. }
  51. // Signal from Output Module that all keys have been processed (that it knows about)
  52. inline void Scan_finishedWithOutput( uint8_t sentKeys )
  53. {
  54. // Reset scan loop indicator (resets each key debounce state)
  55. // TODO should this occur after USB send or Macro processing?
  56. Scan_scanCount = 0;
  57. }
  58. // Signal from the Output Module that the available current has changed
  59. // current - mA
  60. void Scan_currentChange( unsigned int current )
  61. {
  62. // Indicate to all submodules current change
  63. Matrix_currentChange( current );
  64. }
  65. // ----- Capabilities -----