some cleaning
This commit is contained in:
@@ -125,18 +125,14 @@ static error_t DO_init(Unit *unit)
|
|||||||
// Claim all needed pins
|
// Claim all needed pins
|
||||||
TRY(rsc_claim_gpios(unit, priv->port_name, priv->pins));
|
TRY(rsc_claim_gpios(unit, priv->port_name, priv->pins));
|
||||||
|
|
||||||
uint16_t mask = 1;
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int i = 0; i < 16; i++, mask <<= 1) {
|
if (priv->pins & (1 << i)) {
|
||||||
if (priv->pins & mask) {
|
|
||||||
uint32_t ll_pin = pin2ll((uint8_t) i, &suc);
|
uint32_t ll_pin = pin2ll((uint8_t) i, &suc);
|
||||||
|
|
||||||
// --- Init hardware ---
|
// --- Init hardware ---
|
||||||
LL_GPIO_SetPinMode(priv->port, ll_pin, LL_GPIO_MODE_OUTPUT);
|
LL_GPIO_SetPinMode(priv->port, ll_pin, LL_GPIO_MODE_OUTPUT);
|
||||||
|
LL_GPIO_SetPinOutputType(priv->port, ll_pin,
|
||||||
LL_GPIO_SetPinOutputType(priv->port, ll_pin, (priv->open_drain & mask) ?
|
(priv->open_drain & (1 << i)) ? LL_GPIO_OUTPUT_OPENDRAIN : LL_GPIO_OUTPUT_PUSHPULL);
|
||||||
LL_GPIO_OUTPUT_OPENDRAIN :
|
|
||||||
LL_GPIO_OUTPUT_PUSHPULL);
|
|
||||||
|
|
||||||
LL_GPIO_SetPinSpeed(priv->port, ll_pin, LL_GPIO_SPEED_FREQ_HIGH);
|
LL_GPIO_SetPinSpeed(priv->port, ll_pin, LL_GPIO_SPEED_FREQ_HIGH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,8 +232,6 @@ enum PinCmd_ {
|
|||||||
/** Handle a request message */
|
/** Handle a request message */
|
||||||
static error_t DO_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, PayloadParser *pp)
|
static error_t DO_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, PayloadParser *pp)
|
||||||
{
|
{
|
||||||
struct priv *priv = unit->data;
|
|
||||||
|
|
||||||
uint16_t packed = pp_u16(pp);
|
uint16_t packed = pp_u16(pp);
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user