Skip to content

Interrupt configuration pushPull logic broken #34

@choller

Description

@choller

Currently, the interrupt configuration function looks like this:

void LSM9DS1::configInt(interrupt_select interrupt, uint8_t generator,
	                     h_lactive activeLow, pp_od pushPull)
{
	[...]

	if (pushPull) temp &= ~(1<<4);
	else temp |= (1<<4);
	
	[...]
}

with pp_od being declared as

enum pp_od
{
	INT_PUSH_PULL,
	INT_OPEN_DRAIN
};

The LSM9DS1 spec says:

PP_OD   Push-pull/open-drain selection on the INT1_A/G pin and INT2_A/G pin.
        Default value: 0
        (0: push-pull mode; 1: open-drain mode)

So with the current code, if you specify INT_PUSH_PULL (which is 0), it will write 1 into the register and switch to open-drain mode instead.

The parameter should be renamed and the logic swapped to give the correct result.

Fwiw, this means that all uses of interrupts with this library are broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions