Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UIT2_MovingAverage UIT2_AllpassReverb UIT2_CombReverb UIT2_FIR_LPF_Symmetry ... more
Revision 1:b59e98443a6e, committed 2014-10-22
- Comitter:
- MikamiUitOpen
- Date:
- Wed Oct 22 08:59:28 2014 +0000
- Parent:
- 0:6e0ed5adfe47
- Child:
- 2:2a3b4ed3eb58
- Commit message:
- 2
Changed in this revision
| DAC_MCP4922Dual.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/DAC_MCP4922Dual.hpp Wed Oct 22 08:59:28 2014 +0000
@@ -0,0 +1,44 @@
+//------------------------------------------------------
+// Class for dual channel DAC in MCP4922
+// 2014/10/22, Copyright (c) 2014 MIKAMI, Naoki
+//------------------------------------------------------
+
+#ifndef DAC_MCP4922_DUAL_HPP
+#define DAC_MCP4922_DUAL_HPP
+
+//#include "mbed.h"
+#include "DAC_MCP4922.hpp"
+namespace Mikami
+{
+ class DAC_MCP4922Dual
+ {
+ public:
+ DAC_MCP4922Dual()
+ : myDac1_(DAC_MCP4922::DAC_A),
+ myDac2_(DAC_MCP4922::DAC_B)
+ { myDac1_.LdacH(); }
+
+ void Write(float valA, float valB)
+ {
+ myDac1_.Write(valA); // Write to DAC A
+ while (myDac1_.IsBusy()) {}
+ myDac2_.Write(valB); // Write to DAC B
+ while (myDac2_.IsBusy()) {}
+ myDac1_.Ldac();
+ }
+
+ void Write(uint16_t valA, uint16_t valB)
+ {
+ myDac1_.Write(valA); // Write to DAC A
+ while (myDac1_.IsBusy()) {}
+ myDac2_.Write(valB); // Write to DAC B
+ while (myDac2_.IsBusy()) {}
+ myDac1_.Ldac(); // dual load
+ }
+
+ private:
+ DAC_MCP4922 myDac1_;
+ DAC_MCP4922 myDac2_;
+ };
+}
+#endif // DAC_MCP4922_DUAL_HPP