Added COMM_SET_CAN_MODE and added support for HW75_300_R3

This commit is contained in:
Benjamin Vedder 2020-04-04 22:28:41 +02:00
parent 5ab7bc9ba6
commit 76fd7a3917
4 changed files with 41 additions and 3 deletions

View File

@ -989,6 +989,29 @@ void commands_process_packet(unsigned char *data, unsigned int len,
}
} break;
case COMM_SET_CAN_MODE: {
int32_t ind = 0;
bool store = data[ind++];
bool ack = data[ind++];
bool mode = data[ind++];
appconf = *app_get_configuration();
appconf.can_mode = mode;
if (store) {
conf_general_store_app_configuration(&appconf);
}
app_set_configuration(&appconf);
if (ack) {
ind = 0;
uint8_t send_buffer[50];
send_buffer[ind++] = packet_id;
reply_func(send_buffer, ind);
}
} break;
// Blocking commands. Only one of them runs at any given time, in their
// own thread. If other blocking commands come before the previous one has
// finished, they are discarded.

View File

@ -98,7 +98,8 @@
//#define HW75_300_VEDDER_FIRST_PCB
// Second revision with separate UART for NRF51
#define HW75_300_REV_2
//#define HW75_300_REV_2
#define HW75_300_REV_3
//#define HW_SOURCE "hw_75_300.c"
//#define HW_HEADER "hw_75_300.h"

View File

@ -756,7 +756,11 @@ typedef enum {
COMM_WRITE_NEW_APP_DATA_ALL_CAN_LZO,
COMM_BM_WRITE_FLASH_LZO,
COMM_SET_CURRENT_REL,
COMM_CAN_FWD_FRAME
COMM_CAN_FWD_FRAME,
COMM_SET_BATTERY_CUT,
COMM_SET_BLE_NAME,
COMM_SET_BLE_PIN,
COMM_SET_CAN_MODE
} COMM_PACKET_ID;
// CAN commands

View File

@ -20,7 +20,9 @@
#ifndef HW_75_300_H_
#define HW_75_300_H_
#ifdef HW75_300_REV_2
#ifdef HW75_300_REV_3
#define HW_NAME "75_300_R3"
#elif defined(HW75_300_REV_2)
#define HW_NAME "75_300_R2"
#else
#define HW_NAME "75_300"
@ -197,6 +199,14 @@
#define HW_UART_P_RX_PIN 11
#endif
#ifdef HW75_300_REV_3
// NRF SWD
#define NRF5x_SWDIO_GPIO GPIOA
#define NRF5x_SWDIO_PIN 15
#define NRF5x_SWCLK_GPIO GPIOB
#define NRF5x_SWCLK_PIN 3
#endif
// ICU Peripheral for servo decoding
#define HW_USE_SERVO_TIM4
#define HW_ICU_TIMER TIM4