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.
Dependencies: Array_Matrix F446_AD_DA UIT_AQM1602 mbed
Revision 6:96b4f6ce2dc9, committed 2017-02-21
- Comitter:
- MikamiUitOpen
- Date:
- Tue Feb 21 13:14:47 2017 +0000
- Parent:
- 5:503bd366fd73
- Commit message:
- 7
Changed in this revision
--- a/F446_AD_DA.lib Tue Jan 31 12:52:35 2017 +0000 +++ b/F446_AD_DA.lib Tue Feb 21 13:14:47 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/MikamiUitOpen/code/F446_AD_DA/#d1da91aec62f +http://mbed.org/users/MikamiUitOpen/code/F446_AD_DA/#bbc26cf86b70
--- a/main.cpp Tue Jan 31 12:52:35 2017 +0000
+++ b/main.cpp Tue Feb 21 13:14:47 2017 +0000
@@ -8,7 +8,7 @@
// 7: ピッチシフタ
// 9: 残響生成器
//
-// 2017/01/31, Copyright (c) 2017 MIKAMI, Naoki
+// 2017/02/21, Copyright (c) 2017 MIKAMI, Naoki
//--------------------------------------------------------
#include "F446_ADC_Interrupt.hpp" // AD, DA
@@ -23,21 +23,47 @@
const int FS_ = 24000; // 標本化周波数: 24 kHz
AdcDual_Intr myAdc_(FS_); // 参照:"F446_ADC_Interrupt.hpp"
DacDual myDac_; // 参照:"F446_DAC.hpp"
+DigitalOut ledG_(D10, 1); // LED 緑色
+BusIn sws_(D6, D7, D8, D9); // ロータリ・ディップ・スイッチ用
+Ticker timer_; // LED 点滅用
Through through_; // そのまま出力
VariableLpHp filter_(10, FS_); // 遮断周波数可変 IIR フィルタ
VocalCanceller vCancel_; // ボーカルキャンセラ
FrqShifter fShifter_(FS_); // ピッチシフタ
EchoSystem echo_; // 残響生成器
+
// 割り込みが有効になる前にポインタに割り当てておく必要がある
SignalProcessing *spPtr_ = &through_;
+void TimerIsr()
+{
+ static int count20 = 0;
+
+ int sw = sws_.read();
+ if ( ((sw & 0x01) == 0x01) && (sw < 10) )
+ {
+ if (count20 <= sw) ledG_ = !ledG_;
+ }
+ else
+ {
+ if (count20 < 10) ledG_ = 1;
+ else ledG_ = 0;
+ }
+
+ if (++count20 > 20)
+ {
+ count20 = 0;
+ ledG_ = 0;
+ }
+}
+
// ADC 変換終了割り込みに対する割り込みサービス・ルーチン
void AdcIsr()
{
float xn1, xn2, yn;
myAdc_.Read(xn1, xn2); // 入力
- yn = spPtr_->Execute(xn1, xn2); // 信号処理の実行
+ yn = spPtr_->Execute(xn1, xn2); // sw の値に応じた信号処理の実行
myDac_.Write(yn, yn); // 出力
}
@@ -45,8 +71,7 @@
{
printf("\r\nDemonstration for digital signal processing\r\n");
- BusIn sws(D6, D7, D8, D9); // ロータリ・ディップ・スイッチ用
- sws.mode(PullDown);
+ sws_.mode(PullDown);
AnalogIn a3In(A3); // VR からの電圧読み取り用
Aqm1602 lcd; // LCD 表示器
@@ -54,6 +79,12 @@
// 出力の LPF の遮断周波数を 10 kHz に設定
myDac_.ScfClock(10000*100);
+ NVIC_SetPriority(ADC_IRQn, 1);
+ NVIC_SetPriority(TIM5_IRQn, 2); // Ticker の割り込み優先度を ADC より低くする
+
+
+ timer_.attach(&TimerIsr, 0.2f); // タイマ割り込みの設定
+
// ADC 変換終了割り込みに対する割り込みサービス・ルーチン割り当て
myAdc_.SetIntrVec(&AdcIsr);
@@ -65,9 +96,9 @@
int sw; // 現在の機能切り替えスイッチの状態
do
{
- sw = sws.read();
+ sw = sws_.read();
wait_ms(50);
- } while (sw != sws.read());
+ } while (sw != sws_.read());
switch (sw)
{
@@ -109,3 +140,4 @@
wait(0.2f);
}
}
+
--- a/mbed.bld Tue Jan 31 12:52:35 2017 +0000 +++ b/mbed.bld Tue Feb 21 13:14:47 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f \ No newline at end of file