-
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
12 changed files
with
180 additions
and
119 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
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
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
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
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,22 @@ | ||
#ifndef __SUPERCAP_H | ||
#define __SUPERCAP_H | ||
|
||
#include <stdint.h> | ||
#include "bsp_can.h" | ||
#include "referee_system.h" | ||
|
||
typedef struct | ||
{ | ||
uint8_t can_bus; | ||
uint16_t tx_id; | ||
uint16_t rx_id; | ||
uint8_t send_counter; | ||
|
||
uint8_t supercap_percent; | ||
} Supercap_t; | ||
|
||
void Supercap_Init(Supercap_t *g_supercap); | ||
void Supercap_Decode(CAN_Instance_t *can_instance); | ||
void Supercap_Send(void); | ||
|
||
#endif // __SUPERCAP_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "supercap.h" | ||
Supercap_t g_supercap; | ||
CAN_Instance_t *supercap_can_instance; | ||
|
||
void Supercap_Init(Supercap_t *g_supercap) | ||
{ | ||
// Initialize supercap | ||
g_supercap->can_bus = 1; | ||
g_supercap->tx_id = 0x166; | ||
g_supercap->rx_id = 0x188; | ||
supercap_can_instance = CAN_Device_Register(g_supercap->can_bus,g_supercap->tx_id,g_supercap->rx_id,Supercap_Decode); | ||
} | ||
|
||
void Supercap_Decode(CAN_Instance_t *can_instance) | ||
{ | ||
// Send supercap data | ||
uint8_t *data = can_instance->rx_buffer; | ||
g_supercap.supercap_percent = data[0]; | ||
} | ||
|
||
void Supercap_Send(void) | ||
{ | ||
// Send supercap data | ||
uint8_t *data = supercap_can_instance->tx_buffer; | ||
data[0] = 45;//Referee_Robot_State.Chassis_Power_Max; | ||
CAN_Transmit(supercap_can_instance); | ||
} |
Oops, something went wrong.