PN532
Dependents: PN532_GPIO PN532_ReadUid EX_encoder_PID_QianYuyangV4
Fork of LibPN532 by
Arduino.cpp@3:685e0bf1409d, 2018-01-15 (annotated)
- Committer:
- zhangyx
- Date:
- Mon Jan 15 17:12:41 2018 +0000
- Revision:
- 3:685e0bf1409d
- Parent:
- 0:db8030e71f55
disable debug message
Who changed what in which revision?
User | Revision | Line number | New 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 |