summaryrefslogtreecommitdiffstats
path: root/recipes-demo-hmi/can-lin/files/hvac-demo.service
stat options
Period:
Authors:

Commits per author per week (path 'recipes-demo-hmi/can-lin/files/hvac-demo.service')

AuthorW08 2025W09 2025W10 2025W11 2025Total
Total00000
1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#ifndef __READ_H__
#define __READ_H__

#include <stdint.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Public: Parse a CAN signal from a message and apply required transformation.
 *
 * source - the payload containing the signal.
 * bit_offset - the starting bit for the signal.
 * bit_size - the width of the signal.
 * factor - the transformation factor for the signal value, applied after
 *      pulling out the bit field. Use 1.0 for no factor.
 * offset - the transformation offset for the signal value, applied after
 *      pulling out the bit field. Use 0 for no offset.
 *
 * Returns the decoded and transformed value of the signal.
 */
float eightbyte_parse_float(const uint64_t source, const uint8_t bit_offset,
        const uint8_t bit_size, const float factor, const float offset);

/* Public: Parse a CAN signal from a message storage as a byte array and apply
 * required transformation.
 *
 * source - the payload containing the signal.
 * source_size - the size of the payload in bytes.
 * bit_offset - the starting bit for the signal.
 * bit_size - the width of the signal.
 * factor - the transformation factor for the signal value, applied after
 *      pulling out the bit field. Use 1.0 for no factor.
 * offset - the transformation offset for the signal value, applied after
 *      pulling out the bit field. Use 0 for no offset.
 *
 * Returns the decoded and transformed value of the signal.
 */
float bitfield_parse_float(const uint8_t source[], const uint16_t source_size,
        const uint8_t bit_offset, const uint8_t bit_size, const float factor,
        const float offset);

/* Public: Parse a CAN signal from a message and interpret it as a boolean.
 *
 * source - the payload containing the signal.
 * bit_offset - the starting bit for the signal.
 * bit_size - the width of the signal.
 * factor - the transformation factor for the signal value, applied after
 *      pulling out the bit field. Use 1.0 for no factor.
 * offset - the transformation offset for the signal value, applied after
 *      pulling out the bit field. Use 0 for no offset.
 *
 * Returns false if the value was 0, otherwise true.
 */
bool eightbyte_parse_bool(uint64_t source, uint8_t bit_offset, uint8_t bit_size,
        float factor, float offset);

/* Public: Parse a CAN signal from a message storage as a byte array and
 * interpret it as a boolean.
 *
 * source - the payload containing the signal.
 * source_size - the size of the payload in bytes.
 * bit_offset - the starting bit for the signal.
 * bit_size - the width of the signal.
 * factor - the transformation factor for the signal value, applied after
 *      pulling out the bit field. Use 1.0 for no factor.
 * offset - the transformation offset for the signal value, applied after
 *      pulling out the bit field. Use 0 for no offset.
 *
 * Returns false if the value was 0, otherwise true.
 */
bool bitfield_parse_bool(const uint8_t source[], const uint16_t source_size,
        const uint8_t bit_offset, const uint8_t bit_size, const float factor,
        const float offset);

#ifdef __cplusplus
}
#endif

#endif // __READ_H__