added automatic GPIO teardown, remap support to i2c, force error comments in ini if disabled
This commit is contained in:
@@ -151,25 +151,7 @@ static error_t DO_init(Unit *unit)
|
||||
/** Tear down the unit */
|
||||
static void DO_deInit(Unit *unit)
|
||||
{
|
||||
struct priv *priv = unit->data;
|
||||
|
||||
// de-init the pins only if inited correctly
|
||||
if (unit->status == E_SUCCESS) {
|
||||
assert_param(priv->port);
|
||||
|
||||
bool suc = true;
|
||||
uint16_t mask = 1;
|
||||
for (int i = 0; i < 16; i++, mask <<= 1) {
|
||||
if (priv->pins & mask) {
|
||||
|
||||
uint32_t ll_pin = pin2ll((uint8_t) i, &suc);
|
||||
assert_param(suc); // this should never fail if we got this far
|
||||
|
||||
// configure the pin as analog
|
||||
LL_GPIO_SetPinMode(priv->port, ll_pin, LL_GPIO_MODE_ANALOG);
|
||||
}
|
||||
}
|
||||
}
|
||||
// pins are de-inited during teardown
|
||||
|
||||
// Release all resources
|
||||
rsc_teardown(unit);
|
||||
|
||||
Reference in New Issue
Block a user