-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRDUtil.h
More file actions
41 lines (33 loc) · 742 Bytes
/
RDUtil.h
File metadata and controls
41 lines (33 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* libRobotDev
* RDUtil.h
* Purpose: Provides utility functions
* Created: 25/07/2014
* Author(s): Jerry Luck, Jeremy Pearson
* Status: TESTED <Blake>
*/
#ifndef RDUTIL_H_
/**
* Robot Development Utilities Header.
*/
#define RDUTIL_H_
/******************
* Bit operations *
******************/
/**
* Set specified pin of specified port to 1.
*/
#define set_bit(port,pin) ((port) |= (1 << (pin)))
/**
* Clear specified pin of specified port.
*/
#define clr_bit(port,pin) ((port) &= ~(1 << (pin)))
/**
* Read specified pin of specified port.
*/
#define get_bit(port,pin) (((port)>>(pin)) & 1)
/**
* Toggle specified pin of specified port.
*/
#define tog_bit(port,pin) ((port) ^= (1 << (pin)))
#endif // RDUTIL_H_