Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Welcome to Arduino_RT-Thread Discussions! #6

onelife started this conversation in General
Discussion options

👋 Welcome!

We’re using Discussions as a place to connect with other members of our community. We hope that you:

  • Ask questions you’re wondering about.
  • Share ideas.
  • Engage with other community members.
  • Welcome others and are open-minded. Remember that this is a community we
    build together 💪.

To get started, comment below with an introduction of yourself and tell us about what you do with this community.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hi, onelife,thank you for you good work!
could you pls provide an interrupt function sample for rt-thread? my hardware is Arduino DUE board. I found there's no interrupt in all the samples.

You must be logged in to vote
1 reply
Comment options

onelife Dec 23, 2022
Maintainer Author

Hi @danilliu-sudo,

Thanks for your interest in the Arduino RT-Thread library project!

The library is trying to utilize as much of the Arduino framework and libraries as possible (to reduce maintenance costs), and most of the common interrupts are handled by the framework. Therefore only a few interrupts are directly handled by the library.

You may find the examples in the driver code. E.g.,

static void usart_isr(struct rt_serial_device *serial) {
struct bsp_usart_contex *ctx;
RT_ASSERT(serial != RT_NULL);
ctx = (struct bsp_usart_contex *) serial->parent.user_data;
RT_ASSERT(ctx != RT_NULL);
if ((RESET != usart_interrupt_flag_get(ctx->usart_base, USART_INT_FLAG_RBNE)) && \
(RESET != usart_flag_get(ctx->usart_base, USART_FLAG_RBNE))) {
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
usart_interrupt_flag_clear(ctx->usart_base, USART_INT_FLAG_RBNE);
usart_flag_clear(ctx->usart_base, USART_FLAG_RBNE);
} else {
if (RESET != usart_flag_get(ctx->usart_base, USART_FLAG_CTSF)) {
usart_flag_clear(ctx->usart_base, USART_FLAG_CTSF);
}
if (RESET != usart_flag_get(ctx->usart_base, USART_FLAG_LBDF)) {
usart_flag_clear(ctx->usart_base, USART_FLAG_LBDF);
}
if (RESET != usart_flag_get(ctx->usart_base, USART_FLAG_TC)) {
usart_flag_clear(ctx->usart_base, USART_FLAG_TC);
}
}
}
/* Public functions ----------------------------------------------------------*/
#if CONFIG_USING_UART0
void USART0_IRQHandler(void) {
rt_interrupt_enter();
usart_isr(&usart_dev[USART_CH0]);
rt_interrupt_leave();
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /