diff --git a/src/hw_config_rev4.c b/src/hw_config_rev4.c index 0cd55f7..ced5838 100644 --- a/src/hw_config_rev4.c +++ b/src/hw_config_rev4.c @@ -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; -} \ No newline at end of file +}