-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
BankStyle.cs
48 lines (46 loc) · 1.93 KB
/
BankStyle.cs
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
41
42
43
44
45
46
47
48
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Iot.Device.Mcp23xxx
{
/// <summary>
/// The MCP28XXX family has an address mapping concept for accessing registers.
/// This provides a way to easily address registers by group or type. This is only
/// relevant for 16-bit devices where it has two banks (Port A and B) of 8-bit
/// GPIO pins.
/// </summary>
public enum BankStyle
{
/// <summary>
/// This mode is used specifically for 16-bit devices where it treats the
/// two 8-bit banks as one 16-bit bank.
/// </summary>
/// <remarks>
/// Each of the registers are interleaved so that sending two bytes in a
/// row will set the equivalent register for the second bank. This way you
/// can set all 16 GPIO pins/settings with one command sequence.
///
/// Note that this behavior is also dependent on the default behavior
/// of IOCON.SEQOP = 0 (the default) which automatically increments the
/// register address as bytes come in.
///
/// This is IOCON.BANK = 0 and is the default.
/// </remarks>
Sequential = 0,
/// <summary>
/// This mode keeps the two 8-bit banks registers separate.
/// </summary>
/// <remarks>
/// While this keeps the register addresses for bank A the same as the
/// 8-bit controllers it requires sending a separate command sequence to
/// set all 16-bits as the second bank's register addresses are not
/// sequential.
///
/// Changing IOCON.SEQOP to 1 (not the default) will cause the
/// register address pointer to toggle between Port A and B for the
/// given register if in this mode.
///
/// This is IOCON.BANK = 1.
/// </remarks>
Separated = 1
}
}