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: F446_UpSampling_GraphicEqualizer F446_UpSampling_ReverbSystem F446_UpSampling_FrqShifter_Weaver Demo_F446_AD_DA_Multirate ... more
Revision 8:9429fb179c38, committed 2018-11-28
- Comitter:
- MikamiUitOpen
- Date:
- Wed Nov 28 12:33:20 2018 +0000
- Parent:
- 7:6275fe158ae8
- Child:
- 9:75bc15678d1b
- Commit message:
- 9
Changed in this revision
| F446_DAC.cpp | Show annotated file Show diff for this revision Revisions of this file |
| F446_DAC.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/F446_DAC.cpp Thu Oct 11 11:42:48 2018 +0000
+++ b/F446_DAC.cpp Wed Nov 28 12:33:20 2018 +0000
@@ -5,7 +5,7 @@
// DAC_OUT1: A2 (PA_4)
// DAC_OUT2: D13 (PA_5)
//
-// 2018/04/16, Copyright (c) 2018 MIKAMI, Naoki
+// 2018/11/28, Copyright (c) 2018 MIKAMI, Naoki
//--------------------------------------------------------
#include "F446_DAC.hpp"
@@ -21,26 +21,14 @@
}
if (pin == A2)
{
- DAC->CR = DAC_CR_EN1 | DAC_CR_TEN1 | DAC_CR_TSEL1;
+ DAC->CR = DAC_CR_EN1;
fpWriteDac = &DacF446::WriteDac1;
}
else
{
- DAC->CR = DAC_CR_EN2 | DAC_CR_TEN2 | DAC_CR_TSEL2;
+ DAC->CR = DAC_CR_EN2;
fpWriteDac = &DacF446::WriteDac2;
}
}
+}
- // DAC の CH1 へ出力する
- void DacF446::WriteDac1(uint16_t val)
- {
- DAC->DHR12R1 = val;
- DAC->SWTRIGR = DAC_SWTRIGR_SWTRIG1;
- }
- // DAC の CH2 へ出力する
- void DacF446::WriteDac2(uint16_t val)
- {
- DAC->DHR12R2 = val;
- DAC->SWTRIGR = DAC_SWTRIGR_SWTRIG2;
- }
-}
--- a/F446_DAC.hpp Thu Oct 11 11:42:48 2018 +0000
+++ b/F446_DAC.hpp Wed Nov 28 12:33:20 2018 +0000
@@ -7,7 +7,7 @@
// D13 (PA_5): このポートはマイコンボードの LED もドライブするので
// このポートは使わない方がよい
//
-// 2018/05/16, Copyright (c) 2018 MIKAMI, Naoki
+// 2018/11/28, Copyright (c) 2018 MIKAMI, Naoki
//--------------------------------------------------------
#include "mbed.h"
@@ -32,7 +32,7 @@
// -1.0f <= data <= 1.0f
void Write(float data) { WriteDac(ToUint16(data)); }
- // 0 <= data1<= 4095
+ // 0 <= data <= 4095
void Write(uint16_t data) { WriteDac(__USAT(data, BIT_WIDTH_)); }
private:
@@ -42,8 +42,8 @@
AnalogOut da_;
// DAC の片方のチェンネルへ出力する
- void WriteDac1(uint16_t val); // CH1 へ
- void WriteDac2(uint16_t val); // CH2 へ
+ void WriteDac1(uint16_t val) { DAC->DHR12R1 = val; } // CH1 へ
+ void WriteDac2(uint16_t val) { DAC->DHR12R2 = val; } // CH2 へ
void WriteDac(uint16_t val) { (this->*fpWriteDac)(val); }
@@ -58,3 +58,4 @@
};
}
#endif // F446_DAC_SINGLE_HPP
+