Suga koubou
/
LTC_SMPTE_sample
SMPTE timedode (LTC) decode library for mbed https://developer.mbed.org/users/okini3939/code/LTC_SMPTE/
main.cpp@1:856bd5072ca0, 2018-04-13 (annotated)
- Committer:
- okini3939
- Date:
- Fri Apr 13 04:09:09 2018 +0000
- Revision:
- 1:856bd5072ca0
- Parent:
- 0:2af25457a32f
supported LTC output
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okini3939 | 0:2af25457a32f | 1 | #include "mbed.h" |
okini3939 | 0:2af25457a32f | 2 | #include "LTC_SMPTE.h" |
okini3939 | 0:2af25457a32f | 3 | |
okini3939 | 0:2af25457a32f | 4 | DigitalOut led1(LED1), led2(LED2); |
okini3939 | 0:2af25457a32f | 5 | Serial pc(USBTX, USBRX); |
okini3939 | 1:856bd5072ca0 | 6 | |
okini3939 | 1:856bd5072ca0 | 7 | LTC_SMPTE ltc(p21, LTC_SMPTE::LTC_INPUT); // input |
okini3939 | 1:856bd5072ca0 | 8 | //LTC_SMPTE ltc(p22, LTC_SMPTE::LTC_OUTPUT); // output |
okini3939 | 0:2af25457a32f | 9 | |
okini3939 | 0:2af25457a32f | 10 | int main() { |
okini3939 | 0:2af25457a32f | 11 | pc.baud(115200); |
okini3939 | 0:2af25457a32f | 12 | pc.printf("*** LTC\r\n"); |
okini3939 | 0:2af25457a32f | 13 | led1 = 1; |
okini3939 | 0:2af25457a32f | 14 | led2 = 0; |
okini3939 | 0:2af25457a32f | 15 | |
okini3939 | 1:856bd5072ca0 | 16 | // input |
okini3939 | 0:2af25457a32f | 17 | while(1) { |
okini3939 | 0:2af25457a32f | 18 | if (ltc.isReceived()) { |
okini3939 | 0:2af25457a32f | 19 | int hour, min, sec, frame; |
okini3939 | 0:2af25457a32f | 20 | ltc.read(&hour, &min, &sec, &frame); |
okini3939 | 0:2af25457a32f | 21 | pc.printf("%d %d %d %d\r\n", hour, min, sec, frame); |
okini3939 | 0:2af25457a32f | 22 | led2 = !led2; |
okini3939 | 0:2af25457a32f | 23 | } |
okini3939 | 0:2af25457a32f | 24 | } |
okini3939 | 1:856bd5072ca0 | 25 | /* |
okini3939 | 1:856bd5072ca0 | 26 | // output |
okini3939 | 1:856bd5072ca0 | 27 | ltc.write(0, 0, 0, 0); |
okini3939 | 1:856bd5072ca0 | 28 | while (1) { |
okini3939 | 1:856bd5072ca0 | 29 | int hour, min, sec, frame; |
okini3939 | 1:856bd5072ca0 | 30 | ltc.read(&hour, &min, &sec, &frame); |
okini3939 | 1:856bd5072ca0 | 31 | pc.printf("%d %d %d %d\r\n", hour, min, sec, frame); |
okini3939 | 1:856bd5072ca0 | 32 | led2 = !led2; |
okini3939 | 1:856bd5072ca0 | 33 | wait(1); |
okini3939 | 1:856bd5072ca0 | 34 | } |
okini3939 | 1:856bd5072ca0 | 35 | */ |
okini3939 | 0:2af25457a32f | 36 | } |