added automatic GPIO teardown, remap support to i2c, force error comments in ini if disabled

This commit is contained in:
2018-01-06 18:45:23 +01:00
parent ce895b3238
commit 6756b79ef4
9 changed files with 98 additions and 91 deletions
+1 -17
View File
@@ -161,23 +161,7 @@ static error_t DI_init(Unit *unit)
/** Tear down the unit */
static void DI_deInit(Unit *unit)
{
struct priv *priv = unit->data;
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);