Documentation
¶
Index ¶
- Constants
- type HDC1080
- func (h *HDC1080) Close() error
- func (h *HDC1080) GetConfig() (*HDC1080Config, error)
- func (h *HDC1080) GetDeviceId() (uint16, error)
- func (h *HDC1080) GetHumidity() (float64, error)
- func (h *HDC1080) GetManufacturerId() (uint16, error)
- func (h *HDC1080) GetSerialId() (string, error)
- func (h *HDC1080) GetTemperature() (float64, error)
- func (h *HDC1080) Reset() error
- func (h *HDC1080) SetConfig(conf *HDC1080Config) error
- type HDC1080Config
Constants ¶
View Source
const ( Hdc1080RegTemperature = 0x0 Hdc1080RegHumidity = 0x1 Hdc1080RegConfigAndStatus = 0x2 Hdc1080RegSerialPart1 = 0xfb Hdc1080RegSerialPart2 = 0xfc Hdc1080RegSerialPart3 = 0xfd Hdc1080RegManufacturerId = 0xfe Hdc1080RegDeviceId = 0xff Hdc1080CommandDelay = 20 * time.Millisecond Hdc1080ModeNormal = 0b0 Hdc1080ModeReset = 0b1 Hdc1080HeaterEnable = 0b1 Hdc1080HeaterDisable = 0b0 Hdc1080AcquisitionSingle = 0b0 Hdc1080AcquisitionBoth = 0b1 Hdc1080BatteryStatusHigh = 0b0 Hdc1080BatteryStatusLow = 0b1 Hdc1080TemperatureResolution14Bit = 0b0 Hdc1080TemperatureResolution11Bit = 0b1 Hdc1080HumidityResolution14Bit = 0b0 Hdc1080HumidityResolution11Bit = 0b1 Hdc1080HumidityResolution8Bit = 0b10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HDC1080 ¶
type HDC1080 struct {
// contains filtered or unexported fields
}
func NewHdc1080 ¶
NewHdc1080 新建一个hdc1080的连接句柄 NewHdc1080 open a new connection of hdc1080
func (*HDC1080) GetConfig ¶
func (h *HDC1080) GetConfig() (*HDC1080Config, error)
GetConfig 获取配置 GetConfig get chip config
func (*HDC1080) GetDeviceId ¶
GetDeviceId 获取器件id,固定为0x1050 GetDeviceId get device id, result is 0x1050
func (*HDC1080) GetHumidity ¶
GetHumidity 获取相对湿度 GetHumidity get relative humidity
func (*HDC1080) GetManufacturerId ¶
GetManufacturerId 获取制造商id,固定为0x5449 GetManufacturerId get manufacturer id, result is 0x5449
func (*HDC1080) GetSerialId ¶
GetSerialId 获取器件唯一id GetSerialId get device serial id
func (*HDC1080) GetTemperature ¶
GetTemperature 获取摄氏温度 GetTemperature get celsius temperature
func (*HDC1080) SetConfig ¶
func (h *HDC1080) SetConfig(conf *HDC1080Config) error
SetConfig 写入配置 SetConfig write config to chip
type HDC1080Config ¶
type HDC1080Config struct {
Reset uint8 `json:"reset"`
Heater uint8 `json:"heater"`
AcquisitionMode uint8 `json:"acquisition_mode"`
BatteryStatus uint8 `json:"battery_status"`
TemperatureResolution uint8 `json:"temperature_resolution"`
HumidityResolution uint8 `json:"humidity_resolution"`
}
HDC1080Config hdc1080配置结构体 HDC1080Config config struct
func (*HDC1080Config) Marshal ¶
func (conf *HDC1080Config) Marshal() uint16
Marshal 根据配置结构体生成配置 Marshal convert struct to code
Click to show internal directories.
Click to hide internal directories.