-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from PolySync/maint/reorganize-software-stack
Reorganize software stack
- Loading branch information
Showing
360 changed files
with
6,756 additions
and
10,869 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* @file brake_can_protocol.h | ||
* @brief Brake CAN Protocol. | ||
* | ||
*/ | ||
|
||
|
||
#ifndef _OSCC_BRAKE_CAN_PROTOCOL_H_ | ||
#define _OSCC_BRAKE_CAN_PROTOCOL_H_ | ||
|
||
|
||
#include <stdint.h> | ||
#include "magic.h" | ||
|
||
|
||
/* | ||
* @brief Brake command message (CAN frame) ID. | ||
* | ||
*/ | ||
#define OSCC_BRAKE_COMMAND_CAN_ID (0x60) | ||
|
||
/* | ||
* @brief Brake report message (CAN frame) ID. | ||
* | ||
*/ | ||
#define OSCC_BRAKE_REPORT_CAN_ID (0x61) | ||
|
||
/* | ||
* @brief Brake report message (CAN frame) length. | ||
* | ||
*/ | ||
#define OSCC_BRAKE_REPORT_CAN_DLC (8) | ||
|
||
/* | ||
* @brief Brake report message publishing frequency. [Hz] | ||
* | ||
*/ | ||
#define OSCC_BRAKE_REPORT_PUBLISH_FREQ_IN_HZ (50) | ||
|
||
/* | ||
* @brief Brake DTC bitfield position indicating an invalid sensor value. | ||
* | ||
*/ | ||
#define OSCC_BRAKE_DTC_INVALID_SENSOR_VAL (0x0) | ||
|
||
|
||
#pragma pack(push) | ||
#pragma pack(1) | ||
|
||
/** | ||
* @brief Brake command message data. | ||
* | ||
* CAN frame ID: \ref OSCC_BRAKE_COMMAND_CAN_ID | ||
* | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t magic[2]; /* Magic number identifying CAN frame as from OSCC. | ||
Byte 0 should be \ref OSCC_MAGIC_BYTE_0. | ||
Byte 1 should be \ref OSCC_MAGIC_BYTE_1. */ | ||
|
||
uint16_t pedal_command; /*!< Pedal command. [65535 == 100%] */ | ||
|
||
uint8_t enable; /*!< Command to enable or disable steering control. | ||
* Zero value means disable. | ||
* Non-zero value means enable. */ | ||
|
||
uint8_t reserved[3]; /*!< Reserved. */ | ||
} oscc_brake_command_s; | ||
|
||
|
||
/** | ||
* @brief Brake report message data. | ||
* | ||
* CAN frame ID: \ref OSCC_BRAKE_REPORT_CAN_ID | ||
* | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t magic[2]; /* Magic number identifying CAN frame as from OSCC. | ||
Byte 0 should be \ref OSCC_MAGIC_BYTE_0. | ||
Byte 1 should be \ref OSCC_MAGIC_BYTE_1. */ | ||
|
||
uint8_t enabled; /*!< Braking controls enabled state. | ||
* Zero value means disabled (commands are ignored). | ||
* Non-zero value means enabled (no timeouts or overrides have occured). */ | ||
|
||
uint8_t operator_override; /*!< Driver override state. | ||
* Zero value means there has been no operator override. | ||
* Non-zero value means an operator has physically overridden | ||
* the system. */ | ||
|
||
uint8_t dtcs; /* Bitfield of DTCs present in the module. */ | ||
|
||
uint8_t reserved[3]; /*!< Reserved. */ | ||
} oscc_brake_report_s; | ||
|
||
#pragma pack(pop) | ||
|
||
#endif /* _OSCC_BRAKE_CAN_PROTOCOL_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,59 @@ | ||
/** | ||
* @file fault_can_protocol.h | ||
* @brief Fault CAN Protocol. | ||
* | ||
*/ | ||
|
||
|
||
#ifndef _OSCC_FAULT_CAN_PROTOCOL_H_ | ||
#define _OSCC_FAULT_CAN_PROTOCOL_H_ | ||
|
||
|
||
#include <stdint.h> | ||
#include "magic.h" | ||
|
||
/* | ||
* @brief Fault report message (CAN frame) ID. | ||
* | ||
*/ | ||
#define OSCC_FAULT_REPORT_CAN_ID (0x99) | ||
|
||
/* | ||
* @brief Fault report message (CAN frame) length. | ||
* | ||
*/ | ||
#define OSCC_FAULT_REPORT_CAN_DLC (8) | ||
|
||
|
||
typedef enum | ||
{ | ||
FAULT_ORIGIN_BRAKE, | ||
FAULT_ORIGIN_STEERING, | ||
FAULT_ORIGIN_THROTTLE | ||
} fault_origin_id_t; | ||
|
||
|
||
#pragma pack(push) | ||
#pragma pack(1) | ||
|
||
/** | ||
* @brief Fault report message data. | ||
* | ||
* Message size (CAN frame DLC): \ref OSCC_FAULT_REPORT_CAN_DLC | ||
* | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t magic[2]; /* Magic number identifying CAN frame as from OSCC. | ||
Byte 0 should be \ref OSCC_MAGIC_BYTE_0. | ||
Byte 1 should be \ref OSCC_MAGIC_BYTE_1. */ | ||
|
||
uint32_t fault_origin_id; /* ID of the module that is sending out the fault. */ | ||
|
||
uint8_t reserved[2]; /* Reserved */ | ||
} oscc_fault_report_s; | ||
|
||
#pragma pack(pop) | ||
|
||
|
||
#endif /* _OSCC_FAULT_CAN_PROTOCOL_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 @@ | ||
/** | ||
* @file magic.h | ||
* @brief Definitions of the magic bytes identifying messages as from OSCC. | ||
* | ||
*/ | ||
|
||
|
||
#ifndef _OSCC_MAGIC_H_ | ||
#define _OSCC_MAGIC_H_ | ||
|
||
|
||
/* | ||
* @brief First magic byte used in commands and reports to distinguish CAN | ||
* frame as coming from OSCC (and not OBD). | ||
* | ||
*/ | ||
#define OSCC_MAGIC_BYTE_0 ( 0x05 ) | ||
|
||
/* | ||
* @brief Second magic byte used in commands and reports to distinguish CAN | ||
* frame as coming from OSCC (and not OBD). | ||
* | ||
*/ | ||
#define OSCC_MAGIC_BYTE_1 ( 0xCC ) | ||
|
||
|
||
#endif /* _OSCC_MAGIC_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,103 @@ | ||
/** | ||
* @file steering_can_protocol.h | ||
* @brief Steering CAN Protocol. | ||
* | ||
*/ | ||
|
||
|
||
#ifndef _OSCC_STEERING_CAN_PROTOCOL_H_ | ||
#define _OSCC_STEERING_CAN_PROTOCOL_H_ | ||
|
||
|
||
#include <stdint.h> | ||
#include "magic.h" | ||
|
||
|
||
/* | ||
* @brief Steering command message (CAN frame) ID. | ||
* | ||
*/ | ||
#define OSCC_STEERING_COMMAND_CAN_ID (0x64) | ||
|
||
/* | ||
* @brief Steering report message (CAN frame) ID. | ||
* | ||
*/ | ||
#define OSCC_STEERING_REPORT_CAN_ID (0x65) | ||
|
||
/* | ||
* @brief Steering report message (CAN frame) length. | ||
* | ||
*/ | ||
#define OSCC_STEERING_REPORT_CAN_DLC (8) | ||
|
||
/* | ||
* @brief Steering report message publishing frequency. [Hz] | ||
* | ||
*/ | ||
#define OSCC_REPORT_STEERING_PUBLISH_FREQ_IN_HZ (50) | ||
|
||
/* | ||
* @brief Steering DTC bitfield position indicating an invalid sensor value. | ||
* | ||
*/ | ||
#define OSCC_STEERING_DTC_INVALID_SENSOR_VAL (0x0) | ||
|
||
|
||
#pragma pack(push) | ||
#pragma pack(1) | ||
|
||
/** | ||
* @brief Steering command message data. | ||
* | ||
* CAN frame ID: \ref OSCC_STEERING_COMMAND_CAN_ID | ||
* | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t magic[2]; /* Magic number identifying CAN frame as from OSCC. | ||
Byte 0 should be \ref OSCC_MAGIC_BYTE_0. | ||
Byte 1 should be \ref OSCC_MAGIC_BYTE_1. */ | ||
|
||
uint16_t spoof_value_low; /*!< Value to be sent on the low spoof signal. */ | ||
|
||
uint16_t spoof_value_high; /*!< Value to be sent on the high spoof signal. */ | ||
|
||
uint8_t enable; /*!< Command to enable or disable steering control. | ||
* Zero value means disable. | ||
* Non-zero value means enable. */ | ||
|
||
uint8_t reserved; /*!< Reserved. */ | ||
} oscc_steering_command_s; | ||
|
||
|
||
/** | ||
* @brief Steering report message data. | ||
* | ||
* CAN frame ID: \ref OSCC_STEERING_REPORT_CAN_ID | ||
* | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t magic[2]; /* Magic number identifying CAN frame as from OSCC. | ||
Byte 0 should be \ref OSCC_MAGIC_BYTE_0. | ||
Byte 1 should be \ref OSCC_MAGIC_BYTE_1. */ | ||
|
||
uint8_t enabled; /*!< Steering controls enabled state. | ||
* Zero value means disabled (commands are ignored). | ||
* Non-zero value means enabled (no timeouts or overrides have occured). */ | ||
|
||
uint8_t operator_override; /*!< Driver override state. | ||
* Zero value means there has been no operator override. | ||
* Non-zero value means an operator has physically overridden | ||
* the system. */ | ||
|
||
uint8_t dtcs; /* Bitfield of DTCs present in the module. */ | ||
|
||
uint8_t reserved[3]; /*!< Reserved. */ | ||
} oscc_steering_report_s; | ||
|
||
#pragma pack(pop) | ||
|
||
|
||
#endif /* _OSCC_STEERING_CAN_PROTOCOL_H_ */ |
Oops, something went wrong.