SMPTE timedode (LTC) decode library for mbed

Dependents:   LTC_SMPTE_sample

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/

LTC_SMPTE.h

Committer:
okini3939
Date:
2018-05-14
Revision:
2:13a89fffbb75
Parent:
1:63ceee4bfd05

File content as of revision 2:13a89fffbb75:

/**
 * SMPTE timedode (LTC) decode library for mbed
 * Copyright (c) 2015 Suga
 * Released under the MIT License: http://mbed.org/license/mit
 */
/** @file
 * @brief SMPTE timedode (LTC) decode library for mbed
 */

#ifndef _LTC_SMPTE_H_
#define _LTC_SMPTE_H_

#include "mbed.h"

class LTC_SMPTE {
public:
    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;
    Timer _timer;
    DigitalOut *_output;

    int mode;
    int oneflg;
    int count;
    int bit;
    char code[10];
    int hour, min, sec, frame;
    int drop, direction, fps;
    int received;

    enum LTC_TYPE type;
    int phase, zeroflg;

    void isr_change ();
    void parse_code ();

};

#endif