I am using provided API which contains following function that has to be implemented by application designer. Can someone explain what these two statement means?
"Set to 0 if FieldVal is in correct position of the reg"
"If FieldVal is already in the correct position"
BitPos is passed in as a parameter so I can't imagine a scenario where user would ignore it by setting it to 0.
* Write up to 8-bit field to a single 8-bit register
* Example |___****_| Mask = 0x1E BitPos = 1
* Entry: DevAddr = Device Address
* RegAddr = 8-bit register address
* Mask = Field mask
* BitPos = Field LSBit position in the register (0-7)
* Set to 0 if FieldVal is in correct position of the reg
* FieldVal= Value (in the LSBits) of the field to be written
* If FieldVal is already in the correct position (i.e.,
* does not need to be shifted,) set BitPos to 0
* Return: None
void ATV_I2CWriteField8 (UCHAR DevAddr, UCHAR RegAddr, UCHAR Mask,
UCHAR BitPos, UCHAR FieldVal)