pcf8523

package
v0.0.0-...-0087ba1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package pcf8523 implements a driver for the PCF8523 CMOS Real-Time Clock (RTC)

Datasheet: https://www.nxp.com/docs/en/data-sheet/PCF8523.pdf

Index

Constants

View Source
const DefaultAddress = 0x68

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint8
	// contains filtered or unexported fields
}

func New

func New(i2c drivers.I2C) Device

func (*Device) ReadTime

func (d *Device) ReadTime() (time.Time, error)

ReadTime returns the date and time

func (*Device) Reset

func (d *Device) Reset() (err error)

Reset resets the device according to the datasheet section 8.3 This does not wipe the time registers, but resets control registers.

func (*Device) SetPowerManagement

func (d *Device) SetPowerManagement(b PowerManagement) error

SetPowerManagement configures how the device makes use of the backup battery, see datasheet section 8.5

func (*Device) SetTime

func (d *Device) SetTime(t time.Time) error

SetTime sets the time and date

type PowerManagement

type PowerManagement byte

datasheet 8.5 Power management functions, table 11

const (
	PowerManagement_SwitchOver_ModeStandard_LowDetection PowerManagement = 0b000
	PowerManagement_SwitchOver_ModeDirect_LowDetection   PowerManagement = 0b001
	PowerManagement_VddOnly_LowDetection                 PowerManagement = 0b010
	PowerManagement_SwitchOver_ModeStandard              PowerManagement = 0b100
	PowerManagement_SwitchOver_ModeDirect                PowerManagement = 0b101
	PowerManagement_VddOnly                              PowerManagement = 0b101
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL