Skip to content

Commit

Permalink
support for dcp405 r3b3
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 5, 2020
1 parent b703b26 commit 299108b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/eez/modules/dib-dcp405/dib-dcp405.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static const uint16_t MODULE_REVISION_DCP405_R2B5 = 0x0205;
static const uint16_t MODULE_REVISION_DCP405_R2B7 = 0x0207;
static const uint16_t MODULE_REVISION_DCP405_R2B11 = 0x020B;
static const uint16_t MODULE_REVISION_DCP405_R3B1 = 0x0301;
static const uint16_t MODULE_REVISION_DCP405_R3B3 = 0x0303;

namespace eez {
namespace dcp405 {
Expand Down
6 changes: 3 additions & 3 deletions src/eez/modules/dib-dcp405/ioexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ uint8_t IOExpander::getRegValue(int i) {
} else if (reg == REG_GPIOA) {
value = REG_VALUE_GPIOA;
} else if (reg == REG_GPIOB) {
if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1) {
if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1 && slot.moduleRevision < MODULE_REVISION_DCP405_R3B3) {
value = R3B1_REG_VALUE_GPIOB;
} else {
value = REG_VALUE_GPIOB;
Expand Down Expand Up @@ -322,7 +322,7 @@ bool IOExpander::testBit(int io_bit) {
auto result = (gpio & (1 << io_bit)) ? true : false;

auto &slot = *g_slots[slotIndex];
if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1) {
if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1 && slot.moduleRevision < MODULE_REVISION_DCP405_R3B3) {
if (io_bit == IO_BIT_OUT_OVP_ENABLE) {
result = !result;
}
Expand Down Expand Up @@ -352,7 +352,7 @@ void IOExpander::changeBit(int io_bit, bool set) {
}
#endif

if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1) {
if (slot.moduleRevision >= MODULE_REVISION_DCP405_R3B1 && slot.moduleRevision < MODULE_REVISION_DCP405_R3B3) {
if (io_bit == IO_BIT_OUT_OVP_ENABLE) {
set = !set;
}
Expand Down

0 comments on commit 299108b

Please sign in to comment.