Skip to content

Commit

Permalink
Removing deprecated use of CAN lines for sending messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nwdepatie committed Dec 28, 2023
1 parent 83b8c83 commit 98a9029
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Core/Src/dti.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void dti_init(dti_t* mc)
void dti_set_current(int16_t current)
{
can_msg_t msg
= { .id = 0x00000110, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000110, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &current, msg.len);
Expand All @@ -31,7 +31,7 @@ void dti_set_current(int16_t current)
void dti_set_brake_current(int16_t brake_current)
{
can_msg_t msg
= { .id = 0x00000210, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000210, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &brake_current, msg.len);
Expand All @@ -41,7 +41,7 @@ void dti_set_brake_current(int16_t brake_current)
void dti_set_speed(int32_t rpm)
{
can_msg_t msg
= { .id = 0x00000310, .len = 4, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000310, .len = 4, .data = { 0 } };

rpm = rpm * NUM_POLES;

Expand All @@ -53,7 +53,7 @@ void dti_set_speed(int32_t rpm)
void dti_set_position(int16_t angle)
{
can_msg_t msg
= { .id = 0x00000410, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000410, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &angle, msg.len);
Expand All @@ -63,7 +63,7 @@ void dti_set_position(int16_t angle)
void dti_set_relative_current(int16_t relative_current)
{
can_msg_t msg
= { .id = 0x00000510, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000510, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &relative_current, msg.len);
Expand All @@ -73,7 +73,7 @@ void dti_set_relative_current(int16_t relative_current)
void dti_set_relative_brake_current(int16_t relative_brake_current)
{
can_msg_t msg
= { .id = 0x00000610, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000610, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &relative_brake_current, msg.len);
Expand All @@ -83,7 +83,7 @@ void dti_set_relative_brake_current(int16_t relative_brake_current)
void dti_set_digital_output(uint8_t output, bool value)
{
can_msg_t msg
= { .id = 0x00000710, .len = 1, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000710, .len = 1, .data = { 0 } };

uint8_t ctrl = value >> output;

Expand All @@ -95,7 +95,7 @@ void dti_set_digital_output(uint8_t output, bool value)
void dti_set_max_ac_current(int16_t current)
{
can_msg_t msg
= { .id = 0x00000810, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000810, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &current, msg.len);
Expand All @@ -105,7 +105,7 @@ void dti_set_max_ac_current(int16_t current)
void dti_set_max_ac_brake_current(int16_t current)
{
can_msg_t msg
= { .id = 0x00000910, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000910, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &current, msg.len);
Expand All @@ -115,7 +115,7 @@ void dti_set_max_ac_brake_current(int16_t current)
void dti_set_max_dc_current(int16_t current)
{
can_msg_t msg
= { .id = 0x00000A10, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000A10, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &current, msg.len);
Expand All @@ -125,7 +125,7 @@ void dti_set_max_dc_current(int16_t current)
void dti_set_max_dc_brake_current(int16_t current)
{
can_msg_t msg
= { .id = 0x00000B10, .len = 2, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000B10, .len = 2, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &current, msg.len);
Expand All @@ -135,7 +135,7 @@ void dti_set_max_dc_brake_current(int16_t current)
void dti_set_drive_enable(bool drive_enable)
{
can_msg_t msg
= { .id = 0x00000C10, .len = 1, .line = CAN_LINE_1, .data = { 0 } };
= { .id = 0x00000C10, .len = 1, .data = { 0 } };

/* Send CAN message */
memcpy(msg.data, &drive_enable, msg.len);
Expand Down

0 comments on commit 98a9029

Please sign in to comment.