suikan4github / murasaki

STM32 HAL class library
MIT License
18 stars 3 forks source link

Build fail if EXTI_LINE_## is equal to the ##th power of 2 #105

Closed suikan4github closed 4 years ago

suikan4github commented 4 years ago

Describe the bug The CubeIDE creates the GPIO line identifier as the power of 2. That means, for example, if the FOO_PIN is assigned to pin 3, the value of the FOO_PIN is 8. On the other hand, the EXTLINE## is sometimes not the power of 2.

To accept both the FOO_PIN defined by CubeIDE and EXTLINE### constant by HAL, murasaki::exti accepts both types of the constant as a parameter of the constructor.

This is useful. But when the EXTILINE### is the power of 2, compile fails.

To Reproduce Build with STM32F722.

Expected behavior Let's change the software as like this :

#if ( EXTI_LINE_0 != 1)
        case 1:  // fall through to next line
#endif
        case EXTI_LINE_0:
            stat = HAL_EXTI_GetHandle(&hexti_, EXTI_LINE_0);
            line_ = 1;
            break;

So we can avoid the compile error.

suikan4github commented 4 years ago

Merged to develop. Ready to release.