arduino / arduino/ArduinoCore-API
Should SPI `attachInterrupt()` and `detachInterrupt()` be removed?
- 主要语言
- C++
- 星标
- 306
- 派生
- 150
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
这个仓库没有索引到贡献指南
调研方向
比较为 ArduinoCore-avr、megaavr、samd、mbed、arc32 和 sam 链接的 SPI 声明与实现。首先检查 attachInterrupt() 和 detachInterrupt() 在这些 core 中是如何定义或省略的,以及 API 契约是否说明了它们的用途。当对它们的支持状态作出有文档记录的决定,并确定受影响的 core 文件后,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp
- 领域
- api, embedded-iot
- Issue 类型
- 重构
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100