C# Класс Porrey.Uwp.IoT.Sensors.I2C.RegisterConverter

Helpers methods for reading and writing from the device registers.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BitIsHigh ( byte value, int bitIndex ) : bool

Determines if a bit in the given position of a byte is High (1) or Low (0).

BitIsLow ( byte value, int bitIndex ) : bool

Determines if a bit in the given position of a byte is High (1) or Low (0).

GetBit ( byte value, int bitIndex ) : bool

Gets a bit in the given position of a byte to the give value.

SetBit ( byte value, int bitIndex, bool bit ) : byte

Sets a bit in the given position of a byte to the give value.

ToByteArray ( float value ) : byte[]

Converts a float to a 2-byte value to be written to the device register.

ToFloat ( byte registerValue ) : float

Converts a 2-byte register value to a float.

Описание методов

BitIsHigh() публичный статический Метод

Determines if a bit in the given position of a byte is High (1) or Low (0).
public static BitIsHigh ( byte value, int bitIndex ) : bool
value byte The byte value to be checked.
bitIndex int The bit position from 0 to 7.
Результат bool

BitIsLow() публичный статический Метод

Determines if a bit in the given position of a byte is High (1) or Low (0).
public static BitIsLow ( byte value, int bitIndex ) : bool
value byte The byte value to be checked.
bitIndex int The bit position from 0 to 7.
Результат bool

GetBit() публичный статический Метод

Gets a bit in the given position of a byte to the give value.
public static GetBit ( byte value, int bitIndex ) : bool
value byte The byte value to be modified.
bitIndex int The index of the bit to modify. This /// value can be 0 to 7.
Результат bool

SetBit() публичный статический Метод

Sets a bit in the given position of a byte to the give value.
public static SetBit ( byte value, int bitIndex, bool bit ) : byte
value byte The byte value to be modified.
bitIndex int The index of the bit to modify. This /// value can be 0 to 7.
bit bool The value to be set in the byte.
Результат byte

ToByteArray() публичный статический Метод

Converts a float to a 2-byte value to be written to the device register.
public static ToByteArray ( float value ) : byte[]
value float The value to be converted.
Результат byte[]

ToFloat() публичный статический Метод

Converts a 2-byte register value to a float.
public static ToFloat ( byte registerValue ) : float
registerValue byte A 2-byte register value /// read from the device to be converted.
Результат float