-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "cmsis_os.h" | ||
|
||
#define BMS_DATA_QUEUE_SIZE 8 | ||
|
||
typedef struct { | ||
uint16_t SoC; | ||
uint16_t current; | ||
} bms_data_t; | ||
|
||
extern osMessageQueueId_t bms_data_queue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "cmsis_os.h" | ||
#include "seven_segment.h" | ||
#include "fdcan.h" | ||
|
||
void vSendBmsData(void* pv_params); | ||
extern osThreadId_t send_bms_data_handle; | ||
extern const osThreadAttr_t send_bms_data_attributes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* Drivers for the seven segment display */ | ||
|
||
#include "seven_segment.h" | ||
#include <stdint.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* All RTOS tasks are defined here */ | ||
|
||
#include "tasks.h" | ||
#include "queues.h" | ||
#include "seven_segment.h" | ||
|
||
static I2C_HandleTypeDef* hi2c; | ||
|
||
osThreadId_t send_bms_data_handle; | ||
const osThreadAttr_t send_bms_data_handle_attributes = { | ||
.name = "SendBmsData", | ||
.stack_size = 128 * 8, | ||
.priority = (osPriority_t)osPriorityAboveNormal4 | ||
}; | ||
|
||
void vSendBmsData(void* pv_params) { | ||
|
||
hi2c = (I2C_HandleTypeDef*)pv_params; | ||
bms_data_t bms_data; | ||
|
||
for (;;) { | ||
if (osMessageQueueGet(bms_data_queue, &bms_data, NULL, 0U)) { | ||
write_current(hi2c, bms_data.current); | ||
write_charge(hi2c, bms_data.SoC); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters