aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Hardware/EmSPISlaveADS784x.h
diff options
context:
space:
mode:
Diffstat (limited to 'SrcShared/Hardware/EmSPISlaveADS784x.h')
-rw-r--r--SrcShared/Hardware/EmSPISlaveADS784x.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/SrcShared/Hardware/EmSPISlaveADS784x.h b/SrcShared/Hardware/EmSPISlaveADS784x.h
new file mode 100644
index 0000000..318e44c
--- /dev/null
+++ b/SrcShared/Hardware/EmSPISlaveADS784x.h
@@ -0,0 +1,97 @@
+/* -*- mode: C++; tab-width: 4 -*- */
+/* ===================================================================== *\
+ Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
+ All rights reserved.
+
+ This file is part of the Palm OS Emulator.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+\* ===================================================================== */
+
+#ifndef EmSPISlaveADS784x_h
+#define EmSPISlaveADS784x_h
+
+#include "EmSPISlave.h" // EmSPISlave
+
+enum EmADSChannelType
+{
+ kChannelUnused,
+ kChannelPenX,
+ kChannelPenY,
+ kChannelBattery7843,
+ kChannelBattery7846,
+ kChannelDockSerial,
+ kChannelDockTwister,
+ kChannelTemp0,
+ kChannelTemp1
+};
+
+
+#define kChannelSet1 \
+ kChannelTemp0, \
+ kChannelPenY, \
+ kChannelBattery7846, \
+ kChannelUnused, \
+ kChannelUnused, \
+ kChannelPenX, \
+ kChannelDockTwister, \
+ kChannelTemp1
+
+
+#define kChannelSet2 \
+ kChannelUnused, \
+ kChannelPenY, \
+ kChannelBattery7843, \
+ kChannelUnused, \
+ kChannelUnused, \
+ kChannelPenX, \
+ kChannelDockSerial, \
+ kChannelUnused
+
+
+#define kChannelSet3 \
+ kChannelUnused, \
+ kChannelPenY, \
+ kChannelBattery7843, \
+ kChannelUnused, \
+ kChannelUnused, \
+ kChannelPenX, \
+ kChannelDockTwister, \
+ kChannelUnused
+
+
+class EmSPISlaveADS784x : public EmSPISlave
+{
+ public:
+ EmSPISlaveADS784x (EmADSChannelType ch0,
+ EmADSChannelType ch1,
+ EmADSChannelType ch2,
+ EmADSChannelType ch3,
+ EmADSChannelType ch4,
+ EmADSChannelType ch5,
+ EmADSChannelType ch6,
+ EmADSChannelType ch7);
+ virtual ~EmSPISlaveADS784x (void);
+
+ virtual uint16 DoExchange (uint16 control, uint16 data);
+
+ protected:
+ void ProcessCommand (uint8);
+ void LoadPendingConversion (void);
+
+ private:
+ EmADSChannelType fChannelUse[8];
+
+ uint32 fBitBufferIn;
+ uint16 fBitBufferOut;
+ int fNumBitsIn;
+ uint16 fPendingResult;
+ Bool fHavePending;
+
+ int fCommandBitsSeen;
+};
+
+#endif // EmSPISlaveADS784x_h