Documentation ¶
Overview ¶
Package max contains drivers for IC's produced by Maxim Integrated.
MAX581x ¶
The implemententation for the MAX5813, MAX5814 and MAX5815 only implement the REF and CODEn_LOADn commands. The commands CODEn, LOADn, CODEn_LOAD_ALL, POWER, SW_CLEAR, SW_RESET, CONFIG, CODE_ALL, LOAD_ALL and CODE_ALL, CODE_ALL_LOAD_ALL are not implemented.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MAX5813 ¶
type MAX5813 struct {
// contains filtered or unexported fields
}
MAX5813 is a 4 channel DAC with a resolution of 8 bits. The datasheet is here: https://datasheets.maximintegrated.com/en/ds/MAX5813-MAX5815.pdf
Example ¶
d, err := i2c.Open(&i2c.Devfs{ Dev: "/dev/i2c-0", }, 0x1c) if err != nil { panic(fmt.Sprintf("failed to open device: %v", err)) } defer d.Close() // 2.5V is the input reference of the DAC. dac, err := NewMAX5813(d, 2.5) if err != nil { panic(fmt.Sprintf("failed to create MAX5813: %v", err)) } // Set output of channel 1 to 1.3V. if err := dac.SetVoltage(1.3, 1); err != nil { panic(fmt.Sprintf("failed to set voltage: %v", err)) } // It's also possible to set output of a channel with digital output code. if err := dac.SetInputCode(128, 1); err != nil { panic(fmt.Sprintf("failed to set voltage using output code: %v", err)) }
Output:
func NewMAX5813 ¶
NewMAX5813 returns a new instance of MAX5813.
func (MAX5813) SetInputCode ¶
SetInputCode writes the digital input code to the DAC using the CODEn_LOADn command.
func (MAX5813) SetVoltage ¶
SetVoltage set output voltage of channel. Using the Vref the input code is calculated and then SetInputCode is called.
func (*MAX5813) SetVref ¶
Vref sets the global reference for all channels. The device can use either an external reference or a internel reference, this depends on the wiring of the IC. Allowed values for the internel reference are 2.5V, 2.048V and 4.096V. If this function is called with one of these value the internel reference is set to this value using the REF command. For any other value the channels will use the input reference is equal to the
type MAX5814 ¶
type MAX5814 struct {
// contains filtered or unexported fields
}
MAX5814 is a 4 channel DAC with a resolution of 10 bits. The datasheet is here: https://datasheets.maximintegrated.com/en/ds/MAX5813-MAX5815.pdf
func NewMAX5814 ¶
NewMAX5814 returns a new instance of MAX5814.
func (MAX5814) SetInputCode ¶
SetInputCode writes the digital input code to the DAC using the CODEn_LOADn command.
func (MAX5814) SetVoltage ¶
SetVoltage set output voltage of channel. Using the Vref the input code is calculated and then SetInputCode is called.
func (*MAX5814) SetVref ¶
Vref sets the global reference for all channels. The device can use either an external reference or a internel reference, this depends on the wiring of the IC. Allowed values for the internel reference are 2.5V, 2.048V and 4.096V. If this function is called with one of these value the internel reference is set to this value using the REF command. For any other value the channels will use the input reference is equal to the
type MAX5815 ¶
type MAX5815 struct {
// contains filtered or unexported fields
}
MAX5815 is a 4 channel DAC with a resolution of 12 bits. The datasheet is here: https://datasheets.maximintegrated.com/en/ds/MAX5813-MAX5815.pdf
func NewMAX5815 ¶
NewMAX5815 returns a new instance of MAX5814.
func (MAX5815) SetInputCode ¶
SetInputCode writes the digital input code to the DAC using the CODEn_LOADn command.
func (MAX5815) SetVoltage ¶
SetVoltage set output voltage of channel. Using the Vref the input code is calculated and then SetInputCode is called.
func (*MAX5815) SetVref ¶
Vref sets the global reference for all channels. The device can use either an external reference or a internel reference, this depends on the wiring of the IC. Allowed values for the internel reference are 2.5V, 2.048V and 4.096V. If this function is called with one of these value the internel reference is set to this value using the REF command. For any other value the channels will use the input reference is equal to the