SMPTE timedode (LTC) decode library for mbed
SMPTE timedode (LTC) decode library
SMPTEタイムコードをデコード(受信)・エンコード(送信)するライブラリです。
平衡/不平衡/サウンド等によるLTC信号は、適当な回路で整形して入力してください。
出力は適当なドライバ回路を設けてください。
簡易的なプログラムのため、細かいフラグなどは無視しています。
LPC1768 専用、Timer 2 を占有します。
Sample
Import programLTC_SMPTE_sample
SMPTE timedode (LTC) decode library for mbed https://developer.mbed.org/users/okini3939/code/LTC_SMPTE/
Diff: LTC_SMPTE.h
- Revision:
- 1:63ceee4bfd05
- Parent:
- 0:8d19e2158eb4
- Child:
- 2:13a89fffbb75
diff -r 8d19e2158eb4 -r 63ceee4bfd05 LTC_SMPTE.h --- a/LTC_SMPTE.h Mon Nov 16 12:51:43 2015 +0000 +++ b/LTC_SMPTE.h Fri Apr 13 04:05:13 2018 +0000 @@ -14,14 +14,25 @@ class LTC_SMPTE { public: - LTC_SMPTE (PinName input); + enum LTC_TYPE { + LTC_INPUT, + LTC_OUTPUT + }; + + LTC_SMPTE (PinName pin, enum LTC_TYPE type = LTC_INPUT); void read (int *hour, int *min, int *sec, int *frame, int *dir = NULL); int isReceived (); + void write (int hour, int min, int sec, int frame, int dir = 0); + + static LTC_SMPTE *_inst; + void isr_ticker (); + protected: - InterruptIn _input; + InterruptIn *_input; Timer _timer; + DigitalOut *_output; int mode; int oneflg; @@ -32,6 +43,9 @@ int drop, direction; int received; + enum LTC_TYPE type; + int phase, zeroflg; + void isr_change (); void parse_code ();