Пример #1
0
        private ControllerAreaNetwork.Timings GetTimings(CanAdapterSettings settings)
        {
            switch (ControllerAreaNetwork.SourceClock)
            {
            case 42000000:
                switch (settings.Speed)
                {
                case CanAdapterSettings.CanSpeed.Kbps100:
                    // 21TQ, 66%SP
                    return(new ControllerAreaNetwork.Timings(0, 12, 8, 20, 1));
                }
                break;

            case 72000000:
                switch (settings.Speed)
                {
                case CanAdapterSettings.CanSpeed.Kbps100:
                    // 24TQ, 65%SP
                    return(new ControllerAreaNetwork.Timings(0, 15, 8, 30, 1));
                }
                break;
            }
            throw new CanException("Specified baudrate isn't supported for current CAN controller frequency.");
        }
Пример #2
0
 public CanAdapter(CanAdapterSettings settings)
 {
     Settings = settings;
 }