i2c

package
v0.0.0-...-5e7c8ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	I2C_SLAVE = 0x0703

	OLED_CMD                 = 0x80
	OLED_CMD_COL_ADDRESSING  = 0x21
	OLED_CMD_PAGE_ADDRESSING = 0x22
	OLED_CMD_CONTRAST        = 0x81
	OLED_CMD_START_COLUMN    = 0x00
	OLED_CMD_HIGH_COLUMN     = 0x10
	OLED_CMD_DISPLAY_OFF     = 0xAE
	OLED_CMD_DISPLAY_ON      = 0xAF

	OLED_DATA            = 0x40
	OLED_ADRESSING       = 0x21
	OLED_ADRESSING_START = 0xB0
	OLED_ADRESSING_COL   = 0x21
	OLED_END             = 0x10
	PIXSIZE              = 8
)

Constants for OLED commands and addressing const (

Variables

This section is empty.

Functions

This section is empty.

Types

type I2c

type I2c struct {
	Img draw.Image
	// contains filtered or unexported fields
}

Struct for managing I2C operations

func NewI2c

func NewI2c(address, bus int) (*I2c, error)

Function to initialize I2C with given parameters

func (*I2c) Clear

func (i *I2c) Clear()

Clear the OLED screen

func (*I2c) Close

func (i *I2c) Close() error

Close the I2C connection

func (*I2c) Write

func (i *I2c) Write(b []byte) (int, error)

Write data to I2C

func (*I2c) WriteCommand

func (i *I2c) WriteCommand(cmd byte) (int, error)

Send command to OLED

func (*I2c) WriteData

func (i *I2c) WriteData(data []byte) (int, error)

Send data to OLED

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳