Documentation ¶
Index ¶
- Constants
- type Device
- func (d *Device) AlarmTriggered() bool
- func (d *Device) ClearAlarm() error
- func (d *Device) ClearTimer() error
- func (d *Device) DisableAlarmInterrupt() error
- func (d *Device) DisableTimerInterrupt() error
- func (d *Device) EnableAlarmInterrupt() error
- func (d *Device) EnableTimerInterrupt() error
- func (d *Device) ReadTime() (time.Time, error)
- func (d *Device) Reset() (err error)
- func (d *Device) SetAlarm(t time.Time) error
- func (d *Device) SetOscillatorFrequency(sqw uint8) error
- func (d *Device) SetTime(t time.Time) error
- func (d *Device) SetTimer(dur time.Duration) error
- func (d *Device) TimerTriggered() bool
Constants ¶
const ( PCF8563_ADDR = 0x51 // R:A3 W:A2 I2C_SPEED_STANDARD = 100000 I2C_SPEED_DOUBLE = 200000 RTC_CTRL_STOP = 0x20 RTC_CTRL_TITP = 0x10 RTC_CTRL_AF = 0x08 RTC_CTRL_TF = 0x04 RTC_CTRL_AIE = 0x02 RTC_CTRL_TIE = 0x01 RTC_COT_DISABLE = 0x00 RTC_COT_32KHZ = 0x80 RTC_COT_1KHZ = 0x81 RTC_COT_32HZ = 0x82 RTC_COT_1HZ = 0x83 RTC_TIMER_DISABLE = 0x00 RTC_TIMER_4KHZ = 0x80 RTC_TIMER_64HZ = 0x81 RTC_TIMER_1S = 0x82 RTC_TIMER_60S = 0x83 RTC_ALARM_DISABLE = 0x80 RTC_ALARM_ENABLE = 0x00 )
Registers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Address uint16 // contains filtered or unexported fields }
Device wraps an I2C connection to a PCF8563 device.
func (*Device) AlarmTriggered ¶
AlarmTriggered returns whether or not an Alarm has been triggered.
func (*Device) DisableAlarmInterrupt ¶
DisableAlarmInterrupt disable alarm interrupt.
func (*Device) DisableTimerInterrupt ¶
DisableTimerInterrupt disable timer interrupt.
func (*Device) EnableAlarmInterrupt ¶
EnableAlarmInterrupt enables alarm interrupt. When triggered, INT pin (3) goes low.
func (*Device) EnableTimerInterrupt ¶
EnableTimerInterrupt enables timer interrupt. When triggered, INT pin (3) goes low.
func (*Device) Reset ¶
Reset resets the `control and status registers`. When this method is called, it writes `0x00` to the `control and status registers`. This will cause `Alarm` and `Timer` to become Inactive. Please refer to the datasheet for details.
func (*Device) SetOscillatorFrequency ¶
SetOscillatorFrequency sets output oscillator frequency Available modes: RTC_COT_DISABLE, RTC_COT_32KHZ, RTC_COT_1KHZ, RTC_COT_32Hz, RTC_COT_1HZ.
func (*Device) SetTimer ¶
SetTimer sets timer. The available durations are 1 to 127 seconds. If any other value is specified, it will be truncated.
func (*Device) TimerTriggered ¶
TimerTriggered returns whether or not an Alarm has been triggered.