mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-06 00:36:25 +08:00
4afe6cfa50
2253dd3 fix volt ign detect
3b299d7 add ignition and refactor
af9af6d Merge pull request #110 from Jamezz/volt
13e850e more correct
f295063 add new define to tests
fec9758 gate that with debug
5516ebf one more ifdef
cac7b31 only panda has float
938d474 fpu enable
ffbf0c7 cleaner
de30f27 Revert "need f to not be double"
4142acf need f to not be double
3eb15c8 refactor to share code
a4c8b64 change to O2 to fix make recover
711fd11 Enable compiler optimizations, fix things it breaks
2e6f774 block IPAS in main toyota safety mode
e7a2b3a add ipas tests
894572c fix tests
367c9ad add safety toyota ipas
95919b9 Bounty: panda high quality CAN autobaud (#96)
6557cd2 Toyota Safety: allow controls only on rising edge of cruise_engaged
02c1ddf Revert "added steer override check when IPAS is in control (#106)"
9f925ba Fix the merge mess
23d3833 Merge from comma upstream
a0cc51a Undo safety mode override
ea1c1dc make wlan interface name generic
6dbd8c9 Implement WebUSB and upgrade WinUSB to 2.0 (#107)
4fc83a5 Add safety hook for ignition and have GM use gear selector to determine ignition
52b2ac0 switch from travis to circleci
48e2374 build panda esp image
065572a circleci build stm image
7a1f319 add panda python package test and fix safety test
021dde7 move saftey test helper files into safety folder
ce0545f add ci files
6a3307c no LIN over ELM
7d21acb added steer override check when IPAS is in control (#106)
1c88caf Safety code testing (#104)
f4efd1f Merge pull request #101 from adhintz/master
c02618b Merge pull request #102 from quillford/master
1ba5f8a added link to wiki for user scripts
de2b19e add support for multiple buses to can_unique and can_bittransition output data in sorted order.
git-subtree-dir: panda
git-subtree-split: 2253dd3c48e21abb82fe161d6f58237490111206
old-commit-hash: e6e6ad2e1f
109 lines
2.1 KiB
C
109 lines
2.1 KiB
C
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t TIR; /*!< CAN TX mailbox identifier register */
|
|
uint32_t TDTR; /*!< CAN mailbox data length control and time stamp register */
|
|
uint32_t TDLR; /*!< CAN mailbox data low register */
|
|
uint32_t TDHR; /*!< CAN mailbox data high register */
|
|
} CAN_TxMailBox_TypeDef;
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t RIR; /*!< CAN receive FIFO mailbox identifier register */
|
|
uint32_t RDTR; /*!< CAN receive FIFO mailbox data length control and time stamp register */
|
|
uint32_t RDLR; /*!< CAN receive FIFO mailbox data low register */
|
|
uint32_t RDHR; /*!< CAN receive FIFO mailbox data high register */
|
|
} CAN_FIFOMailBox_TypeDef;
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t CNT;
|
|
} TIM_TypeDef;
|
|
|
|
struct sample_t torque_meas;
|
|
|
|
TIM_TypeDef timer;
|
|
TIM_TypeDef *TIM2 = &timer;
|
|
|
|
#define min(a,b) \
|
|
({ __typeof__ (a) _a = (a); \
|
|
__typeof__ (b) _b = (b); \
|
|
_a < _b ? _a : _b; })
|
|
|
|
#define max(a,b) \
|
|
({ __typeof__ (a) _a = (a); \
|
|
__typeof__ (b) _b = (b); \
|
|
_a > _b ? _a : _b; })
|
|
|
|
|
|
#define PANDA
|
|
#define static
|
|
#include "safety.h"
|
|
|
|
void set_controls_allowed(int c){
|
|
controls_allowed = c;
|
|
}
|
|
|
|
void reset_angle_control(void){
|
|
angle_control = 0;
|
|
}
|
|
|
|
int get_controls_allowed(void){
|
|
return controls_allowed;
|
|
}
|
|
|
|
void set_timer(int t){
|
|
timer.CNT = t;
|
|
}
|
|
|
|
void set_torque_meas(int min, int max){
|
|
torque_meas.min = min;
|
|
torque_meas.max = max;
|
|
}
|
|
|
|
int get_torque_meas_min(void){
|
|
return torque_meas.min;
|
|
}
|
|
|
|
int get_torque_meas_max(void){
|
|
return torque_meas.max;
|
|
}
|
|
|
|
void set_rt_torque_last(int t){
|
|
rt_torque_last = t;
|
|
}
|
|
|
|
void set_desired_torque_last(int t){
|
|
desired_torque_last = t;
|
|
}
|
|
|
|
int get_ego_speed(void){
|
|
return ego_speed;
|
|
}
|
|
|
|
int get_brake_prev(void){
|
|
return brake_prev;
|
|
}
|
|
|
|
int get_gas_prev(void){
|
|
return gas_prev;
|
|
}
|
|
|
|
void init_tests_toyota(void){
|
|
torque_meas.min = 0;
|
|
torque_meas.max = 0;
|
|
desired_torque_last = 0;
|
|
rt_torque_last = 0;
|
|
ts_last = 0;
|
|
set_timer(0);
|
|
}
|
|
|
|
void init_tests_honda(void){
|
|
ego_speed = 0;
|
|
gas_interceptor_detected = 0;
|
|
brake_prev = 0;
|
|
gas_prev = 0;
|
|
}
|