arduino / arduino/ArduinoCore-API

Ability to set speed in shiftIn & shiftOut

Đang mở
#83 1 bình luận 7 reaction 0 người được giao Xem trên GitHub
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ả

While the clock speeds of various Microcontrollers increase, the speed of the shiftIn and shiftOut also increases. This creates a problem when communicating with slower devices. It could be interesting to add an optional argument to these functions so they reliably work with slower devices. Just like with the SPI hardware library where you can set the maximum SPI speed. https://www.arduino.cc/en/Reference/SPI

I had this problem when I was trying to use the 'normal' library for the HX711 load cell amp with an ESP32.
https://github.com/bogde/HX711/issues/75

The interface could look like this:
```cpp

void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val, unsigned long maxSpeed = 0);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, unsigned long maxSpeed = 0);

```
Where a maxSpeed of 0 would mean that it would use the full speed of the microcontroller. Otherwise you could define the speed as frequency (15Mhz -> 15000000) just like in the SPI hardware library.

In this way Arduino would be future-proof without losing backwards compatibility.

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

Bắt đầu với các khai báo shiftIn và shiftOut được nêu trong issue, đồng thời so sánh ngữ nghĩa maxSpeed được yêu cầu với tài liệu tham chiếu của thư viện phần cứng SPI của Arduino. Xác định cách xử lý tốc độ có thể duy trì các lệnh gọi hiện có và hỗ trợ những thiết bị chậm hơn, chẳng hạn như trường hợp ESP32/HX711; công việc được xem là hoàn tất khi API hỗ trợ giao tiếp chậm hơn mà không phá vỡ khả năng tương thích ngược.

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ính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/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.