![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
NFCカードリーダー(RC-S620/S)とリレーを組み合わせ、日本の運転免許証をタッチしないとエンジンがかからない制御をします。動画でご紹介した無免許運転防止・免許不携帯防止システムのソースコードです。
Dependencies: mbed ATP301x_SPI PwmBeep RCS620_AB
Revision 1:d52c0ea6e922, committed 2020-06-07
- Comitter:
- hmizuno
- Date:
- Sun Jun 07 02:06:15 2020 +0000
- Parent:
- 0:8e6f778abf78
- Commit message:
- Ver_0_0_9_1 Add Audio Sleep
Changed in this revision
RCS620_AB.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8e6f778abf78 -r d52c0ea6e922 RCS620_AB.lib --- a/RCS620_AB.lib Fri May 29 09:24:11 2020 +0000 +++ b/RCS620_AB.lib Sun Jun 07 02:06:15 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/hmizuno/code/RCS620_AB/#16a4197a4dfb +https://os.mbed.com/users/hmizuno/code/RCS620_AB/#98c4a45b646a
diff -r 8e6f778abf78 -r d52c0ea6e922 main.cpp --- a/main.cpp Fri May 29 09:24:11 2020 +0000 +++ b/main.cpp Sun Jun 07 02:06:15 2020 +0000 @@ -3,7 +3,8 @@ * * 青mbed用 RTCを使用する標準バージョン * -* 2020/5/29 Ver 0.9 +* 2020/5/29 Ver 0.9 初回公開 +* 2020/6/7 Ver 0.91 音声回路スリープ追加 * **/ @@ -48,20 +49,24 @@ //ドライバ:https://os.mbed.com/docs/mbed-os/v5.15/tutorials/windows-serial-driver.html Serial pc(USBTX,USBRX); -//カードリーダー +//カードリーダー (tx,rx) RCS620S_AB rcs620(p28,p27); -//音声合成LSI +//音声合成LSI (misi,miso,sck,nss) ATP301x_SPI atp301x(p11, p12, p13, p14); -//ビープ(圧電スピーカー)出力 -PwmBeep beep(p22); - //スターター遮断リレー制御出力 DigitalOut relay(p30); +//ビープ(圧電スピーカー)出力 (pwmout) +PwmBeep beep(p21); + +//オーディオ回路電源制御 +DigitalOut nAtpSleep(p22); +DigitalOut afAmpSleep(p23); + //警告ブザー入力 -InterruptIn ig_start_sw(p23); +InterruptIn ig_start_sw(p24); //LED DigitalOut myled1(LED1); @@ -87,6 +92,8 @@ void allowDrive(); void disallowDrive(); void reset(); +void audioOn(); +void audioOff(); void announcePleaseTouch(); void igswRiseIrq(); void errorBeep(int); @@ -121,9 +128,10 @@ int main() { //起動処理 - disallowDrive(); + disallowDrive(); + audioOn(); + bool canDrive = false; - char atpbuf[ATP_MAX_LEN]; uint8_t* resArray = new uint8_t[rcs620.RETURN_ENVELOPE_SIZE]; @@ -362,9 +370,12 @@ } }//while終わり - //カードリーダの電源OFF rcs620.powerDown(); + + //オーディオ回路スリープ + audioOff(); + } /****************************************************************************/ @@ -392,6 +403,17 @@ myled4 = 0; } +void audioOn(){ + //ATP3011 Highだと動作、NJM2113 LOWだと動作 + afAmpSleep = 0; + nAtpSleep = 1; +} + +void audioOff(){ + afAmpSleep = 1; + nAtpSleep = 0; +} + void reset(){ rcs620.reset(); }