arduino / arduino/ArduinoCore-API

Ability to set speed in shiftIn & shiftOut

Abierto
#83 1 comentario 7 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
306
Forks
150
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comience con las declaraciones de shiftIn y shiftOut mostradas en el issue y compare la semántica solicitada de maxSpeed con la referencia de la biblioteca de hardware SPI de Arduino. Determine cómo el manejo de la velocidad puede conservar las llamadas existentes y admitir dispositivos más lentos, como en el caso de ESP32/HX711; se considera terminado cuando la API admite una comunicación más lenta sin romper la compatibilidad hacia atrás.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
api, embedded-iot
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.