Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
/**
* 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 37.2.0 Sun Dec 18 09:02:57 2022.
*/
#ifndef CANDATA_H
#define CANDATA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#ifndef EINVAL
# define EINVAL 22
#endif
/* Frame ids. */
#define CANDATA_INDICATOR_CONTROL_FRAME_ID (0x188u)
#define CANDATA_SPEED_FRAME_ID (0x244u)
/* Frame lengths in bytes. */
#define CANDATA_INDICATOR_CONTROL_LENGTH (4u)
#define CANDATA_SPEED_LENGTH (5u)
/* Extended or standard frame types. */
#define CANDATA_INDICATOR_CONTROL_IS_EXTENDED (0)
#define CANDATA_SPEED_IS_EXTENDED (0)
/* Frame cycle times in milliseconds. */
/* Signal choices. */
#define CANDATA_INDICATOR_CONTROL_LEFT_INDICATOR_OFF_CHOICE (0u)
#define CANDATA_INDICATOR_CONTROL_LEFT_INDICATOR_ON_CHOICE (1u)
#define CANDATA_INDICATOR_CONTROL_RIGHT_INDICATOR_OFF_CHOICE (0u)
#define CANDATA_INDICATOR_CONTROL_RIGHT_INDICATOR_ON_CHOICE (1u)
/**
* Signals in message indicator_control.
*
* All signal values are as on the CAN bus.
*/
struct candata_indicator_control_t {
/**
* Range: 0..1 (0..1 -)
* Scale: 1
* Offset: 0
*/
uint8_t left_indicator;
/**
* Range: 0..1 (0..1 -)
* Scale: 1
* Offset: 0
*/
uint8_t right_indicator;
};
/**
* Signals in message speed.
*
* All signal values are as on the CAN bus.
*/
struct candata_speed_t {
/**
* Range: 0..48280 (0..48280 dam/h)
* Scale: 1
* Offset: 0
*/
uint16_t speed;
};
/**
* Pack message indicator_control.
*
* @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 candata_indicator_control_pack(
uint8_t *dst_p,
const struct candata_indicator_control_t *src_p,
size_t size);
/**
* Unpack message indicator_control.
*
* @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 candata_indicator_control_unpack(
struct candata_indicator_control_t *dst_p,
const uint8_t *src_p,
size_t size);
/**
* Encode given signal by applying scaling and offset.
*
* @param[in] value Signal to encode.
*
* @return Encoded signal.
*/
uint8_t candata_indicator_control_left_indicator_encode(double value);
/**
* Decode given signal by applying scaling and offset.
*
* @param[in] value Signal to decode.
*
* @return Decoded signal.
*/
double candata_indicator_control_left_indicator_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 candata_indicator_control_left_indicator_is_in_range(uint8_t value);
/**
* Encode given signal by applying scaling and offset.
*
* @param[in] value Signal to encode.
*
* @return Encoded signal.
*/
uint8_t candata_indicator_control_right_indicator_encode(double value);
/**
* Decode given signal by applying scaling and offset.
*
* @param[in] value Signal to decode.
*
* @return Decoded signal.
*/
double candata_indicator_control_right_indicator_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 candata_indicator_control_right_indicator_is_in_range(uint8_t value);
/**
* Pack message speed.
*
* @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 candata_speed_pack(
uint8_t *dst_p,
const struct candata_speed_t *src_p,
size_t size);
/**
* Unpack message speed.
*
* @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 candata_speed_unpack(
struct candata_speed_t *dst_p,
const uint8_t *src_p,
size_t size);
/**
* Encode given signal by applying scaling and offset.
*
* @param[in] value Signal to encode.
*
* @return Encoded signal.
*/
uint16_t candata_speed_speed_encode(double value);
/**
* Decode given signal by applying scaling and offset.
*
* @param[in] value Signal to decode.
*
* @return Decoded signal.
*/
double candata_speed_speed_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 candata_speed_speed_is_in_range(uint16_t value);
#ifdef __cplusplus
}
#endif
#endif