Exemplo n.º 1
0
    /// <summary>
    /// SPIDARの初期化を明示的に実行する.
    /// 初期化に成功した場合はtrueを返す.
    /// </summary>
    /// <returns>
    /// true: 成功
    /// false: 失敗
    /// </returns>
    public bool Initialize()
    {
        if (spidar != null)
        {
            spidar.Stop();
            spidar.Dispose();
            spidar = null;
        }

        spidar = Spidar.Create(SerialNumber, (int)DeviceType);

        if (spidar != null)
        {
            spidar.Start();

            for (int i = 0; i < 8; ++i)
            {
                gpioDownState[i] = true;
                gpioUpState[i]   = true;
            }

            updateSkipCount      = 100;
            meshRenderer.enabled = true;
            return(true);
        }
        else
        {
            meshRenderer.enabled = false;
            return(false);
        }
    }