AnsweredAssumed Answered

LPCopen sct_11u6x.h is wrong?

Question asked by Rens Kessener on Jul 15, 2016
Latest reply on Aug 3, 2016 by isaacavila

Maybe it is the wrong place to start this discussion, but ......

 

In lpc open, lpc_chip_11u6x project, there is an error in sct_11u6x.h, as far as I understand.

 

The OUTPUTDIRCTRL register specifies (for each output) the impact of the counting direction on the meaning of set and clear operations on the output.

For each output there are 2 bits to set that behaviour.

However, the routine specified in sct_11u6x.h  to set that register is:

STATIC INLINE void Chip_SCT_SetoutputdirControl(LPC_SCT_T *pSCT, CHIP_SCT_EVENT_T value)

{

    pSCT->OUTPUTDIRCTRL |= value;

}

There is no reference to the output that is to be controlled, nor any  handling of the 2 bits per output.

 

I think the routine should look like:

STATIC INLINE void Chip_SCT_SetoutputdirControl(LPC_SCT_T *pSCT, CHIP_SCT_OUTPUT_REG_T n, uint8_t value)

{

        pSCT->OUTPUTDIRCTRL |= uint32_t (value << (n << 1));

}

 

Regards

Rens

Outcomes