Skip to content

Commit de6aa65

Browse files
author
lennard.boediger
committed
detect and support GD32(hw_rev5)
1 parent c6a3e62 commit de6aa65

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/hw_config_rev4.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,16 @@ HardwareDefinitionPtr detect_hardware(void) {
203203
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
204204
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
205205
// GPIO_Init (GPIOB, &GPIO_InitStructure);
206-
206+
#define CPU_MODEL_GD32 (0x13030410)
207+
207208
const uint8_t state = GPIO_ReadInputDataBit (GPIOB, GPIO_Pin_7);
208-
if (state == 0) {
209+
if (*((volatile uint32_t *)0xE0042000) == CPU_MODEL_GD32) {
210+
g_current_hardware = &HW3;
211+
} else if(state == 0){
209212
g_current_hardware = &HW4;
210-
} else{
213+
}
214+
else{
211215
g_current_hardware = &HW3;
212216
}
213217
return g_current_hardware;
214-
}
218+
}

0 commit comments

Comments
 (0)