Naze32 clone with Frysky receiver
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.

spi.h 824B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Bit-Banged SPI routines
  3. */
  4. #ifndef _ARM_SPI_H
  5. #define _ARM_SPI_H
  6. #include <stdint.h>
  7. #define DIR_OUTPUT 0
  8. #define DIR_INPUT 1
  9. void gpioInit(void);
  10. void gpioDir(uint8_t num, uint8_t dir);
  11. void gpioSet(uint8_t num, uint8_t val);
  12. uint8_t gpioGet(uint8_t num);
  13. #define SCK_on gpioSet(22, 1)
  14. #define SCK_off gpioSet(22, 0)
  15. #define SCK_dir gpioDir(22, DIR_OUTPUT)
  16. #define MO_on gpioSet(21, 1)
  17. #define MO_off gpioSet(21, 0)
  18. #define MO_dir gpioDir(21, DIR_OUTPUT)
  19. #define CS_on gpioSet(24, 1)
  20. #define CS_off gpioSet(24, 0)
  21. #define CS_dir gpioDir(24, DIR_OUTPUT)
  22. #define MI_1 gpioGet(23)
  23. #define MI_0 gpioGet(23)
  24. #define MI_dir gpioDir(23, DIR_INPUT)
  25. #define GDO_1 gpioGet(25)
  26. #define GDO_0 gpioGet(25)
  27. #define GDO_dir gpioDir(25, DIR_INPUT)
  28. #include "timer.h"
  29. #define NOP() delay_us(1) // could be 62.5ns
  30. #endif