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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * mcp23x17:
  3. * Copyright (c) 2012-2013 Gordon Henderson
  4. *
  5. * Header file for code using the MCP23x17 GPIO expander chip.
  6. * This comes in 2 flavours: MCP23017 which has an I2C interface,
  7. * an the MXP23S17 which has an SPI interface.
  8. ***********************************************************************
  9. * This file is part of wiringPi:
  10. * https://projects.drogon.net/raspberry-pi/wiringpi/
  11. *
  12. * wiringPi is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Lesser General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * wiringPi is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Lesser General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Lesser General Public
  23. * License along with wiringPi.
  24. * If not, see <http://www.gnu.org/licenses/>.
  25. ***********************************************************************
  26. */
  27. // MCP23x17 Registers
  28. #define IODIRA 0x00
  29. #define IPOLA 0x02
  30. #define GPINTENA 0x04
  31. #define DEFVALA 0x06
  32. #define INTCONA 0x08
  33. #define IOCON 0x0A
  34. #define GPPUA 0x0C
  35. #define INTFA 0x0E
  36. #define INTCAPA 0x10
  37. #define GPIOA 0x12
  38. #define OLATA 0x14
  39. #define IODIRB 0x01
  40. #define IPOLB 0x03
  41. #define GPINTENB 0x05
  42. #define DEFVALB 0x07
  43. #define INTCONB 0x09
  44. #define IOCONB 0x0B
  45. #define GPPUB 0x0D
  46. #define INTFB 0x0F
  47. #define INTCAPB 0x11
  48. #define GPIOB 0x13
  49. #define OLATB 0x15
  50. // Bits in the IOCON register
  51. #define IOCON_UNUSED 0x01
  52. #define IOCON_INTPOL 0x02
  53. #define IOCON_ODR 0x04
  54. #define IOCON_HAEN 0x08
  55. #define IOCON_DISSLW 0x10
  56. #define IOCON_SEQOP 0x20
  57. #define IOCON_MIRROR 0x40
  58. #define IOCON_BANK_MODE 0x80
  59. // Default initialisation mode
  60. #define IOCON_INIT (IOCON_SEQOP)
  61. // SPI Command codes
  62. #define CMD_WRITE 0x40
  63. #define CMD_READ 0x41