This commit adds usbdev, a common API to interface USB peripheral
devices. The API is split into two parts, one for the USB device itself
and one for the USB endpoint.
This driver API aims to control DC motors.
It handles :
* motor controller associated to a PWM device
* several motors by controller
* motor rotation direction
* brake capability
* enable/disable motor individually
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
Change description to reflect the configurability of the serial
interface.
Also, fix the uart_mode parameter description as the UART will be
configured and not initialized.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
As suggested in PR#5899 add a routine uart_mode() that will
setup data bits, stop bits and parity at runtime.
uart.h provides a set of enums defining these settings and each
platform will override them to specify values corresponding to
its configuration registers.
The idea behind the enums is to specify default settings i.e. 8N1
through the 0 value item. Invoking uart_mode(uart, 0, 0, 0) will
setup 8N1 mode.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
The LTC4150 is a coulomb counter (a.k.a. battery sensor or bidirectional
current sensor) that is used in the MSBA2 board and available for little money
as easy to use break out board.
This change makes it more clear that the dev is modified in some of the
read functions. Only pulse_counter_read_without_reset gets a const
pointer argument.
Also, use pulse_counter_t pointers instead of void pointers where
possible.
All DS18 functions have a dev argument. All except the init function use
it as an IN parameter, so we can prototype it as const ds18_t*.
As a consequence we can drop the cast in read_temperature() in ds18_saul.c
which was the primary trigger for the changes.
The commit also follows the preferred convention that "params" is a field
in the device struct. Only the init function needs to write it.
This follows the usual convention of having the whole params in the device
struct instead of a pointer-to. This also eliminates the need to cast a
const to a non-const pointer in the init function.
Some drivers return on netdev_driver_t::recv() not the actual frame size, but
an upper bound estimation of it. The upper layer code is already prepared to
handle that. This brings the doc in sync with the code.
Clarified in the documentation how netdev_driver_t::recv() should behave in case
the size of the buffer in parameter buf (indicated by parameter len) is to small
to fit the received frame.
netdev_driver_t::recv does on of three things:
- Receive the frame
- Drop it
- Get (an estimation of) the size of the frame
The brief section of the documentation was changed to reflect this. (And it
starts with the least obvious thing in the hope readers of the API stumble upon
it...)
Removed the invalid precondition in netdev_driver_t::recv that the buffer never
NULL and the length positive. (In the "get message size" case both is wrong, in
the drop message case the first part is wrong.)
The write_reg/s states a repeated start write is used but that is not how the i2c is implemeneted.
Most devices also only use a continuous write so the API should be changed to match implementation and the majority of sensors.