mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Rest of the HALs
This commit is contained in:
parent
12b402f994
commit
49fb79f35e
15 changed files with 286 additions and 267 deletions
|
@ -21,70 +21,54 @@ class StarkHal : public Esp32Hal {
|
|||
public:
|
||||
const char* name() { return "Stark CMR Module"; }
|
||||
duration BOOTUP_TIME() { return milliseconds(5000); }
|
||||
|
||||
// Not needed, GPIO 16 has hardware pullup for PSRAM compatibility
|
||||
virtual gpio_num_t PIN_5V_EN() { return GPIO_NUM_NC; }
|
||||
|
||||
// Not needed, GPIO 17 is used as SCK input of MCP2517
|
||||
virtual gpio_num_t RS485_EN_PIN() { return GPIO_NUM_NC; }
|
||||
virtual gpio_num_t RS485_TX_PIN() { return GPIO_NUM_22; }
|
||||
virtual gpio_num_t RS485_RX_PIN() { return GPIO_NUM_21; }
|
||||
// Not needed, GPIO 19 is available as extra GPIO via pin header
|
||||
virtual gpio_num_t RS485_SE_PIN() { return GPIO_NUM_NC; }
|
||||
|
||||
virtual gpio_num_t CAN_TX_PIN() { return GPIO_NUM_27; }
|
||||
virtual gpio_num_t CAN_RX_PIN() { return GPIO_NUM_26; }
|
||||
|
||||
// (No function, GPIO 23 used instead as MCP_SCK)
|
||||
virtual gpio_num_t CAN_SE_PIN() { return GPIO_NUM_NC; }
|
||||
|
||||
// CANFD_ADDON defines for MCP2517
|
||||
virtual gpio_num_t MCP2517_SCK() { return GPIO_NUM_17; }
|
||||
virtual gpio_num_t MCP2517_SDI() { return GPIO_NUM_5; }
|
||||
virtual gpio_num_t MCP2517_SDO() { return GPIO_NUM_34; }
|
||||
virtual gpio_num_t MCP2517_CS() { return GPIO_NUM_18; }
|
||||
virtual gpio_num_t MCP2517_INT() { return GPIO_NUM_35; }
|
||||
|
||||
// Contactor handling
|
||||
virtual gpio_num_t POSITIVE_CONTACTOR_PIN() { return GPIO_NUM_32; }
|
||||
virtual gpio_num_t NEGATIVE_CONTACTOR_PIN() { return GPIO_NUM_33; }
|
||||
virtual gpio_num_t PRECHARGE_PIN() { return GPIO_NUM_25; }
|
||||
virtual gpio_num_t BMS_POWER() { return GPIO_NUM_23; }
|
||||
virtual gpio_num_t SECOND_BATTERY_CONTACTORS_PIN() { return GPIO_NUM_19; }
|
||||
|
||||
// Automatic precharging
|
||||
virtual gpio_num_t HIA4V1_PIN() { return GPIO_NUM_19; }
|
||||
virtual gpio_num_t INVERTER_DISCONNECT_CONTACTOR_PIN() { return GPIO_NUM_25; }
|
||||
|
||||
// SMA CAN contactor pins
|
||||
virtual gpio_num_t INVERTER_CONTACTOR_ENABLE_PIN() { return GPIO_NUM_2; }
|
||||
|
||||
// LED
|
||||
virtual gpio_num_t LED_PIN() { return GPIO_NUM_4; }
|
||||
virtual uint8_t LED_MAX_BRIGHTNESS() { return 40; }
|
||||
|
||||
// Equipment stop pin
|
||||
virtual gpio_num_t EQUIPMENT_STOP_PIN() { return GPIO_NUM_2; }
|
||||
|
||||
// Battery wake up pins
|
||||
virtual gpio_num_t WUP_PIN1() { return GPIO_NUM_25; }
|
||||
virtual gpio_num_t WUP_PIN2() { return GPIO_NUM_32; }
|
||||
};
|
||||
|
||||
/*// RS485
|
||||
// #define PIN_5V_EN 16 // Not needed, GPIO 16 has hardware pullup for PSRAM compatibility
|
||||
// #define RS485_EN_PIN 17 // Not needed, GPIO 17 is used as SCK input of MCP2517
|
||||
#define RS485_TX_PIN 22
|
||||
#define RS485_RX_PIN 21
|
||||
// #define RS485_SE_PIN 19 // Not needed, GPIO 19 is available as extra GPIO via pin header
|
||||
|
||||
// CAN settings
|
||||
#define CAN_1_TYPE ESP32CAN
|
||||
|
||||
// CAN1 PIN mappings, do not change these unless you are adding on extra hardware to the PCB
|
||||
#define CAN_TX_PIN GPIO_NUM_27
|
||||
#define CAN_RX_PIN GPIO_NUM_26
|
||||
// #define CAN_SE_PIN 23 // (No function, GPIO 23 used instead as MCP_SCK)
|
||||
|
||||
// CANFD_ADDON defines
|
||||
#define MCP2517_SCK 17 // SCK input of MCP2517
|
||||
#define MCP2517_SDI 5 // SDI input of MCP2517
|
||||
#define MCP2517_SDO 34 // SDO output of MCP2517
|
||||
#define MCP2517_CS 18 // CS input of MCP2517
|
||||
#define MCP2517_INT 35 // INT output of MCP2517
|
||||
|
||||
// Contactor handling
|
||||
#define POSITIVE_CONTACTOR_PIN 32
|
||||
#define NEGATIVE_CONTACTOR_PIN 33
|
||||
#define PRECHARGE_PIN 25
|
||||
#define BMS_POWER 23
|
||||
#define SECOND_BATTERY_CONTACTORS_PIN 19 //Available as extra GPIO via pin header
|
||||
|
||||
// Automatic precharging
|
||||
#define HIA4V1_PIN 19 //Available as extra GPIO via pin header
|
||||
#define INVERTER_DISCONNECT_CONTACTOR_PIN 25
|
||||
|
||||
// SMA CAN contactor pins
|
||||
#define INVERTER_CONTACTOR_ENABLE_PIN 2
|
||||
|
||||
// LED
|
||||
#define LED_PIN 4
|
||||
#define LED_MAX_BRIGHTNESS 40
|
||||
|
||||
// Equipment stop pin
|
||||
#define EQUIPMENT_STOP_PIN 2
|
||||
|
||||
// BMW_I3_BATTERY wake up pin
|
||||
#define WUP_PIN1 GPIO_NUM_25 // Wake up pin for battery 1
|
||||
#define WUP_PIN2 GPIO_NUM_32 // Wake up pin for battery 2
|
||||
|
||||
// ----- Error checks below, don't change (can't be moved to separate file) -----
|
||||
#ifndef HW_CONFIGURED
|
||||
#define HW_CONFIGURED
|
||||
#else
|
||||
#error Multiple HW defined! Please select a single HW
|
||||
#endif // HW_CONFIGURED
|
||||
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN1)
|
||||
#error GPIO PIN 25 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN2)
|
||||
#error GPIO PIN 32 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#endif // BMW_I3_BATTERY
|
||||
*/
|
||||
|
||||
#endif // __HW_STARK_H__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue