No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

README.md 4.7 KiB

hace 2 años
hace 2 años
hace 2 años
hace 2 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # WiringPi (Unofficial Fork)
  2. This is an unofficial mirror/fork of wiringPi. This repository
  3. has become a mirror of the last "official" source release, plus a fork
  4. facilitating updates to support newer hardware (primarily for use by
  5. the ports) and fix bugs.
  6. ---
  7. ## Notable Updates
  8. I've made various updates that I've wanted to see for a long time.
  9. 1. BCM pin numbering is now the default
  10. The WiringPi pin numbering never made any sense to me. Probably because I never really got into Arduino.
  11. I modified the command line options to reflect:
  12. ```
  13. $ gpio -h
  14. Usage: gpio -v Show version info
  15. gpio -h Show Help
  16. gpio[-b|-p|-w] ... Use bcm-gpio/physical/WiringPi pin numbering scheme.
  17. If none specified, BCM GPIO numbering is used by default.
  18. [-x extension:params][[ -x ...]] ...
  19. gpio <mode/read/write/aread/awritewb/pwm/pwmTone/clock> ...
  20. gpio bank <bank>
  21. gpio <toggle/blink> <pin>
  22. gpio readall/allreadall
  23. gpio unexportall/exports
  24. gpio export/edge/unexport ...
  25. gpio wfi <pin> <mode>
  26. gpio drive <group> <value>
  27. gpio pwm-bal/pwm-ms
  28. gpio pwmr <range>
  29. gpio pwmc <divider>
  30. gpio load spi/i2c
  31. gpio unload spi/i2c
  32. gpio i2cd/i2cdetect
  33. gpio rbx/rbd
  34. gpio wb <value>
  35. gpio usbp high/low
  36. ```
  37. 2. Board version reporting
  38. I'm keeping Gordon's copyright.
  39. Give credit where credit is due, since this would not exist without his work.
  40. ```
  41. $ gpio -v
  42. gpio version: 2.xx
  43. Copyright (c) 2012-2018 Gordon Henderson
  44. This is free software with ABSOLUTELY NO WARRANTY.
  45. For details type: "gpio -warranty"
  46. Raspberry Pi Details
  47. Type : Pi 4B
  48. Processor: BCM2711
  49. Revision : 1.4
  50. Memory : 8GB
  51. Maker : Sony
  52. * Device tree is enabled.
  53. * Model string: "Raspberry Pi 4 Model B Rev 1.4"
  54. * This Raspberry Pi supports user-level GPIO access.
  55. ```
  56. 3. Overall pin reporting
  57. I wanted the readall command to report the current state of pins, their alternate functions, and the names to go with them.
  58. i.e. The pin names aren't static anymore.
  59. This works on the 3B and 4B. The old A and B should be the same as before. I don't have any of the other boards,
  60. so I can't test on those.
  61. In the table below, note that I've changed pins 32 and 33 to the alt4 function to be able to use UART5:
  62. ```
  63. $ gpio readall
  64. +-----+-----+------------+------+---+---Pi 4B--+---+------+------------+-----+-----+
  65. | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
  66. +-----+-----+------------+------+---+----++----+---+------+------------+-----+-----+
  67. | | | 3.3v | | | 1 || 2 | | | 5v | | |
  68. | 2 | 8 | SDA1 | ALT0 | 1 | 3 || 4 | | | 5v | | |
  69. | 3 | 9 | SCL1 | ALT0 | 1 | 5 || 6 | | | GND | | |
  70. | 4 | 7 | GPIO.04 | OUT | 0 | 7 || 8 | 1 | ALT5 | TXD1 | 15 | 14 |
  71. | | | GND | | | 9 || 10 | 0 | ALT5 | RXD1 | 16 | 15 |
  72. | 17 | 0 | GPIO.17 | OUT | 0 | 11 || 12 | 0 | IN | GPIO.18 | 1 | 18 |
  73. | 27 | 2 | GPIO.27 | IN | 1 | 13 || 14 | | | GND | | |
  74. | 22 | 3 | GPIO.22 | IN | 0 | 15 || 16 | 0 | IN | GPIO.23 | 4 | 23 |
  75. | | | 3.3v | | | 17 || 18 | 0 | IN | GPIO.24 | 5 | 24 |
  76. | 10 | 12 | SPI0_MOSI | ALT0 | 0 | 19 || 20 | | | GND | | |
  77. | 9 | 13 | SPI0_MISO | ALT0 | 0 | 21 || 22 | 0 | IN | GPIO.25 | 6 | 25 |
  78. | 11 | 14 | SPI0_SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT | GPIO.08 | 10 | 8 |
  79. | | | GND | | | 25 || 26 | 1 | OUT | GPIO.07 | 11 | 7 |
  80. | 0 | 30 | GPIO.00 | OUT | 0 | 27 || 28 | 1 | IN | GPIO.01 | 31 | 1 |
  81. | 5 | 21 | GPIO.05 | IN | 1 | 29 || 30 | | | GND | | |
  82. | 6 | 22 | GPIO.06 | IN | 1 | 31 || 32 | 1 | ALT4 | TXD5 | 26 | 12 |
  83. | 13 | 23 | RXD5 | ALT4 | 1 | 33 || 34 | | | GND | | |
  84. | 19 | 24 | GPIO.19 | IN | 1 | 35 || 36 | 1 | IN | GPIO.16 | 27 | 16 |
  85. | 26 | 25 | GPIO.26 | IN | 1 | 37 || 38 | 1 | IN | GPIO.20 | 28 | 20 |
  86. | | | GND | | | 39 || 40 | 1 | IN | GPIO.21 | 29 | 21 |
  87. +-----+-----+------------+------+---+----++----+---+------+------------+-----+-----+
  88. | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
  89. +-----+-----+------------+------+---+---Pi 4B--+---+------+------------+-----+-----+
  90. ```
  91. 4. Added wiringPiISRmulti
  92. This is like the existing wiringPiISR, but it takes a list of pins to wait for.
  93. Note that (for simplicity) the mode applies to all the specified pins.