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: MODSERIAL mbed-rtos mbed
Fork of Master by
main.cpp@1:e1cfb5850088, 2014-09-11 (annotated)
- Committer:
- 9uS7
- Date:
- Thu Sep 11 14:42:49 2014 +0000
- Revision:
- 1:e1cfb5850088
- Parent:
- 0:4f07ba929908
- Child:
- 2:c610e1a7fbcd
can compile
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
9uS7 | 0:4f07ba929908 | 1 | //Master mbed Program |
9uS7 | 0:4f07ba929908 | 2 | |
9uS7 | 0:4f07ba929908 | 3 | #include "mbed.h" |
9uS7 | 0:4f07ba929908 | 4 | #include "fm.h" |
9uS7 | 0:4f07ba929908 | 5 | #include "bluetooth.h" |
9uS7 | 1:e1cfb5850088 | 6 | #include "control.h" |
9uS7 | 0:4f07ba929908 | 7 | |
9uS7 | 1:e1cfb5850088 | 8 | //BT_MASTER or BT_SLAVE |
9uS7 | 1:e1cfb5850088 | 9 | #define DEVICE_ROLE BT_MASTER |
9uS7 | 0:4f07ba929908 | 10 | |
9uS7 | 1:e1cfb5850088 | 11 | Serial pc(USBTX, USBRX); // tx, rx |
9uS7 | 0:4f07ba929908 | 12 | |
9uS7 | 0:4f07ba929908 | 13 | //debug |
9uS7 | 0:4f07ba929908 | 14 | DigitalOut led1(LED1); |
9uS7 | 0:4f07ba929908 | 15 | DigitalOut led2(LED2); |
9uS7 | 0:4f07ba929908 | 16 | DigitalOut led4(LED4); |
9uS7 | 0:4f07ba929908 | 17 | |
9uS7 | 0:4f07ba929908 | 18 | DigitalOut myled1(LED1); |
9uS7 | 0:4f07ba929908 | 19 | DigitalOut myled2(LED2); |
9uS7 | 0:4f07ba929908 | 20 | |
9uS7 | 0:4f07ba929908 | 21 | //byte converter |
9uS7 | 0:4f07ba929908 | 22 | Cvt cvt; |
9uS7 | 0:4f07ba929908 | 23 | |
9uS7 | 0:4f07ba929908 | 24 | void btRead(void); |
9uS7 | 0:4f07ba929908 | 25 | |
9uS7 | 0:4f07ba929908 | 26 | int main() |
9uS7 | 0:4f07ba929908 | 27 | { |
9uS7 | 1:e1cfb5850088 | 28 | //FM_FREQUENCY is defined in fm.h |
9uS7 | 1:e1cfb5850088 | 29 | unsigned int fm_frequency = DEVICE_ROLE==BT_MASTER ? FM_FREQUENCY1 : FM_FREQUENCY2; |
9uS7 | 1:e1cfb5850088 | 30 | |
9uS7 | 1:e1cfb5850088 | 31 | i2cSetup( fm_frequency ); |
9uS7 | 1:e1cfb5850088 | 32 | btSetup(DEVICE_ROLE); |
9uS7 | 0:4f07ba929908 | 33 | while(1){ |
9uS7 | 0:4f07ba929908 | 34 | /*i2c.start(); |
9uS7 | 0:4f07ba929908 | 35 | i2c.write(0x11); |
9uS7 | 0:4f07ba929908 | 36 | i2c.write(0x42); |
9uS7 | 0:4f07ba929908 | 37 | i2c.write(0x07); |
9uS7 | 0:4f07ba929908 | 38 | i2c.write(0x0F); |
9uS7 | 0:4f07ba929908 | 39 | i2c.stop(); |
9uS7 | 0:4f07ba929908 | 40 | wait(0.05);*/ |
9uS7 | 0:4f07ba929908 | 41 | } |
9uS7 | 0:4f07ba929908 | 42 | } |
9uS7 | 0:4f07ba929908 | 43 | |
9uS7 | 0:4f07ba929908 | 44 |