Skip to content

Commit 0385efa

Browse files
author
Akshay Sharma
committed
Add content Functions/Bits and Bytes
1 parent 3693e29 commit 0385efa

File tree

7 files changed

+387
-0
lines changed

7 files changed

+387
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= bit()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc.).
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`bit(n)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`n`: the bit whose value to compute
27+
28+
[float]
29+
=== Returns
30+
The value of the bit.
31+
32+
--
33+
// OVERVIEW SECTION ENDS
34+
35+
36+
37+
38+
// HOW TO USE SECTION STARTS
39+
[#howtouse]
40+
--
41+
42+
[float]
43+
=== See also
44+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
45+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
46+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
47+
48+
[role="language"]
49+
* #LANGUAGE# link:bitRead{ext-relative}[bitRead()] +
50+
* #LANGUAGE# link:bitWrite{ext-relative}[bitWrite()] +
51+
* #LANGUAGE# link:bitSet{ext-relative}[bitSet()] +
52+
* #LANGUAGE# link:bitClear{ext-relative}[bitClear()]
53+
54+
--
55+
// HOW TO USE SECTION ENDS
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= bitClear()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Clears (writes a 0 to) a bit of a numeric variable.
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`bitClear(x, n)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: the numeric variable whose bit to clear
27+
28+
`n`: which bit to clear, starting at 0 for the least-significant (rightmost) bit
29+
30+
[float]
31+
=== Returns
32+
Nothing
33+
34+
--
35+
// OVERVIEW SECTION ENDS
36+
37+
38+
39+
40+
// HOW TO USE SECTION STARTS
41+
[#howtouse]
42+
--
43+
44+
[float]
45+
=== See also
46+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
47+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
48+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
49+
50+
[role="language"]
51+
* #LANGUAGE# link:bit{ext-relative}[bit()] +
52+
* #LANGUAGE# link:bitRead{ext-relative}[bitRead()] +
53+
* #LANGUAGE# link:bitWrite{ext-relative}[bitWrite()] +
54+
* #LANGUAGE# link:bitSet{ext-relative}[bitSet()]
55+
--
56+
// HOW TO USE SECTION ENDS
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= bitRead()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Reads a bit of a number.
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`bitRead(x, n)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: the number from which to read
27+
28+
`n`: which bit to read, starting at 0 for the least-significant (rightmost) bit
29+
30+
31+
[float]
32+
=== Returns
33+
the value of the bit (0 or 1).
34+
35+
--
36+
// OVERVIEW SECTION ENDS
37+
38+
39+
40+
41+
// HOW TO USE SECTION STARTS
42+
[#howtouse]
43+
--
44+
45+
[float]
46+
=== See also
47+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
48+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
49+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
50+
51+
[role="language"]
52+
* #LANGUAGE# link:bit{ext-relative}[bit()] +
53+
* #LANGUAGE# link:bitWrite{ext-relative}[bitWrite()]
54+
55+
--
56+
// HOW TO USE SECTION ENDS
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= bitSet()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
Sets (writes a 1 to) a bit of a numeric variable.
11+
[#overview]
12+
--
13+
14+
[float]
15+
=== Description
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`bitSet(x, n)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: the numeric variable whose bit to set
27+
28+
`n`: which bit to set, starting at 0 for the least-significant (rightmost) bit
29+
30+
[float]
31+
=== Returns
32+
Nothing
33+
34+
--
35+
// OVERVIEW SECTION ENDS
36+
37+
38+
39+
40+
// HOW TO USE SECTION STARTS
41+
[#howtouse]
42+
--
43+
44+
[float]
45+
=== See also
46+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
47+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
48+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
49+
50+
[role="language"]
51+
* #LANGUAGE# link:bit{ext-relative}[bit()] +
52+
* #LANGUAGE# link:bitRead{ext-relative}[bitRead()] +
53+
* #LANGUAGE# link:bitWrite{ext-relative}[bitWrite()] +
54+
* #LANGUAGE# link:bitClear{ext-relative}[bitClear()]
55+
--
56+
// HOW TO USE SECTION ENDS
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= bitWrite()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Writes a bit of a numeric variable.
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`bitWrite(x, n, b)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: the numeric variable to which to write
27+
28+
`n`: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit
29+
30+
`b`: the value to write to the bit (0 or 1)
31+
32+
[float]
33+
=== Returns
34+
Nothing
35+
36+
--
37+
// OVERVIEW SECTION ENDS
38+
39+
40+
41+
42+
// HOW TO USE SECTION STARTS
43+
[#howtouse]
44+
--
45+
46+
[float]
47+
=== See also
48+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
49+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
50+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
51+
52+
[role="language"]
53+
* #LANGUAGE# link:bit{ext-relative}[bit()] +
54+
* #LANGUAGE# link:bitRead{ext-relative}[bitRead()] +
55+
* #LANGUAGE# link:bitSet{ext-relative}[bitSet()] +
56+
* #LANGUAGE# link:bitClear{ext-relative}[bitClear()]
57+
58+
--
59+
// HOW TO USE SECTION ENDS
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= highByte()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Extracts the high-order (leftmost) byte of a word (or the second lowest byte of a larger data type).
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`highByte(x)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: a value of any type
27+
28+
[float]
29+
=== Returns
30+
byte
31+
32+
--
33+
// OVERVIEW SECTION ENDS
34+
35+
36+
37+
38+
// HOW TO USE SECTION STARTS
39+
[#howtouse]
40+
--
41+
42+
[float]
43+
=== See also
44+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
45+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
46+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
47+
48+
[role="language"]
49+
* #LANGUAGE# link:lowByte{ext-relative}[lowByte()] +
50+
* #LANGUAGE# link:word{ext-relative}[word()]
51+
52+
--
53+
// HOW TO USE SECTION ENDS
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
:source-highlighter: pygments
2+
:pygments-style: arduino
3+
:ext-relative: adoc
4+
5+
6+
= lowByte()
7+
8+
9+
// OVERVIEW SECTION STARTS
10+
[#overview]
11+
--
12+
13+
[float]
14+
=== Description
15+
Extracts the low-order (rightmost) byte of a variable (e.g. a word).
16+
[%hardbreaks]
17+
18+
19+
[float]
20+
=== Syntax
21+
`lowByte(x)`
22+
23+
24+
[float]
25+
=== Parameters
26+
`x`: a value of any type
27+
28+
[float]
29+
=== Returns
30+
byte
31+
--
32+
// OVERVIEW SECTION ENDS
33+
34+
35+
36+
37+
// HOW TO USE SECTION STARTS
38+
[#howtouse]
39+
--
40+
41+
[float]
42+
=== See also
43+
// Link relevant content by category, such as other Reference terms (please add the tag #LANGUAGE#),
44+
// definitions (please add the tag #DEFINITION#), and examples of Projects and Tutorials
45+
// (please add the tag #EXAMPLE#) ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
46+
47+
[role="language"]
48+
* #LANGUAGE# link:highByte{ext-relative}[highByte()] +
49+
* #LANGUAGE# link:word{ext-relative}[word()]
50+
51+
--
52+
// HOW TO USE SECTION ENDS

0 commit comments

Comments
 (0)