Debian Codegraph @

kpy/mh-digital.c

raw symbols SCIP
1 /* mh-digital.c -- routines for manipulating the I/O pins.
2
3 Copyright (C) 2008 Ajith Kumar, Inter-University Accelerator Centre,
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9 */
10
11 #include <avr/io.h>
12
13
14 // Macro to calculate the binary value of a bit (specify 0 to 7)
15 #ifndef BITVAL
16 #define BITVAL(bit) (1 << (bit))
17 #endif
18
19 // Macro to clear a bit (specify 0 to 7)
20 #ifndef CLRBIT
21 #define CLRBIT(sfr, bit) (_SFR_BYTE(sfr) &= ~BITVAL(bit))
22 #endif
23
24 // Macro to set a bit (specify 0 to 7)
25 #ifndef SETBIT
26 #define SETBIT(sfr, bit) (_SFR_BYTE(sfr) |= BITVAL(bit))
27 #endif
28
29 // Macro to read a bit (specify 0 to 7)
30 #ifndef GETBIT
31 #define GETBIT(sfr, bit) (_SFR_BYTE(sfr) & BITVAL(bit))
32 #endif