arduino / arduino/ArduinoCore-API

Should SPI `attachInterrupt()` and `detachInterrupt()` be removed?

Đang mở
#183 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
C++
Star
306
Fork
150
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

It looks like these methos are only used in the AVR ports, and even then they indicate that they should not be used.

[ArduinoCore-avr/libraries/SPI/src/SPI.h#L306-L310](https://github.com/arduino/ArduinoCore-avr/blob/42fa4a1ea1b1b11d1cc0a60298e529d37f9d14bd/libraries/SPI/src/SPI.h#L306-L310)
[ArduinoCore-megaavr/libraries/SPI/src/SPI.h#L183-L187](https://github.com/arduino/ArduinoCore-megaavr/blob/01b56951ed2a8acfa7a4efc4e9a2687f626641d1/libraries/SPI/src/SPI.h#L183-L187)
```cpp
// These undocumented functions should not be used. SPI.transfer()
// polls the hardware flag which is automatically cleared as the
// AVR responds to SPI's interrupt
inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
```

Other cores do nothing or even do not implement it:
- [ArduinoCore-samd/libraries/SPI/SPI.cpp#L267-L273](https://github.com/arduino/ArduinoCore-samd/blob/26f2d480e1f8934c8e225f4171076e2e3be0a949/libraries/SPI/SPI.cpp#L267-L273)
- [ArduinoCore-mbed/libraries/SPI/SPI.cpp#L90-L96](https://github.com/arduino/ArduinoCore-mbed/blob/8593ab99713c662060cd02ca95c3ef25b2fd1bce/libraries/SPI/SPI.cpp#L90-L96)
- [ArduinoCore-arc32/libraries/SPI/src/SPI.h](https://github.com/arduino/ArduinoCore-arc32/blob/9f2e5e1404649026c057a4128308cb20c413b021/libraries/SPI/src/SPI.h)
- [ArduinoCore-sam/libraries/SPI/src/SPI.cpp](https://github.com/arduino/ArduinoCore-sam/blob/790ff2c852bf159787a9966bddee4d9f55352d15/libraries/SPI/src/SPI.cpp)

When are these methods meant to be used by Arduino users or ArduinoCore developers?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

So sánh các khai báo và triển khai SPI được liên kết cho ArduinoCore-avr, megaavr, samd, mbed, arc32 và sam. Trước tiên, hãy kiểm tra attachInterrupt() và detachInterrupt() được định nghĩa hoặc bị bỏ qua như thế nào trong các core đó, cũng như liệu hợp đồng API có giải thích mục đích của chúng hay không. Được xem là hoàn thành khi đã đưa ra quyết định được ghi nhận về trạng thái được hỗ trợ của chúng và xác định được các tệp core bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
api, embedded-iot
Loại issue
Tái cấu trúc
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.