Documentation ¶
Index ¶
- Constants
- Variables
- type EPaper
- func (e *EPaper) AddLayer(img image.Image, startX, startY int, transparent bool)
- func (e *EPaper) ClearScreen()
- func (e *EPaper) Init()
- func (e *EPaper) PrintDisplay()
- func (e *EPaper) Reset()
- func (e *EPaper) Rotate(img image.Image) image.Image
- func (e *EPaper) Sleep()
- func (e *EPaper) Write(text string, fontSize float64, fontFile string) image.Image
- func (e *EPaper) WriteRotate(text string, fontSize float64, fontFile string, rotate bool) image.Image
- type Model
Constants ¶
const ( // ResetPin is the default pin where RST pin is connected. ResetPin string = "17" // DataCommandPin is the default pin where DC pin is connected. DataCommandPin string = "25" // ChipSelectionPin is the default pin where CS pin is connected. ChipSelectionPin string = "8" // BusyPin is the default pin where BUSY pin is connected. BusyPin string = "24" // CmdBoosterSoftStart is used during initialization. CmdBoosterSoftStart byte = 0x06 // CmdDataStartTransimission1 TODO ? CmdDataStartTransimission1 byte = 0x10 // CMdDeepSleep puts the screen on a low-power consumption. This should be done when the screen is not expected to be updated for a long time. CMdDeepSleep byte = 0x07 // CmdDisplayRefresh TODO ? CmdDisplayRefresh byte = 0x12 // CmdLutForVcom sets the LUT for VCOM. CmdLutForVcom byte = 0x20 // CmdLutBlue sets the LUT for White-to-White. CmdLutBlue byte = 0x21 // CmdLutWhite sets the LUT for Black-to-White. CmdLutWhite byte = 0x22 // CmdLutGray1 sets the LUT for White-to-Black. CmdLutGray1 byte = 0x23 // CmdLutGray2 sets the LUT for Black-to-Black. CmdLutGray2 byte = 0x24 // CmdLutRed0 ?? CmdLutRed0 byte = 0x25 // CmdLutRed1 ?? CmdLutRed1 byte = 0x26 // CmdLutRed2 ?? CmdLutRed2 byte = 0x27 // CmdLutRed3 ?? CmdLutRed3 byte = 0x28 // CmdPanelSetting is the code for PSR command. CmdPanelSetting byte = 0x00 // CmdPartialDisplayRefresh is the code for PDRF command. CmdPartialDisplayRefresh byte = 0x16 // CmdPllControl is the code for PLL command. CmdPllControl byte = 0x30 // CmdPowerOff is the code for POF command. CmdPowerOff byte = 0x02 // CmdPowerOn is the code for PON command. CmdPowerOn byte = 0x04 // CmdPowerOptimization is the code for power optimization (not a documented command). CmdPowerOptimization = 0xf8 // CmdPowerSetting is the code for PSR command. CmdPowerSetting byte = 0x01 // CmdTconResolution is the code for TRES command. CmdTconResolution byte = 0x61 // CmdTconSetting is the code for TCON command. CmdTconSetting byte = 0x60 // CmdTemperatureCalibration is the code for TSE command. CmdTemperatureCalibration byte = 0x41 // CmdVcmDcSetting is the code for VDCS command. CmdVcmDcSetting byte = 0x82 // CmdVcomDataIntervalSet is the code for CDI command. CmdVcomDataIntervalSet byte = 0x50 )
Variables ¶
var ( // Model2in7bw represents the black-and-white EPD 2.7 inches display Model2in7bw = Model{Width: 176, Height: 264, StartTransmission: 0x13} // Model7in5 represents the EPD 7.5 inches display Model7in5 = Model{Width: 384, Height: 640} )
var ( // Model2in7LutVcomDc bla. Model2in7LutVcomDc []byte = []byte{ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x32, 0x32, 0x00, 0x00, 0x02, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Model2in7LutWw = R21H Model2in7LutWw []byte = []byte{ 0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Model2in7LutBw = R22H r Model2in7LutBw []byte = []byte{ 0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Model2in7LutBb = R24H b Model2in7LutBb []byte = []byte{ 0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Model2in7LutWb = R23H w Model2in7LutWb []byte = []byte{ 0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } )
Functions ¶
This section is empty.
Types ¶
type EPaper ¶
type EPaper struct { DataCommandSelection gpio.PinOut // High: Data, Low: Command ChipSelection gpio.PinOut // Low: active Busy gpio.PinIO // Low: active Display draw.Image // This is the image that will be printed to screen // contains filtered or unexported fields }
EPaper represents the e-papaer device.
func NewCustom ¶
func NewCustom(dcPin, csPin, rstPin, busyPin string, model Model, simulation bool, debug io.Writer) (*EPaper, error)
NewCustom creates a new instance of EPaper with custom parameters. If you have the HAT module, you can use the New() function.
func (*EPaper) AddLayer ¶
AddLayer puts img on top of the previous layers prepared to be printed. Function Clearscreen() will also delete any prepared layer.
func (*EPaper) ClearScreen ¶
func (e *EPaper) ClearScreen()
ClearScreen erases anything that is on screen.
func (*EPaper) Init ¶
func (e *EPaper) Init()
Init initializes the display config. It should be only used when you put the device to sleep and need to re-init the device.
func (*EPaper) PrintDisplay ¶
func (e *EPaper) PrintDisplay()
PrintDisplay updates the screen with the contents of EPaper.Display.
func (*EPaper) Reset ¶
func (e *EPaper) Reset()
Reset clear the display (it can also awaken the device).
func (*EPaper) Rotate ¶
Rotate will rotate the image 90 degrees clockwise. Use it before calling convert, because convert will insert the image in the display representation matrix.
func (*EPaper) Sleep ¶
func (e *EPaper) Sleep()
Sleep put the display in power-saving mode. You can use Reset() to awaken and Init() to re-initialize the display.
func (*EPaper) Write ¶
Write is used to prepare text to be printed on the display. It turns a string in an image, then calls the returned value as a parameter of Convert(), and later, call Display().
func (*EPaper) WriteRotate ¶
func (e *EPaper) WriteRotate(text string, fontSize float64, fontFile string, rotate bool) image.Image
WriteRotate is used to prepare text to be printed on the display. It turns a string in an image, then calls the returned value as a parameter of Convert(), and later, call Display(). If rotate is TRUE, the text will be rotate 90 degree clockwise.