Device::Chip::PCF8563 - chip driver for a PCF8563
use Device::Chip::PCF8563; use Future::AsyncAwait; use POSIX qw( mktime strftime ); my $chip = Device::Chip::PCF8563->new; await $chip->mount( Device::Chip::Adapter::...->new ); printf "The current time on this chip is ", await strftime( "%Y-%m-%d %H:%M:%S", localtime mktime $chip->read_time );
This Device::Chip subclass provides specific communication to a NXP PCF8563 chip attached to a computer via an I²C adapter.
The following methods documented in an
await expression return Future instances.
@tm = await $chip->read_time;
Returns a 7-element
struct tm-compatible list of values by reading the timekeeping registers, suitable for passing to
POSIX::mktime, etc... Note that the returned list does not contain the
Because the PCF8563 only stores a 2-digit year number plus a single century bit, the year is presumed to be in the range
This method presumes
POSIX-compatible semantics for the
wday field stored on the chip; i.e. that 0 is Sunday.
This method performs an atomic reading of all the timekeeping registers as a single I²C transaction, so is preferrable to invoking multiple calls to individual read methods.
await $chip->write_time( @tm );
Writes the timekeeping registers from a 7-element
struct tm-compatible list of values. This method ignores the
is_dst fields, if present.
Because the PCF8563 only stores a 2-digit year number and a century bit, the year must be in the range
2199 (i.e. numerical values of
This method performs an atomic writing of all the timekeeping registers as a single I²C transaction, so is preferrable to invoking multiple calls to individual write methods.
Paul Evans <firstname.lastname@example.org>