cancel
Showing results for 
Search instead for 
Did you mean: 

S2-LP library: Bug in S2LPTimerSetRxTimerStopCondition

Roman Jasmann
Associate II

Hi,

there is a bug in the S2-LP library function S2LPTimerSetRxTimerStopCondition:

void S2LPTimerSetRxTimerStopCondition(RxTimeoutStopCondition xStopCondition)

{

uint8_t tmp;

s_assert_param(IS_RX_TIMEOUT_STOP_CONDITION(xStopCondition));

S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);

tmp &= ~(CS_TIMEOUT_MASK_REGMASK | SQI_TIMEOUT_MASK_REGMASK | PQI_TIMEOUT_MASK_REGMASK);

tmp |= (((uint8_t)xStopCondition) << 5);

S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);

S2LPSpiReadRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);

tmp &= ~RX_TIMEOUT_AND_OR_SEL_REGMASK;

tmp |= (((uint8_t)xStopCondition) >> 1);

g_xStatus = S2LPSpiWriteRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);

}

The bug fixed function is:

void S2LPTimerSetRxTimerStopCondition(RxTimeoutStopCondition xStopCondition)

{

uint8_t tmp;

s_assert_param(IS_RX_TIMEOUT_STOP_CONDITION(xStopCondition));

S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);

tmp &= ~(CS_TIMEOUT_MASK_REGMASK | SQI_TIMEOUT_MASK_REGMASK | PQI_TIMEOUT_MASK_REGMASK);

tmp |= ((uint8_t)xStopCondition & 0x7U) << 5U;

S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);

S2LPSpiReadRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);

tmp &= ~RX_TIMEOUT_AND_OR_SEL_REGMASK;

tmp |= ((uint8_t)xStopCondition >> 3U) << 6U;

g_xStatus = S2LPSpiWriteRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);

}

0 REPLIES 0