Skip to content

Commit

Permalink
detect and support GD32(hw_rev5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lennard.boediger committed May 23, 2022
1 parent c6a3e62 commit de6aa65
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/hw_config_rev4.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,16 @@ HardwareDefinitionPtr detect_hardware(void) {
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
// GPIO_Init (GPIOB, &GPIO_InitStructure);

#define CPU_MODEL_GD32 (0x13030410)

const uint8_t state = GPIO_ReadInputDataBit (GPIOB, GPIO_Pin_7);
if (state == 0) {
if (*((volatile uint32_t *)0xE0042000) == CPU_MODEL_GD32) {
g_current_hardware = &HW3;
} else if(state == 0){
g_current_hardware = &HW4;
} else{
}
else{
g_current_hardware = &HW3;
}
return g_current_hardware;
}
}

0 comments on commit de6aa65

Please sign in to comment.