Forked from LibPN532

Dependents:   NFC_Secure_Access NFC_Secure_Access

Fork of LibPN532 by dotnfc Tang

Committer:
udareaniket
Date:
Sun Apr 22 23:29:20 2018 +0000
Revision:
2:9a2ab3fa7862
Parent:
0:db8030e71f55
Initial commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dotnfc 0:db8030e71f55 1 ////////////////////////////////////////////////////////////////////////////////
dotnfc 0:db8030e71f55 2 // arudino wraper functions
dotnfc 0:db8030e71f55 3 // by dotnfc@163.com
dotnfc 0:db8030e71f55 4 // 2016/09/10 18:16:00
dotnfc 0:db8030e71f55 5
dotnfc 0:db8030e71f55 6 #include "Arduino.h"
dotnfc 0:db8030e71f55 7
dotnfc 0:db8030e71f55 8
dotnfc 0:db8030e71f55 9 /*==============================================================================
dotnfc 0:db8030e71f55 10 * \brief arduino like 'tone ()'
dotnfc 0:db8030e71f55 11 */
dotnfc 0:db8030e71f55 12 void tone(PwmOut &buz, long frequency)
dotnfc 0:db8030e71f55 13 {
dotnfc 0:db8030e71f55 14 if (frequency == 0) {
dotnfc 0:db8030e71f55 15 buz = 0;
dotnfc 0:db8030e71f55 16 return;
dotnfc 0:db8030e71f55 17 }
dotnfc 0:db8030e71f55 18
dotnfc 0:db8030e71f55 19 float period;
dotnfc 0:db8030e71f55 20
dotnfc 0:db8030e71f55 21 // calculate the period of the note in turn play
dotnfc 0:db8030e71f55 22 period = 1000000 / frequency;
dotnfc 0:db8030e71f55 23 // set the period calculated at the PWM output
dotnfc 0:db8030e71f55 24 buz.period_us (period);
dotnfc 0:db8030e71f55 25 // establish a duty cycle of 50%
dotnfc 0:db8030e71f55 26 buz.write (0.50f);
dotnfc 0:db8030e71f55 27 }
dotnfc 0:db8030e71f55 28
dotnfc 0:db8030e71f55 29