Documentation ¶
Overview ¶
Driver works for max7219 and 7221 Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
Index ¶
- Constants
- type Device
- func (driver *Device) Configure()
- func (driver *Device) SetDecodeMode(digitNumber uint8)
- func (driver *Device) SetScanLimit(digitNumber uint8)
- func (driver *Device) StartDisplayTest()
- func (driver *Device) StartShutdownMode()
- func (driver *Device) StopDisplayTest()
- func (driver *Device) StopShutdownMode()
- func (driver *Device) WriteCommand(register, data byte)
Constants ¶
const ( REG_NOOP byte = 0x00 REG_DIGIT0 byte = 0x01 REG_DIGIT1 byte = 0x02 REG_DIGIT2 byte = 0x03 REG_DIGIT3 byte = 0x04 REG_DIGIT4 byte = 0x05 REG_DIGIT5 byte = 0x06 REG_DIGIT6 byte = 0x07 REG_DIGIT7 byte = 0x08 REG_DECODE_MODE byte = 0x09 // turn of for led matrix, turn on for digits REG_INTENSITY byte = 0x0A REG_SCANLIMIT byte = 0x0B REG_SHUTDOWN byte = 0x0C // turn on for no shutdown mode REG_DISPLAY_TEST byte = 0x0F // turn off for no display test )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func NewDevice ¶
NewDriver creates a new max7219 connection. The SPI wire must already be configured The SPI frequency must not be higher than 10MHz. parameter cs: the datasheet also refers to this pin as "load" pin.
func (*Device) SetDecodeMode ¶
SetDecodeMode sets the decode mode for 7 segment displays. digitNumber = 1 -> 1 digit gets decoded digitNumber = 2 or 3, or 4 -> 4 digit are being decoded digitNumber = 8 -> 8 digits are being decoded digitNumber 0 || digitNumber > 8 -> no decoding is being used
func (*Device) SetScanLimit ¶
SetScanLimit sets the scan limit. Maximum is 8. Example: a 4 digit 7SegmentDisplay has a scan limit of 4
func (*Device) StartDisplayTest ¶
func (driver *Device) StartDisplayTest()
StartDisplayTest starts a display test.
func (*Device) StartShutdownMode ¶
func (driver *Device) StartShutdownMode()
StartShutdownMode sets the IC into a low power shutdown mode.
func (*Device) StopDisplayTest ¶
func (driver *Device) StopDisplayTest()
StopDisplayTest stops the display test and gets into normal operation mode.
func (*Device) StopShutdownMode ¶
func (driver *Device) StopShutdownMode()
StartShutdownMode sets the IC into normal operation mode.
func (*Device) WriteCommand ¶
WriteCommand write data to a given register.