public ErrorCode SetControlFramePeriod(CANifierControlFrame frame, int periodMs)
        {
            /* sterilize inputs */
            if (periodMs < 0)
            {
                periodMs = 0;
            }
            if (periodMs > 0xFF)
            {
                periodMs = 0xFF;
            }

            uint fullId = (uint)((int)_baseArbId | (int)frame); /* build ID */

            /* apply the change if frame is transmitting */
            int err = CTRE.Native.CAN.GetSendBuffer(fullId, ref _cache);

            if (err == 0)
            {
                err = CTRE.Native.CAN.Send(fullId, _cache, 8, (uint)periodMs);
            }

            return(SetLastError(err));
        }
Exemple #2
0
 /// <summary>
 /// Sets the period of the given control frame.
 /// </summary>
 /// <param name="frame">Frame whose period is to be changed.</param>
 /// <param name="periodMs">Period in ms for the given frame.</param>
 /// <returns>Error Code generated by function. 0 indicates no error.</returns>
 public ErrorCode SetControlFramePeriod(CANifierControlFrame frame, int periodMs)
 {
     return((ErrorCode)CANifierNative.JNI_SetControlFramePeriod(m_handle, (int)frame, periodMs));
 }
Exemple #3
0
        /**
         * Sets the period of the given control frame.
         *
         * @param frame
         *            Frame whose period is to be changed.
         * @param periodMs
         *            Period in ms for the given frame.
         * @return Error Code generated by function. 0 indicates no error.
         */
        public ErrorCode SetControlFramePeriod(CANifierControlFrame frame, int periodMs)
        {
            ErrorCode retval = _ll.SetControlFramePeriod(frame, periodMs);

            return(retval);
        }