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."); }
public CanAdapter(CanAdapterSettings settings) { Settings = settings; }