librpip.sh 749 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # create pwm group
  3. sudo groupadd -r pwm
  4. sudo usermod -aG pwm pi
  5. # get librpip - this initializes the pwm clock and sets the correct permissions
  6. if [[ ! -d "librpip-0.3.2" ]]; then
  7. wget http://librpip.frasersdev.net/wp-content/uploads/2016/03/librpip-0.3.2.tar.gz
  8. tar -xf librpip-0.3.2.tar.gz
  9. fi
  10. cd librpip-0.3.2/
  11. # build
  12. if [[ ! -e "./bin/pwmclk" ]]; then
  13. ./configure
  14. make
  15. fi
  16. # install
  17. [[ -d "/usr/local/bin/librpip-util" ]] || sudo make install
  18. # install pwm init service
  19. sudo cp distro/arch/pwm-init.service /etc/systemd/system
  20. sudo systemctl daemon-reload
  21. sudo systemctl enable pwm-init
  22. # add pwm to the boot config
  23. echo ""
  24. echo "add this to your /boot/config.txt"
  25. echo "##"
  26. echo "dtoverlay=pwm,pin=12,func=4"
  27. echo "##"