Skip to content

Commit e45ef5e

Browse files
authored
Merge branch 'main' into main
2 parents cf282cc + c2abe0e commit e45ef5e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

Inc/targets.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,27 @@
11781178
#define TARGET_STALL_PROTECTION_INTERVAL 9000
11791179
#endif
11801180

1181+
#ifdef ARK_4IN1_F051
1182+
#define FILE_NAME "ARK_4IN1_F051"
1183+
#define FIRMWARE_NAME "ARK 4IN1"
1184+
#define DEAD_TIME 45
1185+
#define HARDWARE_GROUP_F0_B
1186+
#define MILLIVOLT_PER_AMP 10
1187+
#define CURRENT_OFFSET 25 // millivolts
1188+
#define TARGET_VOLTAGE_DIVIDER 210
1189+
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_6
1190+
#define VOLTAGE_ADC_PIN LL_GPIO_PIN_6
1191+
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_3
1192+
#define CURRENT_ADC_PIN LL_GPIO_PIN_3
1193+
#define USE_SERIAL_TELEMETRY
1194+
#define USE_DRV8328_NSLEEP
1195+
#define NSLEEP_PORT GPIOA
1196+
#define NSLEEP_PIN LL_GPIO_PIN_15
1197+
#define USE_DRV8328_NFAULT
1198+
#define NFAULT_PORT GPIOB
1199+
#define NFAULT_PIN LL_GPIO_PIN_5
1200+
#endif
1201+
11811202
#ifdef RHINO80A_F051
11821203
#define FILE_NAME "RHINO80A_F051"
11831204
#define FIRMWARE_NAME "RHINO80A_F0 "

Mcu/f051/Src/peripherals.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,31 @@ void initLed()
495495
}
496496
#endif
497497

498+
#ifdef USE_DRV8328_NSLEEP // Disable gate driver when disarmed
499+
void initnSleep()
500+
{
501+
LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 };
502+
GPIO_InitStruct.Pin = NSLEEP_PIN;
503+
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
504+
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
505+
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
506+
LL_GPIO_Init(NSLEEP_PORT, &GPIO_InitStruct);
507+
NSLEEP_PORT->BSRR = NSLEEP_PIN;
508+
}
509+
#endif
510+
511+
#ifdef USE_DRV8328_NFAULT
512+
void initnFault()
513+
{
514+
LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 };
515+
GPIO_InitStruct.Pin = NFAULT_PIN;
516+
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
517+
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
518+
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
519+
LL_GPIO_Init(NFAULT_PORT, &GPIO_InitStruct);
520+
}
521+
#endif
522+
498523
void reloadWatchDogCounter()
499524
{
500525
LL_IWDG_ReloadCounter(IWDG);
@@ -585,6 +610,18 @@ void enableCorePeripherals()
585610
initLed();
586611
#endif
587612

613+
#ifdef USE_DRV8328_NSLEEP
614+
initnSleep();
615+
#endif
616+
617+
#ifdef USE_DRV8328_NFAULT
618+
initnFault();
619+
#endif
620+
621+
#ifdef USE_DRVOFF
622+
initDrvoff();
623+
#endif
624+
588625
#ifndef BRUSHED_MODE
589626
LL_TIM_EnableCounter(COM_TIMER); // commutation_timer priority 0
590627
LL_TIM_GenerateEvent_UPDATE(COM_TIMER);

0 commit comments

Comments
 (0)