Advertisement
celem

common.h

Aug 29th, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.88 KB | None | 0 0
  1. /*-------------------------------------------------------------------
  2.   common.h   by Jack Botner
  3.  
  4.      Copyright (c) Jack Botner and licensed under the MIT license.
  5.    The MIT license states: Permission is hereby granted, free of charge,
  6.    to any person obtaining a copy of this software and associated documentation
  7.    files (the "Software"), to deal in the Software without restriction,
  8.    including without limitation the rights to use, copy, modify, merge,
  9.    publish, distribute, sublicense, and/or sell copies of the Software,
  10.    and to permit persons to whom the Software is furnished to do so,
  11.    subject to the following conditions:
  12.    
  13.    The above copyright notice and this permission notice shall be included
  14.    in all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  18. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  21. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. OTHER DEALINGS IN THE SOFTWARE.
  24. -------------------------------------------------------------------*/
  25.  
  26. #ifndef _COMMON_H_
  27. #define _COMMON_H_ 1
  28.  
  29. #define BOOL    char
  30.  
  31. #define FALSE   0
  32. #define TRUE    (!FALSE)
  33. //#define NULL    0
  34.  
  35. #define nop() do { __asm__ __volatile__ ("nop"); } while (0)
  36.  
  37. // The following macros set/clear bits
  38.  
  39. #define set_bit(port,bit)  digitalWrite(bit, HIGH)
  40. #define clear_bit(port,bit)  digitalWrite(bit, LOW)
  41. #define test_bit( reg, bitNumb )   digitalRead(bitNumb)
  42. //#define set_bit(port,bit)  (port |= (1<<bit))
  43. //#define clear_bit(port,bit)  (port &= ~(1<<bit))
  44. //#define test_bit( reg, bitNumb )   ((reg) & (1 << (bitNumb)))
  45.  
  46. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement