system.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. File Name : system.h
  3. Author : Yichip
  4. Version : V1.0
  5. Date : 2018/05/22
  6. Description : none.
  7. */
  8. #ifndef __SYSTEM_H__
  9. #define __SYSTEM_H__
  10. #include <string.h>
  11. #include "yc_uart.h"
  12. //#define SDK_DEBUG //Debug switch
  13. #define BIT_SET(a,b) ((a) |= (1<<(b)))
  14. #define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
  15. #define BIT_FLIP(a,b) ((a) ^= (1<<(b))) //bit Negation
  16. #define BIT_GET(a,b) (((a) & (1<<(b)))>>(b))
  17. /**
  18. * @brief Print format string to serial port 0.You need to initialize the serial port 0 before you use MyPrintf.
  19. *
  20. * @param format : format string
  21. * @param ...: format parameter
  22. */
  23. void MyPrintf(char *format, ...);
  24. void _assert_handler(const char *file, int line, const char *func);
  25. void printv(uint8_t *buf, uint32_t len, uint8_t *s);
  26. #define _ASSERT(x) \
  27. if (!(x)) \
  28. { \
  29. _assert_handler(__FILE__,__LINE__,__FUNCTION__);\
  30. }
  31. #endif /*__SYSTEM_H__*/