/** * The MIT License (MIT) * * Copyright (c) 2018-2019 Erik Moqvist * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * This file was generated by cantools version 0.1.dev1740+ge714fab Tue Jun 4 14:20:13 2024. */ #ifndef CAN1_H #define CAN1_H #ifdef __cplusplus extern "C" { #endif #include #include #include #ifndef EINVAL # define EINVAL 22 #endif /* Frame ids. */ #define CAN1_VN200_INS_FRAME_ID (0x01u) #define CAN1_VN200_IMU_FRAME_ID (0x02u) #define CAN1_VN200_YPR_FRAME_ID (0x05u) /* Frame lengths in bytes. */ #define CAN1_VN200_INS_LENGTH (8u) #define CAN1_VN200_IMU_LENGTH (8u) #define CAN1_VN200_YPR_LENGTH (8u) /* Extended or standard frame types. */ #define CAN1_VN200_INS_IS_EXTENDED (0) #define CAN1_VN200_IMU_IS_EXTENDED (0) #define CAN1_VN200_YPR_IS_EXTENDED (0) /* Frame cycle times in milliseconds. */ /* Signal choices. */ /* Frame Names. */ #define CAN1_VN200_INS_NAME "VN200_INS" #define CAN1_VN200_IMU_NAME "VN200_IMU" #define CAN1_VN200_YPR_NAME "VN200_YPR" /* Signal Names. */ #define CAN1_VN200_INS_YAW_NAME "Yaw" #define CAN1_VN200_IMU_MULTIPLEXER_NAME "multiplexer" #define CAN1_VN200_IMU_ACCX_NAME "accx" #define CAN1_VN200_IMU_ACCY_NAME "accy" #define CAN1_VN200_IMU_ACCZ_NAME "accz" #define CAN1_VN200_IMU_ANGX_NAME "angx" #define CAN1_VN200_IMU_ANGY_NAME "angy" #define CAN1_VN200_IMU_ANGZ_NAME "angz" #define CAN1_VN200_YPR_YAW_NAME "yaw" #define CAN1_VN200_YPR_PITCH_NAME "pitch" #define CAN1_VN200_YPR_ROLL_NAME "roll" /** * Signals in message VN200_INS. * * VN200 INS - Measurements with sensor fusion * * All signal values are as on the CAN bus. */ struct can1_vn200_ins_t { /** * Range: 0..64255 (0..8031.875 rpm) * Scale: 0.125 * Offset: 0 */ uint16_t yaw; }; /** * Signals in message VN200_IMU. * * VN200 IMU - Measurements only IMU without algorithms * * All signal values are as on the CAN bus. */ struct can1_vn200_imu_t { /** * Range: - * Scale: 0 * Offset: 0 */ uint8_t multiplexer; /** * Range: - * Scale: 0.06 * Offset: 0 */ int16_t accx; /** * Range: - * Scale: 0.06 * Offset: 0 */ int16_t accy; /** * Range: - * Scale: 0.06 * Offset: 0 */ int16_t accz; /** * Range: - * Scale: 0.002 * Offset: 0 */ int16_t angx; /** * Range: - * Scale: 0.002 * Offset: 0 */ int16_t angy; /** * Range: - * Scale: 0.002 * Offset: 0 */ int16_t angz; }; /** * Signals in message VN200_YPR. * * All signal values are as on the CAN bus. */ struct can1_vn200_ypr_t { /** * Range: - * Scale: 0.006 * Offset: 0 */ uint16_t yaw; /** * Range: - * Scale: 0.006 * Offset: 0 */ uint16_t pitch; /** * Range: - * Scale: 0.006 * Offset: 0 */ uint16_t roll; }; /** * Pack message VN200_INS. * * @param[out] dst_p Buffer to pack the message into. * @param[in] src_p Data to pack. * @param[in] size Size of dst_p. * * @return Size of packed data, or negative error code. */ int can1_vn200_ins_pack( uint8_t *dst_p, const struct can1_vn200_ins_t *src_p, size_t size); /** * Unpack message VN200_INS. * * @param[out] dst_p Object to unpack the message into. * @param[in] src_p Message to unpack. * @param[in] size Size of src_p. * * @return zero(0) or negative error code. */ int can1_vn200_ins_unpack( struct can1_vn200_ins_t *dst_p, const uint8_t *src_p, size_t size); /** * Init message fields to default values from VN200_INS. * * @param[in] msg_p Message to init. * * @return zero(0) on success or (-1) in case of nullptr argument. */ int can1_vn200_ins_init(struct can1_vn200_ins_t *msg_p); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ uint16_t can1_vn200_ins_yaw_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_ins_yaw_decode(uint16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_ins_yaw_is_in_range(uint16_t value); /** * Pack message VN200_IMU. * * @param[out] dst_p Buffer to pack the message into. * @param[in] src_p Data to pack. * @param[in] size Size of dst_p. * * @return Size of packed data, or negative error code. */ int can1_vn200_imu_pack( uint8_t *dst_p, const struct can1_vn200_imu_t *src_p, size_t size); /** * Unpack message VN200_IMU. * * @param[out] dst_p Object to unpack the message into. * @param[in] src_p Message to unpack. * @param[in] size Size of src_p. * * @return zero(0) or negative error code. */ int can1_vn200_imu_unpack( struct can1_vn200_imu_t *dst_p, const uint8_t *src_p, size_t size); /** * Init message fields to default values from VN200_IMU. * * @param[in] msg_p Message to init. * * @return zero(0) on success or (-1) in case of nullptr argument. */ int can1_vn200_imu_init(struct can1_vn200_imu_t *msg_p); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ uint8_t can1_vn200_imu_multiplexer_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_multiplexer_decode(uint8_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_multiplexer_is_in_range(uint8_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_accx_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_accx_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_accx_is_in_range(int16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_accy_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_accy_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_accy_is_in_range(int16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_accz_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_accz_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_accz_is_in_range(int16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_angx_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_angx_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_angx_is_in_range(int16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_angy_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_angy_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_angy_is_in_range(int16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ int16_t can1_vn200_imu_angz_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_imu_angz_decode(int16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_imu_angz_is_in_range(int16_t value); /** * Pack message VN200_YPR. * * @param[out] dst_p Buffer to pack the message into. * @param[in] src_p Data to pack. * @param[in] size Size of dst_p. * * @return Size of packed data, or negative error code. */ int can1_vn200_ypr_pack( uint8_t *dst_p, const struct can1_vn200_ypr_t *src_p, size_t size); /** * Unpack message VN200_YPR. * * @param[out] dst_p Object to unpack the message into. * @param[in] src_p Message to unpack. * @param[in] size Size of src_p. * * @return zero(0) or negative error code. */ int can1_vn200_ypr_unpack( struct can1_vn200_ypr_t *dst_p, const uint8_t *src_p, size_t size); /** * Init message fields to default values from VN200_YPR. * * @param[in] msg_p Message to init. * * @return zero(0) on success or (-1) in case of nullptr argument. */ int can1_vn200_ypr_init(struct can1_vn200_ypr_t *msg_p); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ uint16_t can1_vn200_ypr_yaw_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_ypr_yaw_decode(uint16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_ypr_yaw_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ uint16_t can1_vn200_ypr_pitch_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_ypr_pitch_decode(uint16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_ypr_pitch_is_in_range(uint16_t value); /** * Encode given signal by applying scaling and offset. * * @param[in] value Signal to encode. * * @return Encoded signal. */ uint16_t can1_vn200_ypr_roll_encode(double value); /** * Decode given signal by applying scaling and offset. * * @param[in] value Signal to decode. * * @return Decoded signal. */ double can1_vn200_ypr_roll_decode(uint16_t value); /** * Check that given signal is in allowed range. * * @param[in] value Signal to check. * * @return true if in range, false otherwise. */ bool can1_vn200_ypr_roll_is_in_range(uint16_t value); #ifdef __cplusplus } #endif #endif