Skip to content

Commit

Permalink
Add ARK 4IN1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKlimaj committed Oct 31, 2024
1 parent 6ea66ee commit 998050c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Inc/targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,27 @@
#define TARGET_STALL_PROTECTION_INTERVAL 9000
#endif

#ifdef ARK_4IN1_F051
#define FILE_NAME "ARK_4IN1_F051"
#define FIRMWARE_NAME "ARK 4IN1"
#define DEAD_TIME 45
#define HARDWARE_GROUP_F0_B
#define MILLIVOLT_PER_AMP 10
#define CURRENT_OFFSET 25 // millivolts
#define TARGET_VOLTAGE_DIVIDER 210
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_6
#define VOLTAGE_ADC_PIN LL_GPIO_PIN_6
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_3
#define CURRENT_ADC_PIN LL_GPIO_PIN_3
#define USE_SERIAL_TELEMETRY
#define USE_DRV8328_NSLEEP
#define NSLEEP_PORT GPIOA
#define NSLEEP_PIN LL_GPIO_PIN_15
#define USE_DRV8328_NFAULT
#define NFAULT_PORT GPIOB
#define NFAULT_PIN LL_GPIO_PIN_5
#endif

#ifdef RHINO80A_F051
#define FILE_NAME "RHINO80A_F051"
#define FIRMWARE_NAME "RHINO80A_F0 "
Expand Down
37 changes: 37 additions & 0 deletions Mcu/f051/Src/peripherals.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,31 @@ void initLed()
}
#endif

#ifdef USE_DRV8328_NSLEEP // Disable gate driver when disarmed
void initnSleep()
{
LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 };
GPIO_InitStruct.Pin = NSLEEP_PIN;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(NSLEEP_PORT, &GPIO_InitStruct);
NSLEEP_PORT->BSRR = NSLEEP_PIN;
}
#endif

#ifdef USE_DRV8328_NFAULT
void initnFault()
{
LL_GPIO_InitTypeDef GPIO_InitStruct = { 0 };
GPIO_InitStruct.Pin = NFAULT_PIN;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
LL_GPIO_Init(NFAULT_PORT, &GPIO_InitStruct);
}
#endif

void reloadWatchDogCounter()
{
LL_IWDG_ReloadCounter(IWDG);
Expand Down Expand Up @@ -585,6 +610,18 @@ void enableCorePeripherals()
initLed();
#endif

#ifdef USE_DRV8328_NSLEEP
initnSleep();
#endif

#ifdef USE_DRV8328_NFAULT
initnFault();
#endif

#ifdef USE_DRVOFF
initDrvoff();
#endif

#ifndef BRUSHED_MODE
LL_TIM_EnableCounter(COM_TIMER); // commutation_timer priority 0
LL_TIM_GenerateEvent_UPDATE(COM_TIMER);
Expand Down

0 comments on commit 998050c

Please sign in to comment.