foxBMS - Unit Tests  1.6.0
The foxBMS Unit Tests API Documentation
can_cbs_rx_aerosol-sensor.c File Reference

CAN driver Rx callback implementation. More...

#include "can_cbs_rx.h"
#include "can_cfg_rx-message-definitions.h"
#include "can_helper.h"
#include "diag.h"
#include <stdint.h>
Include dependency graph for can_cbs_rx_aerosol-sensor.c:

Go to the source code of this file.

Macros

#define CANRX_PARTICULAR_MATTER_CONCENTRATION_START_BIT   (7u)
 
#define CANRX_PARTICULAR_MATTER_CONCENTRATION_LENGTH   (16u)
 
#define CANRX_AEROSOL_SENSOR_STATUS_START_BIT   (34u)
 
#define CANRX_AEROSOL_SENSOR_STATUS_LENGTH   (3u)
 
#define CANRX_AEROSOL_SENSOR_FAULTS_START_BIT   (39u)
 
#define CANRX_AEROSOL_SENSOR_FAULTS_LENGTH   (5u)
 
#define CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_START_BIT   (63u)
 
#define CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_LENGTH   (8u)
 
#define CANRX_AEROSOL_SENSOR_STATUS_NORMAL   (0u)
 
#define CANRX_AEROSOL_SENSOR_STATUS_ALARM   (1u)
 
#define CANRX_AEROSOL_SENSOR_NO_ERROR   (0u)
 
#define CANRX_AEROSOL_SENSOR_PHOTOELECTRIC_ERROR   (1u)
 
#define CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_OVER_VOLTAGE_ERROR   (2u)
 
#define CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_UNDER_VOLTAGE_ERROR   (3u)
 

Functions

static void CANRX_HandleAerosolSensorErrors (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 Sets error flags in database as received from can message. More...
 
static void CANRX_HandleAerosolSensorStatus (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 Sets sensor status in database. More...
 
static void CANRX_SetParticulateMatterConcentration (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 Sets current particulate matter measurement value in database. More...
 
static void CANRX_SetAerosolSensorCrcCheckCode (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 Sets CRC check code from sensor in database. More...
 
uint32_t CANRX_AerosolSensor (CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
 can rx callback function for aerosol sensor messages More...
 
void TEST_CANRX_HandleAerosolSensorErrors (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 
void TEST_CANRX_HandleAerosolSensorStatus (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 
void TEST_CANRX_SetParticulateMatterConcentration (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 
void TEST_CANRX_SetAerosolSensorCrcCheckCode (const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
 

Detailed Description

CAN driver Rx callback implementation.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2023-08-29 (date of creation)
Updated
2023-10-12 (date of last update)
Version
v1.6.0
Prefix
CANRX

CAN Rx callback for aerosol sensor measurements

Definition in file can_cbs_rx_aerosol-sensor.c.

Macro Definition Documentation

◆ CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_LENGTH

#define CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_LENGTH   (8u)

Definition at line 72 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_START_BIT

#define CANRX_AEROSOL_SENSOR_CRC_CHECK_CODE_START_BIT   (63u)

Definition at line 71 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_FAULTS_LENGTH

#define CANRX_AEROSOL_SENSOR_FAULTS_LENGTH   (5u)

Definition at line 70 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_FAULTS_START_BIT

#define CANRX_AEROSOL_SENSOR_FAULTS_START_BIT   (39u)

Definition at line 69 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_NO_ERROR

#define CANRX_AEROSOL_SENSOR_NO_ERROR   (0u)

Definition at line 79 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_PHOTOELECTRIC_ERROR

#define CANRX_AEROSOL_SENSOR_PHOTOELECTRIC_ERROR   (1u)

Definition at line 80 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_STATUS_ALARM

#define CANRX_AEROSOL_SENSOR_STATUS_ALARM   (1u)

Definition at line 76 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_STATUS_LENGTH

#define CANRX_AEROSOL_SENSOR_STATUS_LENGTH   (3u)

Definition at line 68 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_STATUS_NORMAL

#define CANRX_AEROSOL_SENSOR_STATUS_NORMAL   (0u)

Definition at line 75 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_STATUS_START_BIT

#define CANRX_AEROSOL_SENSOR_STATUS_START_BIT   (34u)

Definition at line 67 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_OVER_VOLTAGE_ERROR

#define CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_OVER_VOLTAGE_ERROR   (2u)

Definition at line 81 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_UNDER_VOLTAGE_ERROR

#define CANRX_AEROSOL_SENSOR_VOLTAGE_SUPPLY_UNDER_VOLTAGE_ERROR   (3u)

Definition at line 82 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_PARTICULAR_MATTER_CONCENTRATION_LENGTH

#define CANRX_PARTICULAR_MATTER_CONCENTRATION_LENGTH   (16u)

Definition at line 66 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_PARTICULAR_MATTER_CONCENTRATION_START_BIT

#define CANRX_PARTICULAR_MATTER_CONCENTRATION_START_BIT   (7u)

Definition at line 65 of file can_cbs_rx_aerosol-sensor.c.

Function Documentation

◆ CANRX_AerosolSensor()

uint32_t CANRX_AerosolSensor ( CAN_MESSAGE_PROPERTIES_s  message,
const uint8_t *const  kpkCanData,
const CAN_SHIM_s *const  kpkCanShim 
)

can rx callback function for aerosol sensor messages

Parameters
[in]messagecontains the message ID, DLC and endianness
[in]kpkCanDatapayload of can frame
[in]kpkCanShimshim to the database entries

Definition at line 179 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function:

◆ CANRX_HandleAerosolSensorErrors()

static void CANRX_HandleAerosolSensorErrors ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)
static

Sets error flags in database as received from can message.

Parameters
kpkCanShimconst pointer to can shim
signalDatadata from can message that covers errors

Definition at line 118 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_HandleAerosolSensorStatus()

static void CANRX_HandleAerosolSensorStatus ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)
static

Sets sensor status in database.

Parameters
kpkCanShimconst pointer to can shim
signalDatadata from can message that covers status

Definition at line 145 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function:

◆ CANRX_SetAerosolSensorCrcCheckCode()

static void CANRX_SetAerosolSensorCrcCheckCode ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)
static

Sets CRC check code from sensor in database.

Parameters
kpkCanShimconst pointer to can shim
signalDatadata from can message that covers crc check code

Definition at line 170 of file can_cbs_rx_aerosol-sensor.c.

◆ CANRX_SetParticulateMatterConcentration()

static void CANRX_SetParticulateMatterConcentration ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)
static

Sets current particulate matter measurement value in database.

Parameters
kpkCanShimconst pointer to can shim
signalDatadata from can message that covers particulate matter measurement

Definition at line 163 of file can_cbs_rx_aerosol-sensor.c.

◆ TEST_CANRX_HandleAerosolSensorErrors()

void TEST_CANRX_HandleAerosolSensorErrors ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)

Definition at line 240 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function:

◆ TEST_CANRX_HandleAerosolSensorStatus()

void TEST_CANRX_HandleAerosolSensorStatus ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)

Definition at line 243 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function:

◆ TEST_CANRX_SetAerosolSensorCrcCheckCode()

void TEST_CANRX_SetAerosolSensorCrcCheckCode ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)

Definition at line 249 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function:

◆ TEST_CANRX_SetParticulateMatterConcentration()

void TEST_CANRX_SetParticulateMatterConcentration ( const CAN_SHIM_s *const  kpkCanShim,
uint16_t  signalData 
)

Definition at line 246 of file can_cbs_rx_aerosol-sensor.c.

Here is the call graph for this function: