In the code for
S2LP::S2LPCsmaSetCcaLength(uint8_t xCcaLength), it is missing the shift to the upper 4 bits of the register. See S2LPCsmaGetCcaLength method.
/**
* @brief Set the CCA length.
* @param xCcaLength the CCA length (a value between 1 and 15 that multiplies the CCA period).
* This parameter can be any value of @ref CsmaLength.
* @retval None.
*/
void S2LP::S2LPCsmaSetCcaLength(uint8_t xCcaLength)
{
uint8_t tmp;
s_assert_param(IS_CSMA_LENGTH(xCcaLength));
S2LPSpiReadRegisters(CSMA_CONF0_ADDR, 1, &tmp);
tmp &= ~CCA_LEN_REGMASK;
tmp |= xCcaLength;
g_xStatus = S2LPSpiWriteRegisters(CSMA_CONF0_ADDR, 1, &tmp);
}
/**
* @brief Return the CCA length.
* @param None.
* @retval uint8_t CCA length.
*/
uint8_t S2LP::S2LPCsmaGetCcaLength(void)
{
uint8_t tmp;
g_xStatus = S2LPSpiReadRegisters(CSMA_CONF0_ADDR, 1, &tmp);
return (tmp >> 4);
}
In the code for S2LP::S2LPCsmaSetCcaLength(uint8_t xCcaLength), it is missing the shift to the upper 4 bits of the register. See S2LPCsmaGetCcaLength method.