DEV_Config.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _DEV_CONFIG_H_
  2. #define _DEV_CONFIG_H_
  3. /***********************************************************************************************************************
  4. ------------------------------------------------------------------------
  5. |\\\ ///|
  6. |\\\ Hardware interface ///|
  7. ------------------------------------------------------------------------
  8. ***********************************************************************************************************************/
  9. #include "Debug.h"
  10. #ifdef USE_BCM2835_LIB
  11. #include <bcm2835.h>
  12. #elif USE_WIRINGPI_LIB
  13. #include <wiringPi.h>
  14. #include <wiringPiSPI.h>
  15. #include <wiringPiI2C.h>
  16. #elif USE_DEV_LIB
  17. #include <lgpio.h>
  18. #define LFLAGS 0
  19. #define NUM_MAXBUF 4
  20. #endif
  21. #include <errno.h>
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <stdint.h>
  25. #include <unistd.h>
  26. #define USE_SPI 1
  27. #define USE_IIC 0
  28. #define IIC_CMD 0X00
  29. #define IIC_RAM 0X40
  30. /**
  31. * data
  32. **/
  33. #define UBYTE uint8_t
  34. #define UWORD uint16_t
  35. #define UDOUBLE uint32_t
  36. //OLED Define
  37. #define OLED_CS 8
  38. #define OLED_RST 27
  39. #define OLED_DC 25
  40. #define OLED_CS_0 DEV_Digital_Write(OLED_CS,0)
  41. #define OLED_CS_1 DEV_Digital_Write(OLED_CS,1)
  42. #define OLED_RST_0 DEV_Digital_Write(OLED_RST,0)
  43. #define OLED_RST_1 DEV_Digital_Write(OLED_RST,1)
  44. #define OLED_DC_0 DEV_Digital_Write(OLED_DC,0)
  45. #define OLED_DC_1 DEV_Digital_Write(OLED_DC,1)
  46. /*------------------------------------------------------------------------------------------------------*/
  47. UBYTE DEV_ModuleInit(void);
  48. void DEV_ModuleExit(void);
  49. void DEV_GPIO_Mode(UWORD Pin, UWORD Mode);
  50. void DEV_Digital_Write(UWORD Pin, UBYTE Value);
  51. UBYTE DEV_Digital_Read(UWORD Pin);
  52. void DEV_Delay_ms(UDOUBLE xms);
  53. void I2C_Write_Byte(uint8_t value, uint8_t Cmd);
  54. void DEV_SPI_WriteByte(UBYTE Value);
  55. void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len);
  56. #endif