Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add As1115 driver, sample and datasheet #392

Merged
merged 7 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
namespace Meadow.Foundation.ICs.IOExpanders
{
public partial class As1115
{
/// <summary>
/// Valid addresses for the sensor.
/// </summary>
public enum Addresses : byte
{
/// <summary>
/// Bus address 0x00
/// </summary>
Address_0x00 = 0x00,
/// <summary>
/// Default bus address
/// </summary>
Default = Address_0x00
}

/// <summary>
/// The decode mode used for displaying pixels or characters
/// </summary>
public enum DecodeMode : byte
{
/// <summary>
/// Hexicemial charcter encoding for 7-segment displays
/// characters 0 to 9, E, H, L, P, and -
/// </summary>
//Hexidecimal,
/// <summary>
/// BCD character encoding for 7-segment displays
/// characters 0 to 9 and A to F
/// </summary>
//BCD,
/// <summary>
/// Direct pixel mapping for 8x8 matrix displays (default)
/// </summary>
Pixel,
}

/// <summary>
/// Key scan buttons
/// </summary>
public enum KeyScanButtonType : byte
{
/// <summary>
/// Button 1
/// Key A: 127, Key B: 255
/// </summary>
Button1,
/// <summary>
/// Button 2
/// Key A: 191, Key B: 255
/// </summary>
Button2,
/// <summary>
/// Button 3
/// Key A: 223, Key B: 255
/// </summary>
Button3,
/// <summary>
/// Button 4
/// Key A: 239, Key B: 255
/// </summary>
Button4,
/// <summary>
/// Button 5
/// Key A: 247, Key B: 255
/// </summary>
Button5,
/// <summary>
/// Button 6
/// Key A: 251, Key B: 255
/// </summary>
Button6,
/// <summary>
/// Button 7
/// Key A: 253, Key B: 255
/// </summary>
Button7,
/// <summary>
/// Button 8
/// Key A: 254, Key B: 255
/// </summary>
Button8,
/// <summary>
/// Button 9
/// Key A: 255, Key B: 127
/// </summary>
Button9,
/// <summary>
/// Button 10
/// Key A: 255, Key B: 191
/// </summary>
Button10,
/// <summary>
/// Button 11
/// Key A: 255, Key B: 223
/// </summary>
Button11,
/// <summary>
/// Button 11
/// Key A: 255, Key B: 239
/// </summary>
Button12,
/// <summary>
/// Button 12
/// Key A: 255, Key B: 247
/// </summary>
Button13,
/// <summary>
/// Button 13
/// Key A: 255, Key B: 251
/// </summary>
Button14,
/// <summary>
/// Button 15
/// Key A: 255, Key B: 253
/// </summary>
Button15,
/// <summary>
/// Button 16
/// Key A: 255, Key B: 254
/// </summary>
Button16,
/// <summary>
/// No button pressed or selected
/// </summary>
None,
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
namespace Meadow.Foundation.ICs.IOExpanders
{
public partial class As1115
{
const byte REG_DIGIT0 = 0x01;
const byte REG_DIGIT1 = 0x02;
const byte REG_DIGIT2 = 0x03;
const byte REG_DIGIT3 = 0x04;
const byte REG_DIGIT4 = 0x05;
const byte REG_DIGIT5 = 0x06;
const byte REG_DIGIT6 = 0x07;
const byte REG_DIGIT7 = 0x08;

const byte REG_DECODE_MODE = 0x09;
const byte REG_GLOBAL_INTEN = 0x0A;
const byte REG_SCAN_LIMIT = 0x0B;
const byte REG_SHUTDOWN = 0x0C;
const byte REG_SELF_ADDR = 0x2D;
const byte REG_FEATURE = 0x0E;
const byte REG_DISP_TEST = 0x0F;

const byte REG_DIGIT01_INTEN = 0x10;
const byte REG_DIGIT23_INTEN = 0x11;
const byte REG_DIGIT45_INTEN = 0x12;
const byte REG_DIGIT67_INTEN = 0x13;

const byte REG_DIGIT0_DIAG = 0x14;
const byte REG_DIGIT1_DIAG = 0x15;
const byte REG_DIGIT2_DIAG = 0x16;
const byte REG_DIGIT3_DIAG = 0x17;
const byte REG_DIGIT4_DIAG = 0x18;
const byte REG_DIGIT5_DIAG = 0x19;
const byte REG_DIGIT6_DIAG = 0x1A;
const byte REG_DIGIT7_DIAG = 0x1B;

const byte REG_KEYA = 0x1C;
const byte REG_KEYB = 0x1D;

const byte DECODE_RAW = 0x00;
const byte DECODE_FONT = 0x01;
const byte DECODE_ALL_RAW = 0x00;
const byte DECODE_ALL_FONT = 0xFF;

const byte FONT_CODEB = 0x00;
const byte FONT_HEX = 0x01;

const byte REG_FEATURE_EXTCLK = 0x00;
const byte REG_FEATURE_RESET = 0x01;
const byte REG_FEATURE_FONT = 0x02;
const byte REG_FEATURE_BLINK = 0x04;
const byte REG_FEATURE_BLINKFREQ = 0x05;
const byte REG_FEATURE_BLINKSYNC = 0x06;
const byte REG_FEATURE_BLINKSTART = 0x07;

const byte REG_SHUTDOWN_SHUTDOWN = 0x00;
const byte REG_SHUTDOWN_RUNNING = 0x01;
const byte REG_SHUTDOWN_RESET_FEATUREREG = 0x00;
const byte REG_SHUTDOWN_PRESERVE_FEATUREREG = 0x80;

const byte DP_OFF = 0x00;
const byte DP_ON = 0x01;
}
}
Loading