t_define.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef _USER_DEFINE_H_
  2. #define _USER_DEFINE_H_
  3. typedef unsigned char uint8;
  4. typedef unsigned short uint16;
  5. //typedef unsigned int uint32;
  6. typedef unsigned long uint32;
  7. typedef signed char int8;
  8. typedef signed short int16;
  9. //typedef signed int int32;
  10. typedef signed long int32;
  11. typedef float float32;
  12. typedef double float64;
  13. typedef unsigned char bool8;
  14. #define NULL 0
  15. #define TRUE 1ul
  16. #define FALSE 0
  17. #define YES 1ul
  18. #define NO 0
  19. #define EN 1ul
  20. #define DISEN 0
  21. #define HIGH 1ul
  22. #define LOW 0
  23. #define UP 1ul
  24. #define DOWN 0
  25. #define LS(reg,bit_count) ((reg) << (bit_count))
  26. #define RS(reg,bit_count) ((reg) >> (bit_count))
  27. #define SET(reg,bit_mask) ((reg) | (bit_mask))
  28. #define CLEAR(reg,bit_mask) ((reg) & ~(bit_mask))
  29. #define NEGATE(reg,bit_mask) ((reg) ^ (bit_mask))
  30. #define SET_VALUE(reg,bit_mask,value) (((reg) & (~(bit_mask))) | ((value) & (bit_mask)))
  31. #define BO0 0
  32. #define BO1 1
  33. #define BO2 2
  34. #define BO3 3
  35. #define BO4 4
  36. #define BO5 5
  37. #define BO6 6
  38. #define BO7 7
  39. #define BO8 8
  40. #define BO9 9
  41. #define BO10 10
  42. #define BO11 11
  43. #define BO12 12
  44. #define BO13 13
  45. #define BO14 14
  46. #define BO15 15
  47. #define BM0 (1ul<<0)
  48. #define BM1 (1ul<<1)
  49. #define BM2 (1ul<<2)
  50. #define BM3 (1ul<<3)
  51. #define BM4 (1ul<<4)
  52. #define BM5 (1ul<<5)
  53. #define BM6 (1ul<<6)
  54. #define BM7 (1ul<<7)
  55. #define BM8 (1ul<<8)
  56. #define BM9 (1ul<<9)
  57. #define BM10 (1ul<<10)
  58. #define BM11 (1ul<<11)
  59. #define BM12 (1ul<<12)
  60. #define BM13 (1ul<<13)
  61. #define BM14 (1ul<<14)
  62. #define BM15 (1ul<<15)
  63. #endif