mirror of https://github.com/commaai/panda.git
Fixed transceiver spelling
This commit is contained in:
parent
5e07142174
commit
09997428f3
|
@ -1,7 +1,7 @@
|
|||
// ******************** Prototypes ********************
|
||||
typedef void (*board_init)(void);
|
||||
typedef void (*board_enable_can_transciever)(uint8_t transciever, bool enabled);
|
||||
typedef void (*board_enable_can_transcievers)(bool enabled);
|
||||
typedef void (*board_enable_can_transceiver)(uint8_t transceiver, bool enabled);
|
||||
typedef void (*board_enable_can_transceivers)(bool enabled);
|
||||
typedef void (*board_set_led)(uint8_t color, bool enabled);
|
||||
typedef void (*board_set_usb_power_mode)(uint8_t mode);
|
||||
typedef void (*board_set_gps_mode)(uint8_t mode);
|
||||
|
@ -19,8 +19,8 @@ struct board {
|
|||
const char *board_type;
|
||||
const harness_configuration *harness_config;
|
||||
board_init init;
|
||||
board_enable_can_transciever enable_can_transciever;
|
||||
board_enable_can_transcievers enable_can_transcievers;
|
||||
board_enable_can_transceiver enable_can_transceiver;
|
||||
board_enable_can_transceivers enable_can_transceivers;
|
||||
board_set_led set_led;
|
||||
board_set_usb_power_mode set_usb_power_mode;
|
||||
board_set_gps_mode set_gps_mode;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Black Panda + Harness //
|
||||
// ///////////////////// //
|
||||
|
||||
void black_enable_can_transciever(uint8_t transciever, bool enabled) {
|
||||
switch (transciever){
|
||||
void black_enable_can_transceiver(uint8_t transceiver, bool enabled) {
|
||||
switch (transceiver){
|
||||
case 1U:
|
||||
set_gpio_output(GPIOC, 1, !enabled);
|
||||
break;
|
||||
|
@ -17,18 +17,18 @@ void black_enable_can_transciever(uint8_t transciever, bool enabled) {
|
|||
set_gpio_output(GPIOB, 10, !enabled);
|
||||
break;
|
||||
default:
|
||||
puts("Invalid CAN transciever ("); puth(transciever); puts("): enabling failed\n");
|
||||
puts("Invalid CAN transceiver ("); puth(transceiver); puts("): enabling failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void black_enable_can_transcievers(bool enabled) {
|
||||
void black_enable_can_transceivers(bool enabled) {
|
||||
for(uint8_t i=1U; i<=4U; i++){
|
||||
// Leave main CAN always on for CAN-based ignition detection
|
||||
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
|
||||
black_enable_can_transciever(i, true);
|
||||
black_enable_can_transceiver(i, true);
|
||||
} else {
|
||||
black_enable_can_transciever(i, enabled);
|
||||
black_enable_can_transceiver(i, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +198,8 @@ void black_init(void) {
|
|||
// Initialize harness
|
||||
harness_init();
|
||||
|
||||
// Enable CAN transcievers
|
||||
black_enable_can_transcievers(true);
|
||||
// Enable CAN transceivers
|
||||
black_enable_can_transceivers(true);
|
||||
|
||||
// Disable LEDs
|
||||
black_set_led(LED_RED, false);
|
||||
|
@ -236,8 +236,8 @@ const board board_black = {
|
|||
.board_type = "Black",
|
||||
.harness_config = &black_harness_config,
|
||||
.init = black_init,
|
||||
.enable_can_transciever = black_enable_can_transciever,
|
||||
.enable_can_transcievers = black_enable_can_transcievers,
|
||||
.enable_can_transceiver = black_enable_can_transceiver,
|
||||
.enable_can_transceivers = black_enable_can_transceivers,
|
||||
.set_led = black_set_led,
|
||||
.set_usb_power_mode = black_set_usb_power_mode,
|
||||
.set_gps_mode = black_set_gps_mode,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Dos + Harness //
|
||||
// ///////////// //
|
||||
|
||||
void dos_enable_can_transciever(uint8_t transciever, bool enabled) {
|
||||
switch (transciever){
|
||||
void dos_enable_can_transceiver(uint8_t transceiver, bool enabled) {
|
||||
switch (transceiver){
|
||||
case 1U:
|
||||
set_gpio_output(GPIOC, 1, !enabled);
|
||||
break;
|
||||
|
@ -17,18 +17,18 @@ void dos_enable_can_transciever(uint8_t transciever, bool enabled) {
|
|||
set_gpio_output(GPIOB, 10, !enabled);
|
||||
break;
|
||||
default:
|
||||
puts("Invalid CAN transciever ("); puth(transciever); puts("): enabling failed\n");
|
||||
puts("Invalid CAN transceiver ("); puth(transceiver); puts("): enabling failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dos_enable_can_transcievers(bool enabled) {
|
||||
void dos_enable_can_transceivers(bool enabled) {
|
||||
for(uint8_t i=1U; i<=4U; i++){
|
||||
// Leave main CAN always on for CAN-based ignition detection
|
||||
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
|
||||
uno_enable_can_transciever(i, true);
|
||||
uno_enable_can_transceiver(i, true);
|
||||
} else {
|
||||
uno_enable_can_transciever(i, enabled);
|
||||
uno_enable_can_transceiver(i, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ void dos_init(void) {
|
|||
// Initialize RTC
|
||||
rtc_init();
|
||||
|
||||
// Enable CAN transcievers
|
||||
dos_enable_can_transcievers(true);
|
||||
// Enable CAN transceivers
|
||||
dos_enable_can_transceivers(true);
|
||||
|
||||
// Disable LEDs
|
||||
dos_set_led(LED_RED, false);
|
||||
|
@ -213,8 +213,8 @@ const board board_dos = {
|
|||
.board_type = "Dos",
|
||||
.harness_config = &dos_harness_config,
|
||||
.init = dos_init,
|
||||
.enable_can_transciever = dos_enable_can_transciever,
|
||||
.enable_can_transcievers = dos_enable_can_transcievers,
|
||||
.enable_can_transceiver = dos_enable_can_transceiver,
|
||||
.enable_can_transceivers = dos_enable_can_transceivers,
|
||||
.set_led = dos_set_led,
|
||||
.set_usb_power_mode = dos_set_usb_power_mode,
|
||||
.set_gps_mode = dos_set_gps_mode,
|
||||
|
|
|
@ -37,8 +37,8 @@ const board board_grey = {
|
|||
.board_type = "Grey",
|
||||
.harness_config = &white_harness_config,
|
||||
.init = grey_init,
|
||||
.enable_can_transciever = white_enable_can_transciever,
|
||||
.enable_can_transcievers = white_enable_can_transcievers,
|
||||
.enable_can_transceiver = white_enable_can_transceiver,
|
||||
.enable_can_transceivers = white_enable_can_transceivers,
|
||||
.set_led = white_set_led,
|
||||
.set_usb_power_mode = white_set_usb_power_mode,
|
||||
.set_gps_mode = grey_set_gps_mode,
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
// Pedal //
|
||||
// ///// //
|
||||
|
||||
void pedal_enable_can_transciever(uint8_t transciever, bool enabled) {
|
||||
switch (transciever){
|
||||
void pedal_enable_can_transceiver(uint8_t transceiver, bool enabled) {
|
||||
switch (transceiver){
|
||||
case 1:
|
||||
set_gpio_output(GPIOB, 3, !enabled);
|
||||
break;
|
||||
default:
|
||||
puts("Invalid CAN transciever ("); puth(transciever); puts("): enabling failed\n");
|
||||
puts("Invalid CAN transceiver ("); puth(transceiver); puts("): enabling failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void pedal_enable_can_transcievers(bool enabled) {
|
||||
pedal_enable_can_transciever(1U, enabled);
|
||||
void pedal_enable_can_transceivers(bool enabled) {
|
||||
pedal_enable_can_transceiver(1U, enabled);
|
||||
}
|
||||
|
||||
void pedal_set_led(uint8_t color, bool enabled) {
|
||||
|
@ -94,8 +94,8 @@ void pedal_init(void) {
|
|||
// DAC outputs on A4 and A5
|
||||
// apparently they don't need GPIO setup
|
||||
|
||||
// Enable transciever
|
||||
pedal_enable_can_transcievers(true);
|
||||
// Enable transceiver
|
||||
pedal_enable_can_transceivers(true);
|
||||
|
||||
// Disable LEDs
|
||||
pedal_set_led(LED_RED, false);
|
||||
|
@ -110,8 +110,8 @@ const board board_pedal = {
|
|||
.board_type = "Pedal",
|
||||
.harness_config = &pedal_harness_config,
|
||||
.init = pedal_init,
|
||||
.enable_can_transciever = pedal_enable_can_transciever,
|
||||
.enable_can_transcievers = pedal_enable_can_transcievers,
|
||||
.enable_can_transceiver = pedal_enable_can_transceiver,
|
||||
.enable_can_transceivers = pedal_enable_can_transceivers,
|
||||
.set_led = pedal_set_led,
|
||||
.set_usb_power_mode = pedal_set_usb_power_mode,
|
||||
.set_gps_mode = pedal_set_gps_mode,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#define BOOTKICK_TIME 3U
|
||||
uint8_t bootkick_timer = 0U;
|
||||
|
||||
void uno_enable_can_transciever(uint8_t transciever, bool enabled) {
|
||||
switch (transciever){
|
||||
void uno_enable_can_transceiver(uint8_t transceiver, bool enabled) {
|
||||
switch (transceiver){
|
||||
case 1U:
|
||||
set_gpio_output(GPIOC, 1, !enabled);
|
||||
break;
|
||||
|
@ -19,18 +19,18 @@ void uno_enable_can_transciever(uint8_t transciever, bool enabled) {
|
|||
set_gpio_output(GPIOB, 10, !enabled);
|
||||
break;
|
||||
default:
|
||||
puts("Invalid CAN transciever ("); puth(transciever); puts("): enabling failed\n");
|
||||
puts("Invalid CAN transceiver ("); puth(transceiver); puts("): enabling failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void uno_enable_can_transcievers(bool enabled) {
|
||||
void uno_enable_can_transceivers(bool enabled) {
|
||||
for(uint8_t i=1U; i<=4U; i++){
|
||||
// Leave main CAN always on for CAN-based ignition detection
|
||||
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
|
||||
uno_enable_can_transciever(i, true);
|
||||
uno_enable_can_transceiver(i, true);
|
||||
} else {
|
||||
uno_enable_can_transciever(i, enabled);
|
||||
uno_enable_can_transceiver(i, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,8 +231,8 @@ void uno_init(void) {
|
|||
// Initialize RTC
|
||||
rtc_init();
|
||||
|
||||
// Enable CAN transcievers
|
||||
uno_enable_can_transcievers(true);
|
||||
// Enable CAN transceivers
|
||||
uno_enable_can_transceivers(true);
|
||||
|
||||
// Disable LEDs
|
||||
uno_set_led(LED_RED, false);
|
||||
|
@ -279,8 +279,8 @@ const board board_uno = {
|
|||
.board_type = "Uno",
|
||||
.harness_config = &uno_harness_config,
|
||||
.init = uno_init,
|
||||
.enable_can_transciever = uno_enable_can_transciever,
|
||||
.enable_can_transcievers = uno_enable_can_transcievers,
|
||||
.enable_can_transceiver = uno_enable_can_transceiver,
|
||||
.enable_can_transceivers = uno_enable_can_transceivers,
|
||||
.set_led = uno_set_led,
|
||||
.set_usb_power_mode = uno_set_usb_power_mode,
|
||||
.set_gps_mode = uno_set_gps_mode,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// White Panda //
|
||||
// /////////// //
|
||||
|
||||
void white_enable_can_transciever(uint8_t transciever, bool enabled) {
|
||||
switch (transciever){
|
||||
void white_enable_can_transceiver(uint8_t transceiver, bool enabled) {
|
||||
switch (transceiver){
|
||||
case 1U:
|
||||
set_gpio_output(GPIOC, 1, !enabled);
|
||||
break;
|
||||
|
@ -14,15 +14,15 @@ void white_enable_can_transciever(uint8_t transciever, bool enabled) {
|
|||
set_gpio_output(GPIOA, 0, !enabled);
|
||||
break;
|
||||
default:
|
||||
puts("Invalid CAN transciever ("); puth(transciever); puts("): enabling failed\n");
|
||||
puts("Invalid CAN transceiver ("); puth(transceiver); puts("): enabling failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void white_enable_can_transcievers(bool enabled) {
|
||||
uint8_t t1 = enabled ? 1U : 2U; // leave transciever 1 enabled to detect CAN ignition
|
||||
void white_enable_can_transceivers(bool enabled) {
|
||||
uint8_t t1 = enabled ? 1U : 2U; // leave transceiver 1 enabled to detect CAN ignition
|
||||
for(uint8_t i=t1; i<=3U; i++) {
|
||||
white_enable_can_transciever(i, enabled);
|
||||
white_enable_can_transceiver(i, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,8 +299,8 @@ void white_grey_common_init(void) {
|
|||
set_gpio_alternate(GPIOC, 11, GPIO_AF7_USART3);
|
||||
set_gpio_pullup(GPIOC, 11, PULL_UP);
|
||||
|
||||
// Enable CAN transcievers
|
||||
white_enable_can_transcievers(true);
|
||||
// Enable CAN transceivers
|
||||
white_enable_can_transceivers(true);
|
||||
|
||||
// Disable LEDs
|
||||
white_set_led(LED_RED, false);
|
||||
|
@ -336,8 +336,8 @@ const board board_white = {
|
|||
.board_type = "White",
|
||||
.harness_config = &white_harness_config,
|
||||
.init = white_init,
|
||||
.enable_can_transciever = white_enable_can_transciever,
|
||||
.enable_can_transcievers = white_enable_can_transcievers,
|
||||
.enable_can_transceiver = white_enable_can_transceiver,
|
||||
.enable_can_transceivers = white_enable_can_transceivers,
|
||||
.set_led = white_set_led,
|
||||
.set_usb_power_mode = white_set_usb_power_mode,
|
||||
.set_gps_mode = white_set_gps_mode,
|
||||
|
|
|
@ -837,7 +837,7 @@ int main(void) {
|
|||
set_safety_mode(SAFETY_SILENT, 0);
|
||||
|
||||
// enable CAN TXs
|
||||
current_board->enable_can_transcievers(true);
|
||||
current_board->enable_can_transceivers(true);
|
||||
|
||||
#ifndef EON
|
||||
spi_init();
|
||||
|
|
|
@ -28,7 +28,7 @@ void set_power_save_state(int state) {
|
|||
enable = true;
|
||||
}
|
||||
|
||||
current_board->enable_can_transcievers(enable);
|
||||
current_board->enable_can_transceivers(enable);
|
||||
|
||||
// Switch EPS/GPS
|
||||
if (enable) {
|
||||
|
|
|
@ -290,7 +290,7 @@ void soft_flasher_start(void) {
|
|||
// B8,B9: CAN 1
|
||||
set_gpio_alternate(GPIOB, 8, GPIO_AF9_CAN1);
|
||||
set_gpio_alternate(GPIOB, 9, GPIO_AF9_CAN1);
|
||||
current_board->enable_can_transciever(1, true);
|
||||
current_board->enable_can_transceiver(1, true);
|
||||
|
||||
// init can
|
||||
llcan_set_speed(CAN1, 5000, false, false);
|
||||
|
|
|
@ -461,7 +461,7 @@ class Panda(object):
|
|||
self._handle.controlWrite(Panda.REQUEST_OUT, 0xe5, int(enable), 0, b'')
|
||||
|
||||
def set_can_enable(self, bus_num, enable):
|
||||
# sets the can transciever enable pin
|
||||
# sets the can transceiver enable pin
|
||||
self._handle.controlWrite(Panda.REQUEST_OUT, 0xf4, int(bus_num), int(enable), b'')
|
||||
|
||||
def set_can_speed_kbps(self, bus, speed):
|
||||
|
|
Loading…
Reference in New Issue