Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v0.0.5 #20

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion out/can_database.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

/**
* This file was generated by cantools version 38.0.0 Sat Feb 4 18:33:02 2023.
* This file was generated by cantools version 38.0.0 Thu Mar 2 15:16:34 2023.
*/

#include <string.h>
Expand Down
4 changes: 1 addition & 3 deletions out/can_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

/**
* This file was generated by cantools version 38.0.0 Sat Feb 4 18:33:02 2023.
* This file was generated by cantools version 38.0.0 Thu Mar 2 15:16:34 2023.
*/

#ifndef CAN_DATABASE_H
Expand Down Expand Up @@ -893,8 +893,6 @@ struct can_database_pm100_digital_input_status_t {
/**
* Signals in message PM100_Analog_Input_Voltages.
*
*
*
* All signal values are as on the CAN bus.
*/
struct can_database_pm100_analog_input_voltages_t {
Expand Down
56 changes: 5 additions & 51 deletions out/can_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,19 @@
f(dst, src, length); \
} \

IMPL_HANDLER(can_database_pm100_modulation_and_flux_info_t, can_database_pm100_modulation_and_flux_info_unpack)
IMPL_HANDLER(can_database_pm100_torque_and_timer_info_t, can_database_pm100_torque_and_timer_info_unpack)
IMPL_HANDLER(can_database_pm100_read_write_param_response_t, can_database_pm100_read_write_param_response_unpack)
IMPL_HANDLER(can_database_pm100_read_write_param_command_t, can_database_pm100_read_write_param_command_unpack)
IMPL_HANDLER(can_database_pm100_command_message_t, can_database_pm100_command_message_unpack)
IMPL_HANDLER(can_database_pm100_fault_codes_t, can_database_pm100_fault_codes_unpack)
IMPL_HANDLER(can_database_pm100_internal_states_t, can_database_pm100_internal_states_unpack)
IMPL_HANDLER(can_database_pm100_internal_voltages_t, can_database_pm100_internal_voltages_unpack)
IMPL_HANDLER(can_database_pm100_flux_id_iq_info_t, can_database_pm100_flux_id_iq_info_unpack)
IMPL_HANDLER(can_database_pm100_voltage_info_t, can_database_pm100_voltage_info_unpack)
IMPL_HANDLER(can_database_pm100_current_info_t, can_database_pm100_current_info_unpack)
IMPL_HANDLER(can_database_pm100_motor_position_info_t, can_database_pm100_motor_position_info_unpack)
IMPL_HANDLER(can_database_pm100_digital_input_status_t, can_database_pm100_digital_input_status_unpack)
IMPL_HANDLER(can_database_pm100_analog_input_voltages_t, can_database_pm100_analog_input_voltages_unpack)
IMPL_HANDLER(can_database_pm100_temperature_set_3_t, can_database_pm100_temperature_set_3_unpack)
IMPL_HANDLER(can_database_pm100_temperature_set_2_t, can_database_pm100_temperature_set_2_unpack)
IMPL_HANDLER(can_database_pm100_temperature_set_1_t, can_database_pm100_temperature_set_1_unpack)
IMPL_HANDLER(can_database_pm100_firmware_info_t, can_database_pm100_firmware_info_unpack)
IMPL_HANDLER(can_database_pm100_diag_data_t, can_database_pm100_diag_data_unpack)
IMPL_HANDLER(can_database_pm100_u2_c_command_txd_t, can_database_pm100_u2_c_command_txd_unpack)
IMPL_HANDLER(can_database_pm100_u2_c_message_rxd_t, can_database_pm100_u2_c_message_rxd_unpack)
IMPL_HANDLER(can_database_bms_current_limit_t, can_database_bms_current_limit_unpack)
IMPL_HANDLER(can_database_pm100_fast_info_t, can_database_pm100_fast_info_unpack)

/**
* @brief Table of CAN message IDs and associated unpacking functions
*/
static const can_handler_t can_handler_table[] = {
{CAN_DATABASE_PM100_MODULATION_AND_FLUX_INFO_FRAME_ID, can_database_pm100_modulation_and_flux_info_t_handler},
{CAN_DATABASE_PM100_TORQUE_AND_TIMER_INFO_FRAME_ID, can_database_pm100_torque_and_timer_info_t_handler},
{CAN_DATABASE_PM100_READ_WRITE_PARAM_RESPONSE_FRAME_ID, can_database_pm100_read_write_param_response_t_handler},
{CAN_DATABASE_PM100_READ_WRITE_PARAM_COMMAND_FRAME_ID, can_database_pm100_read_write_param_command_t_handler},
{CAN_DATABASE_PM100_COMMAND_MESSAGE_FRAME_ID, can_database_pm100_command_message_t_handler},
{CAN_DATABASE_PM100_FAULT_CODES_FRAME_ID, can_database_pm100_fault_codes_t_handler},
{CAN_DATABASE_PM100_INTERNAL_STATES_FRAME_ID, can_database_pm100_internal_states_t_handler},
{CAN_DATABASE_PM100_INTERNAL_VOLTAGES_FRAME_ID, can_database_pm100_internal_voltages_t_handler},
{CAN_DATABASE_PM100_FLUX_ID_IQ_INFO_FRAME_ID, can_database_pm100_flux_id_iq_info_t_handler},
{CAN_DATABASE_PM100_VOLTAGE_INFO_FRAME_ID, can_database_pm100_voltage_info_t_handler},
{CAN_DATABASE_PM100_CURRENT_INFO_FRAME_ID, can_database_pm100_current_info_t_handler},
{CAN_DATABASE_PM100_MOTOR_POSITION_INFO_FRAME_ID, can_database_pm100_motor_position_info_t_handler},
{CAN_DATABASE_PM100_DIGITAL_INPUT_STATUS_FRAME_ID, can_database_pm100_digital_input_status_t_handler},
{CAN_DATABASE_PM100_ANALOG_INPUT_VOLTAGES_FRAME_ID, can_database_pm100_analog_input_voltages_t_handler},
{CAN_DATABASE_PM100_TEMPERATURE_SET_3_FRAME_ID, can_database_pm100_temperature_set_3_t_handler},
{CAN_DATABASE_PM100_TEMPERATURE_SET_2_FRAME_ID, can_database_pm100_temperature_set_2_t_handler},
{CAN_DATABASE_PM100_TEMPERATURE_SET_1_FRAME_ID, can_database_pm100_temperature_set_1_t_handler},
{CAN_DATABASE_PM100_FIRMWARE_INFO_FRAME_ID, can_database_pm100_firmware_info_t_handler},
{CAN_DATABASE_PM100_DIAG_DATA_FRAME_ID, can_database_pm100_diag_data_t_handler},
{CAN_DATABASE_PM100_U2_C_COMMAND_TXD_FRAME_ID, can_database_pm100_u2_c_command_txd_t_handler},
{CAN_DATABASE_PM100_U2_C_MESSAGE_RXD_FRAME_ID, can_database_pm100_u2_c_message_rxd_t_handler},
{CAN_DATABASE_BMS_CURRENT_LIMIT_FRAME_ID, can_database_bms_current_limit_t_handler},
{CAN_DATABASE_PM100_FAST_INFO_FRAME_ID, can_database_pm100_fast_info_t_handler},
{CAN_DATABASE_PM100_FAULT_CODES_FRAME_ID, 4, can_database_pm100_fault_codes_t_handler},
{CAN_DATABASE_PM100_INTERNAL_STATES_FRAME_ID, 3, can_database_pm100_internal_states_t_handler},
{CAN_DATABASE_PM100_CURRENT_INFO_FRAME_ID, 2, can_database_pm100_current_info_t_handler},
{CAN_DATABASE_PM100_MOTOR_POSITION_INFO_FRAME_ID, 1, can_database_pm100_motor_position_info_t_handler},
};

/**
Expand All @@ -81,18 +43,10 @@ const can_handler_t* can_handler_get(uint32_t index)
{
const can_handler_t* handler = NULL;

if (index < can_handler_table_size())
if (index < CAN_HANDLERS_TABLE_SIZE)
{
handler = &can_handler_table[index];
}

return handler;
}

/**
* @brief Returns the number of CAN handlers in the table
*/
uint32_t can_handler_table_size()
{
return sizeof(can_handler_table) / sizeof(can_handler_table[0]);
}
5 changes: 4 additions & 1 deletion out/can_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
#ifndef CAN_HANDLERS_H
#define CAN_HANDLERS_H

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

#define CAN_HANDLERS_TABLE_SIZE 4

/**
* @brief Entry in CAN handler table
*/
typedef struct {
uint32_t identifier;
uint32_t pdu_id;
void (*unpack_func)(uint8_t*, const uint8_t*, size_t);
} can_handler_t;

/*
* function prototypes
*/
const can_handler_t* can_handler_get(uint32_t index);
uint32_t can_handler_table_size();

#endif
Loading