-
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.
Hopefully Did Fan Batt Box Control Code
- Loading branch information
Showing
4 changed files
with
65 additions
and
0 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,17 @@ | ||
#include "pdu.h" | ||
|
||
// TODO: replace this temp value with real value | ||
#define CONTROL_CANID_FANBATTBOX = 0xA | ||
|
||
extern osThreadId_t control_handle; | ||
extern const osThreadAttr_t control_attributes; | ||
|
||
typedef struct { | ||
pdu_t *pdu; | ||
} control_args_t; | ||
|
||
void vEval_fanbattbox_state(void *param); | ||
|
||
void control_fanbattbox_record(can_msg_t args); | ||
|
||
int eval_fanbattbox_state(); |
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,35 @@ | ||
#include "control.h" | ||
#include "pdu.h" | ||
|
||
osThreadId_t control_handle; | ||
const osThreadAttr_t control_attributes = { | ||
.name = "Control", | ||
.stack_size = 128 * 8, | ||
.priority = (osPriority_t)osPriorityRealtime, | ||
}; | ||
|
||
static int fanBattBoxState = 0; | ||
|
||
void vEval_fanbattbox_state(void *param) | ||
{ | ||
control_args_t args = (control_args_t *)param; | ||
pdu_t *pdu = args->pdu; | ||
|
||
write_fan_battbox(pdu, eval_fanbattbox_state()); | ||
|
||
osDelay(1000); | ||
} | ||
|
||
void control_fanbattbox_record(can_msg_t msg) | ||
{ | ||
if (msg.data > 0) { | ||
fanBattBoxState = 1; | ||
} else { | ||
fanBattBoxState = 0; | ||
} | ||
} | ||
|
||
int eval_fanbattbox_state() | ||
{ | ||
return fanBattBoxState; | ||
} |
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