Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
645 B

  1. /*
  2. * gpio.cpp
  3. *
  4. * Created: 20/1/2016 11:57:21
  5. * Author: akatran
  6. */
  7. //#include "gpio_helper.h"
  8. #include "gpio.h"
  9. #include <stdlib.h>
  10. void GPIO::open(int port, int DDR)
  11. {
  12. uint8_t pin;
  13. PORT_t * p = GPIO_getPort(port,&pin);
  14. if (DDR==0)
  15. {
  16. p->DIRCLR=pin;
  17. }else if (DDR==1)
  18. {
  19. p->DIRSET = pin;
  20. }
  21. }
  22. void GPIO::close(int port)
  23. {
  24. // Nothing to do with close;
  25. }
  26. int read(int port)
  27. {
  28. uint8_t pin;
  29. PORT_t * p = GPIO_getPort(port,&pin);
  30. return p->IN;
  31. }
  32. void GPIO::write(int port,int value)
  33. {
  34. uint8_t pin;
  35. PORT_t * p = GPIO_getPort(port,&pin);
  36. if (value==0)
  37. {
  38. p->OUTCLR=pin;
  39. }else if (value==1)
  40. {
  41. p->OUTSET = pin;
  42. }
  43. }