keybrd library is an open source library for creating custom-keyboard firmware.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

PortRead_MCP23S17.ino 825B

123456789101112131415161718192021222324252627282930
  1. /* unit test for PortRead_MCP23S17
  2. Picture of hardware is in unit_tests/PortRead_MCP23S17/PortRead_MCP23S17_bb.JPG
  3. The setup is an MCP23S17 I/O expander on a Teensy LC controller.
  4. MCP23S17 port-B pins are alternately grounded and energized.
  5. portBState is a bitwise reading of port B.
  6. output is: 10101010
  7. */
  8. #include "PortIOE.h"
  9. #include "PortRead_MCP23S17.h"
  10. #include "Scanner_IOE.h"
  11. const uint8_t PortIOE::DEVICE_ADDR = 0x20; //MCP23S17 address, all 3 ADDR pins are grounded
  12. PortIOE portB(1, 0);
  13. PortRead_MCP23S17 portBRead(portB, ~0);
  14. void setup()
  15. {
  16. uint8_t portBState; //bit pattern
  17. delay(6000);
  18. portBRead.begin(LOW);
  19. portBState = portBRead.read();
  20. Keyboard.print("portBState = ");
  21. Keyboard.println(portBState, BIN); //prints 10101010
  22. }
  23. void loop() { }