Skip to content

Commit d71537b

Browse files
committed
STM32: I2C: use irq helper function
1 parent c2060e3 commit d71537b

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

targets/TARGET_STM/TARGET_STM32F4/i2c_api.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -787,18 +787,7 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx,
787787
obj_s->address = address;
788788
obj_s->stop = stop;
789789

790-
IRQn_Type irq_event_n = obj_s->event_i2cIRQ;
791-
IRQn_Type irq_error_n = obj_s->error_i2cIRQ;
792-
793-
/* Set up event IT using IRQ and handler tables */
794-
NVIC_SetVector(irq_event_n, handler);
795-
HAL_NVIC_SetPriority(irq_event_n, 0, 1);
796-
HAL_NVIC_EnableIRQ(irq_event_n);
797-
798-
/* Set up error IT using IRQ and handler tables */
799-
NVIC_SetVector(irq_error_n, handler);
800-
HAL_NVIC_SetPriority(irq_error_n, 0, 0);
801-
HAL_NVIC_EnableIRQ(irq_error_n);
790+
i2c_ev_err_enable(obj, handler);
802791

803792
/* Set operation step depending if stop sending required or not */
804793
if ((tx_length && !rx_length) || (!tx_length && rx_length)) {

0 commit comments

Comments
 (0)