8000 chore(U0): add I2C support · stm32duino/Arduino_Core_STM32@8a39aef · GitHub
[go: up one dir, main page]

Skip to content
.hEHvLI{min-width:0;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .bmcJak{min-width:0;}/*!sc*/ .fyKNMY[data-size="medium"]{color:var(--fgColor-default,var(--color-fg-default,#1F2328));}/*!sc*/ .gUkoLg{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}/*!sc*/ .dpBUfI{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ @media screen and (min-width:544px){.dpBUfI{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}}/*!sc*/ @media screen and (min-width:768px){.dpBUfI{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}}/*!sc*/ @media screen and (min-width:1012px){.dpBUfI{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}}/*!sc*/ .hKWjvQ{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .cvdqJW{width:20px;height:20px;margin-right:8px;margin-top:-1px;margin-left:1px;}/*!sc*/ .dkaFxu{font-weight:600;white-space:nowrap;color:var(--fgColor-default,var(--color-fg-default,#1F2328));}/*!sc*/ .dkaFxu:hover{color:var(--fgColor-default,var(--color-fg-default,#1F2328));-webkit-text-decoration:underline;text-decoration:underline;}/*!sc*/ .irPhWZ{width:60px;}/*!sc*/ .dNbsEP{width:62px;}/*!sc*/ .kHfwUD{width:60px;height:22px;}/*!sc*/ .bHLmSv{position:absolute;inset:0 -2px;cursor:col-resize;background-color:transparent;-webkit-transition-delay:0.1s;transition-delay:0.1s;}/*!sc*/ .bHLmSv:hover{background-color:var(--bgColor-neutral-muted,var(--color-neutral-muted,rgba(175,184,193,0.2)));}/*!sc*/ .hqtbbn{bottom:0 !important;-webkit-clip:rect(1px,1px,1px,1px);clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:84px;position:absolute;width:320px;}/*!sc*/ data-styled.g1[id="Box-sc-g0xbh4-0"]{content:"hEHvLI,bmcJak,fyKNMY,gUkoLg,dpBUfI,hKWjvQ,cvdqJW,dkaFxu,irPhWZ,dNbsEP,kHfwUD,bHLmSv,hqtbbn,"}/*!sc*/ .brGdpi{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;-webkit-clip:rect(0,0,0,0);clip:rect(0,0,0,0);white-space:nowrap;border-width:0;}/*!sc*/ data-styled.g3[id="_VisuallyHidden__VisuallyHidden-sc-11jhm7a-0"]{content:"brGdpi,"}/*!sc*/ .jjwhNb{position:relative;display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ .jjwhNb::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;-webkit-text-decoration:none;text-decoration:none;text-shadow:none;text-transform:none;-webkit-letter-spacing:normal;-moz-letter-spacing:normal;-ms-letter-spacing:normal;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;opacity:0;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .jjwhNb:hover::after,.jjwhNb:active::after,.jjwhNb:focus::after,.jjwhNb:focus-within::after{display:inline-block;-webkit-text-decoration:none;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .jjwhNb.tooltipped-no-delay:hover::after,.jjwhNb.tooltipped-no-delay:active::after,.jjwhNb.tooltipped-no-delay:focus::after,.jjwhNb.tooltipped-no-delay:focus-within::after{-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .jjwhNb.tooltipped-multiline:hover::after,.jjwhNb.tooltipped-multiline:active::after,.jjwhNb.tooltipped-multiline:focus::after,.jjwhNb.tooltipped-multiline:focus-within::after{display:table-cell;}/*!sc*/ .jjwhNb.tooltipped-s::after,.jjwhNb.tooltipped-se::after,.jjwhNb.tooltipped-sw::after{top:100%;right:50%;margin-top:6px;}/*!sc*/ .jjwhNb.tooltipped-se::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .jjwhNb.tooltipped-sw::after{margin-right:-16px;}/*!sc*/ .jjwhNb.tooltipped-n::after,.jjwhNb.tooltipped-ne::after,.jjwhNb.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:6px;}/*!sc*/ .jjwhNb.tooltipped-ne::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .jjwhNb.tooltipped-nw::after{margin-right:-16px;}/*!sc*/ .jjwhNb.tooltipped-s::after,.jjwhNb.tooltipped-n::after{-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}/*!sc*/ .jjwhNb.tooltipped-w::after{right:100%;bottom:50%;margin-right:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .jjwhNb.tooltipped-e::after{bottom:50%;left:100%;margin-left:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .jjwhNb.tooltipped-multiline::after{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}/*!sc*/ .jjwhNb.tooltipped-multiline.tooltipped-s::after,.jjwhNb.tooltipped-multiline.tooltipped-n::after{right:auto;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);}/*!sc*/ .jjwhNb.tooltipped-multiline.tooltipped-w::after,.jjwhNb.tooltipped-multiline.tooltipped-e::after{right:100%;}/*!sc*/ .jjwhNb.tooltipped-align-right-2::after{right:0;margin-right:0;}/*!sc*/ .jjwhNb.tooltipped-align-left-2::after{left:0;margin-left:0;}/*!sc*/ data-styled.g6[id="Tooltip__TooltipBase-sc-17tf59c-0"]{content:"jjwhNb,"}/*!sc*/ .irithh{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:60px;}/*!sc*/ .irithh::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ .ihfxfT{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:62px;}/*!sc*/ .ihfxfT::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ .kRBfod{position:relative;overflow:hidden;-webkit-mask-image:radial-gradient(white,black);mask-image:radial-gradient(white,black);background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5)));border-radius:3px;display:block;height:1.2em;width:60px;height:22px;}/*!sc*/ .kRBfod::after{-webkit-animation:crVFvv 1.5s infinite linear;animation:crVFvv 1.5s infinite linear;background:linear-gradient(90deg,transparent,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))),transparent);content:'';position:absolute;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);bottom:0;left:0;right:0;top:0;}/*!sc*/ data-styled.g27[id="LoadingSkeleton-sc-695d630a-0"]{content:"irithh,ihfxfT,kRBfod,"}/*!sc*/ @-webkit-keyframes crVFvv{0%{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}50%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}/*!sc*/ @keyframes crVFvv{0%{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}50%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}/*!sc*/ data-styled.g53[id="sc-keyframes-crVFvv"]{content:"crVFvv,"}/*!sc*/

Commit 8a39aef

Browse files
committed
chore(U0): add I2C support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 6596750 commit 8a39aef

File tree

2 files changed

+60
-28
lines changed

2 files changed

+60
-28
lines changed

libraries/Wire/src/utility/twi.c

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,10 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
686686
__HAL_RCC_I2C1_RELEASE_RESET();
687687

688688
obj->irq = I2C1_EV_IRQn;
689-
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
689+
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && \
690+
!defined(STM32L0xx) && !defined(STM32U0xx)
690691
obj->irqER = I2C1_ER_IRQn;
691-
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */
692+
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
692693
i2c_handles[I2C1_INDEX] = handle;
693694
}
694695
#endif // I2C1_BASE
@@ -699,9 +700,10 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
699700
__HAL_RCC_I2C2_FORCE_RESET();
700701
__HAL_RCC_I2C2_RELEASE_RESET();
701702
obj->irq = I2C2_EV_IRQn;
702-
#if !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
703+
#if !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx) && \
704+
!defined(STM32U0xx)
703705
obj->irqER = I2C2_ER_IRQn;
704-
#endif /* !STM32F0xx && !STM32G0xx && !STM32L0xx */
706+
#endif /* !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
705707
i2c_handles[I2C2_INDEX] = handle;
706708
}
707709
#endif // I2C2_BASE
@@ -712,9 +714,9 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
712714
__HAL_RCC_I2C3_FORCE_RESET();
713715
__HAL_RCC_I2C3_RELEASE_RESET();
714716
obj->irq = I2C3_EV_IRQn;
715-
#if !defined(STM32G0xx) && !defined(STM32L0xx)
717+
#if !defined(STM32G0xx) && !defined(STM32L0xx) && !defined(STM32U0xx)
716718
obj->irqER = I2C3_ER_IRQn;
717-
#endif /* !STM32G0xx && !STM32L0xx */
719+
#endif /* !STM32G0xx && !STM32L0xx && !STM32U0xx*/
718720
i2c_handles[I2C3_INDEX] = handle;
719721
}
720722
#endif // I2C3_BASE
@@ -725,7 +727,9 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
725727
__HAL_RCC_I2C4_FORCE_RESET();
726728
__HAL_RCC_I2C4_RELEASE_RESET();
727729
obj->irq = I2C4_EV_IRQn;
730+
#if !defined(STM32U0xx)
728731
obj->irqER = I2C4_ER_IRQn;
732+
#endif /* !STM32U0xx */
729733
i2c_handles[I2C4_INDEX] = handle;
730734
}
731735
#endif // I2C4_BASE
@@ -780,10 +784,11 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
780784

781785
HAL_NVIC_SetPriority(obj->irq, I2C_IRQ_PRIO, I2C_IRQ_SUBPRIO);
782786
HAL_NVIC_EnableIRQ(obj->irq);
783-
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
787+
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && \
788+
!defined(STM32L0xx) && !defined(STM32U0xx)
784789
HAL_NVIC_SetPriority(obj->irqER, I2C_IRQ_PRIO, I2C_IRQ_SUBPRIO);
785790
HAL_NVIC_EnableIRQ(obj->irqER);
786-
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */
791+
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
787792

788793
/* Init the I2C */
789794
if (HAL_I2C_Init(handle) != HAL_OK) {
@@ -807,9 +812,10 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
807812
void i2c_deinit(i2c_t *obj)
808813
{
809814
HAL_NVIC_DisableIRQ(obj->irq);
810-
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
815+
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && \
816+
!defined(STM32L0xx) && !defined(STM32U0xx)
811817
HAL_NVIC_DisableIRQ(obj->irqER);
812-
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */
818+
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
813819
HAL_I2C_DeInit(&(obj->handle));
814820
/* Reset I2C GPIO pins as INPUT_ANALOG */
815821
pin_function(obj->scl, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
@@ -1232,12 +1238,14 @@ void I2C1_EV_IRQHandler(void)
12321238
{
12331239
I2C_HandleTypeDef *handle = i2c_handles[I2C1_INDEX];
12341240
HAL_I2C_EV_IRQHandler(handle);
1235-
#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32L0xx)
1241+
#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32G0xx) || \
1242+
defined(STM32L0xx) || defined(STM32U0xx)
12361243
HAL_I2C_ER_IRQHandler(handle);
1237-
#endif /* STM32C0xx || STM32F0xx || STM32G0xx || STM32L0xx */
1244+
#endif /* STM32C0xx || STM32F0xx || STM32G0xx || STM32L0xx || STM32U0xx*/
12381245
}
12391246

1240-
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
1247+
#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx) && \
1248+
!defined(STM32L0xx) && !defined(STM32U0xx)
12411249
/**
12421250
* @brief This function handles I2C1 interrupt.
12431251
* @param None
@@ -1248,7 +1256,7 @@ void I2C1_ER_IRQHandler(void)
12481256
I2C_HandleTypeDef *handle = i2c_handles[I2C1_INDEX];
12491257
HAL_I2C_ER_IRQHandler(handle);
12501258
}
1251-
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx */
1259+
#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
12521260
#endif // I2C1_BASE
12531261

12541262
#if defined(I2C2_BASE)
@@ -1259,7 +1267,7 @@ void I2C1_ER_IRQHandler(void)
12591267
*/
12601268
void I2C2_EV_IRQHandler(void)
12611269
{
1262-
#if defined(I2C3_BASE) && defined(STM32G0xx)
1270+
#if defined(I2C3_BASE) && (defined(STM32G0xx) || defined(STM32U0xx))
12631271
/* I2C2_3_IRQHandler */
12641272
I2C_HandleTypeDef *handle2 = i2c_handles[I2C2_INDEX];
12651273
I2C_HandleTypeDef *handle3 = i2c_handles[I2C3_INDEX];
@@ -1271,16 +1279,26 @@ void I2C2_EV_IRQHandler(void)
12711279
HAL_I2C_EV_IRQHandler(handle3);
12721280
HAL_I2C_ER_IRQHandler(handle3);
12731281
}
1282+
#if defined(I2C4_BASE)
1283+
/* I2C2_3_4_IRQHandler */
1284+
I2C_HandleTypeDef *handle4 = i2c_handles[I2C4_INDEX];
1285+
if (handle4) {
1286+
HAL_I2C_EV_IRQHandler(handle4);
1287+
HAL_I2C_ER_IRQHandler(handle4);
1288+
}
1289+
#endif /* I2C4_BASE */
12741290
#else
12751291
I2C_HandleTypeDef *handle = i2c_handles[I2C2_INDEX];
12761292
HAL_I2C_EV_IRQHandler(handle);
1277-
#if defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32L0xx)
1293+
#if defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32L0xx) || \
1294+
defined(STM32U0xx)
12781295
HAL_I2C_ER_IRQHandler(handle);
1279-
#endif /* STM32F0xx || STM32G0xx || STM32L0xx */
1296+
#endif /* STM32F0xx || STM32G0xx || STM32L0xx || STM32U0xx*/
12801297
#endif
12811298
}
12821299

1283-
#if !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx)
1300+
#if !defined(STM32F0xx) && !defined(STM32G0xx) && !defined(STM32L0xx) && \
1301+
!defined(STM32U0xx)
12841302
/**
12851303
* @brief This function handles I2C2 interrupt.
12861304
* @param None
@@ -1291,10 +1309,10 @@ void I2C2_ER_IRQHandler(void)
12911309
I2C_HandleTypeDef *handle = i2c_handles[I2C2_INDEX];
12921310
HAL_I2C_ER_IRQHandler(handle);
12931311
}
1294-
#endif /* !STM32F0xx && !STM32G0xx && !STM32L0xx */
1312+
#endif /* !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
12951313
#endif // I2C2_BASE
12961314

1297-
#if defined(I2C3_BASE) && !defined(STM32G0xx)
1315+
#if defined(I2C3_BASE) && !defined(STM32G0xx) && !defined(STM32U0xx)
12981316
/**
12991317
* @brief This function handles I2C3 interrupt.
13001318
* @param None
@@ -1321,9 +1339,9 @@ void I2C3_ER_IRQHandler(void)
13211339
HAL_I2C_ER_IRQHandler(handle);
13221340
}
13231341
#endif /* !STM32L0xx */
1324-
#endif /* I2C3_BASE && ! STM32G0xx */
1342+
#endif /* I2C3_BASE && ! STM32G0xx && !STM32U0xx */
13251343

1326-
#if defined(I2C4_BASE)
1344+
#if defined(I2C4_BASE) && !defined(STM32U0xx)
13271345
/**
13281346
* @brief This function handles I2C4 interrupt.
13291347
* @param None
@@ -1346,7 +1364,7 @@ void I2C4_ER_IRQHandler(void)
13461364
I2C_HandleTypeDef *handle = i2c_handles[I2C4_INDEX];
13471365
HAL_I2C_ER_IRQHandler(handle);
13481366
}
1349-
#endif // I2C4_BASE
1367+
#endif // I2C4_BASE && !STM32U0xx
13501368

13511369
#if defined(I2C5_BASE)
13521370
/**

libraries/Wire/src/utility/twi.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,49 @@ extern "C" {
6767
#error I2C buffer size cannot exceed 255
6868
#endif
6969

70-
/* Redefinition of IRQ for C0/F0/G0/L0 families */
71-
#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32L0xx)
70+
/* Redefinition of IRQ for C0/F0/G0/L0/U0 families */
71+
#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32G0xx) ||\
72+
defined(STM32L0xx) || defined(STM32U0xx)
7273
#if defined(I2C1_BASE)
7374
#define I2C1_EV_IRQn I2C1_IRQn
7475
#define I2C1_EV_IRQHandler I2C1_IRQHandler
7576
#endif // defined(I2C1_BASE)
7677
#if defined(I2C2_BASE)
77-
#if defined(STM32G0xx) && defined(I2C3_BASE)
78+
#if (defined(STM32G0xx) || defined(STM32U0xx)) && defined(I2C3_BASE)
79+
#if defined(I2C4_BASE)
80+
#define I2C2_EV_IRQn I2C2_3_4_IRQn
81+
#define I2C2_EV_IRQHandler I2C2_3_4_IRQHandler
82+
#else
7883
#define I2C2_EV_IRQn I2C2_3_IRQn
7984
#define I2C2_EV_IRQHandler I2C2_3_IRQHandler
85+
#endif // defined(I2C4_BASE)
8086
#else
8187
#define I2C2_EV_IRQn I2C2_IRQn
8288
#define I2C2_EV_IRQHandler I2C2_IRQHandler
8389
#endif
8490
#endif // defined(I2C2_BASE)
8591
#if defined(I2C3_BASE)
86-
#if defined(STM32G0xx)
92+
#if defined(STM32G0xx) || defined(STM32U0xx)
93+
#if defined(I2C4_BASE)
94+
#define I2C3_EV_IRQn I2C2_3_4_IRQn
95+
#else
8796
#define I2C3_EV_IRQn I2C2_3_IRQn
97+
#endif
8898
#else
8999
#define I2C3_EV_IRQn I2C3_IRQn
90100
#define I2C3_EV_IRQHandler I2C3_IRQHandler
91101
#endif
92102
#endif // defined(I2C3_BASE)
93103
/* Defined but no one has it */
94104
#if defined(I2C4_BASE)
105+
#if defined(STM32U0xx)
106+
#define I2C4_EV_IRQn I2C2_3_4_IRQn
107+
#else
95108
#define I2C4_EV_IRQn I2C4_IRQn
96109
#define I2C4_EV_IRQHandler I2C4_IRQHandler
110+
#endif
97111
#endif // defined(I2C4_BASE)
98-
#endif /* STM32C0xx || STM32F0xx || STM32G0xx || STM32L0xx */
112+
#endif /* STM32C0xx || STM32F0xx || STM32G0xx || STM32L0xx || STM32U0xx */
99113

100114
typedef struct i2c_s i2c_t;
101115

0 commit comments

Comments
 (0)
0