Documentation
¶
Index ¶
- Variables
- type Device
- func (d *Device) Calibrate() error
- func (d *Device) Close()
- func (d *Device) HeartRate() (float64, error)
- func (d *Device) Shutdown() error
- func (d *Device) SpO2() (float64, error)
- func (d *Device) Startup() error
- func (d *Device) Temperature() (float64, error)
- func (d *Device) ToMax30102() (*max30102.Device, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrWrongDevice is thrown when trying to convert a max3010x.Device // interface to the underlying *Device struct and the device does not match // the PartID. ErrWrongDevice = errors.New("wrong device") // ErrNotDetected is thrown when trying to read a heart rate or SpO2 level // and nothing is detected on the sensor (e.g. no finger is placed on the // sensor when the function is called). ErrNotDetected = errors.New("nothing detected on the sensor") // ErrTooNoisy is thrown when trying to read data and has too much // variation, therefore consistent measurements cannot be done (e.g. // ambient light, moving finger, etc.). ErrTooNoisy = errors.New("data has too much noise") )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { // PartID is the byte part ID as set by the manufacturer. // MAX30100: 0x11 or max30100.PartID // MAX30102: 0x15 or max30102.PartID PartID byte RevID byte // contains filtered or unexported fields }
Device defines a MAX3010x device.
func (*Device) HeartRate ¶
HeartRate returns the current heart rate. Heart rate is expected to be between 10 to 250 beats per minute. Values outside that range are considered invalid and the function will continue to sample until a valid bpm is found. If no contact is detect on the sensor, this function returns 0 with an ErrNotDetected error. If the sensor cannot detect a beat after 1s, it returns 0 with an ErrTooNoisy error.
func (*Device) Temperature ¶
Temperature returns the current temperature of the device.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.