1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00
RIOT/drivers
bors[bot] 41b54d8594
Merge #18392
18392: drivers/servo: reimplement with high level interface r=benpicco a=maribu

### Contribution description

The previous servo driver didn't provide any benefit over using PWM directly, as users controlled the servo in terms of PWM duty cycles. This changes the interface to provide a high level interface that abstracts the gory PWM details.

In addition, a SAUL layer and auto-initialization is provided.

### Testing procedure

The test application provides access to the servo driver via the `saul` shell command.

```
> saul
2022-08-02 22:12:31,826 # saul
2022-08-02 22:12:31,827 # ID	Class		Name
2022-08-02 22:12:31,830 # #0	ACT_SWITCH	LD1(green)
2022-08-02 22:12:31,832 # #1	ACT_SWITCH	LD2(blue)
2022-08-02 22:12:31,834 # #2	ACT_SWITCH	LD3(red)
2022-08-02 22:12:31,837 # #3	SENSE_BTN	B1(User button)
2022-08-02 22:12:31,838 # #4	ACT_SERVO	servo
> saul write 4 0
2022-08-02 22:12:41,443 # saul write 4 0
2022-08-02 22:12:41,445 # Writing to device #4 - servo
2022-08-02 22:12:41,447 # Data:	             0 
2022-08-02 22:12:41,450 # [servo] setting 0 to 2949 (0 / 255)
2022-08-02 22:12:41,453 # data successfully written to device #4
> saul write 4 256
2022-08-02 22:12:45,343 # saul write 4 256
2022-08-02 22:12:45,346 # Writing to device #4 - servo
2022-08-02 22:12:45,347 # Data:	           256 
2022-08-02 22:12:45,351 # [servo] setting 0 to 6865 (255 / 255)
2022-08-02 22:12:45,354 # data successfully written to device #4
```

Each write resulted in the MG90S servo that I connected to move to the corresponding position.

### Issues/PRs references

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-02-22 09:15:59 +00:00
..
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-03-04 14:15:35 +01:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2023-02-22 09:15:59 +00:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2022-10-04 00:28:46 +02:00
2022-09-14 15:05:25 +02:00
2023-01-31 21:05:07 +01:00
2022-09-14 15:05:25 +02:00
2022-03-04 14:15:47 +01:00
2023-02-16 15:02:19 +00:00
2022-09-16 14:00:35 +02:00
2022-12-15 10:15:31 +00:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2023-02-21 16:53:06 +00:00
2022-03-04 14:15:50 +01:00
2022-09-14 15:05:25 +02:00
2022-09-26 18:54:40 +02:00
2022-09-16 14:00:35 +02:00
2023-01-10 15:44:57 +00:00
2022-03-04 14:15:57 +01:00
2022-03-04 14:15:58 +01:00
2022-09-14 15:05:25 +02:00
2022-09-14 15:05:25 +02:00
2023-02-01 21:57:23 +01:00
2023-02-13 21:09:07 +00:00