small repair

This commit is contained in:
Kizarm 2024-11-30 11:03:21 +01:00
parent b12b9b92af
commit 84be40e742
2 changed files with 24 additions and 14 deletions

View file

@ -33,6 +33,7 @@ class GpioClass {
//r.B.IOPCEN = SET;
return r.R;
});
if (pin < 8u) {
const uint32_t pos = pin << 2;
port.CFGLR.modify([=](GPIOA_Type::CFGLR_DEF & r)->auto {
uint32_t t = r.R;
@ -40,6 +41,15 @@ class GpioClass {
t |= _mode << pos;
return t;
});
} else {
const uint32_t pos = (pin - 8u) << 2;
port.CFGHR.modify([=](GPIOA_Type::CFGHR_DEF & r)->auto {
uint32_t t = r.R;
t &= ~(0xFu << pos);
t |= _mode << pos;
return t;
});
}
}
void operator<< (const bool b) const {
port.BSHR.R = b ? 1u << pin : 1u << (pin + 16);

View file

@ -28,16 +28,16 @@ struct TrigerSettings {
};
static_assert (sizeof(TrigerSettings) == 10, "TrigerSettings error");
enum VOLTAGE_SCALE {
S100mV = 0b0011, // 1:1 x10
S200mV = 0b0111, // 1:1 x5
S500mV = 0b1011, // 1:1 x2
S100mV = 0b1100, // 1:1 x10
S200mV = 0b1110, // 1:1 x5
S500mV = 0b1101, // 1:1 x2
S1V = 0b0000, // 1:10 x10
S2V = 0b0100, // 1:10 x5
S5V = 0b1000, // 1:10 x2
S2V = 0b0010, // 1:10 x5
S5V = 0b0001, // 1:10 x2
S10V = 0b0001, // 1:100x10
S20V = 0b0101, // 1:100x5
S10V = 0b1000, // 1:100x10
S20V = 0b1010, // 1:100x5
S50V = 0b1001, // 1:100x2
};
union ChannelVoltage {