Skip to content

Commit

Permalink
Streamline code
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlombardo committed Feb 13, 2024
1 parent 7ee7d92 commit ad90886
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 0 additions & 2 deletions MSB/api/msb_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#ifndef MSB_CAN_H
#define MSB_CAN_H

void loop_publish_can();

void start_can_publisher();

void stop_can_publisher();
Expand Down
2 changes: 1 addition & 1 deletion MSB/api/msb_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#ifndef MSB_COMMON_H
#define MSB_COMMON_H

void push_can_queue(char* message);
short push_can_queue(char* message);

#endif
9 changes: 7 additions & 2 deletions MSB/msb_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include "api/msb_common.h"
#include "api/msb_can.h"

char* queue[25];
#define MAX_SIZE 25

char* queue[MAX_SIZE];
int queue_index;
int running = 0;

Expand All @@ -22,6 +24,9 @@ void stop_can_publisher() {
running = 0;
}

void push_can_queue(char* message) {
short push_can_queue(char* message) {
if (queue_index == MAX_SIZE) return 0;

queue[queue_index++] = message;
return 1;
}
3 changes: 2 additions & 1 deletion MSB/msb_main.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

#include "api/msb_main.h"
#include "api/msb_can.h"
#include "cmsis_os.h"

//osThreadId_t canTaskHandle;
osThreadId_t canTaskHandle;

void init_msb() {
// spawn CAN output thread
Expand Down

0 comments on commit ad90886

Please sign in to comment.