tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/pcf8563/clkout/main.go (about) 1 package main 2 3 import ( 4 "machine" 5 "time" 6 7 "tinygo.org/x/drivers/pcf8563" 8 ) 9 10 var ( 11 i2c = machine.I2C0 12 rtc = pcf8563.New(i2c) 13 ) 14 15 func main() { 16 i2c.Configure(machine.I2CConfig{Frequency: machine.TWI_FREQ_400KHZ}) 17 rtc.Reset() 18 19 for { 20 rtc.SetOscillatorFrequency(pcf8563.RTC_COT_1HZ) 21 time.Sleep(3 * time.Second) 22 rtc.SetOscillatorFrequency(pcf8563.RTC_COT_32HZ) 23 time.Sleep(3 * time.Second) 24 rtc.SetOscillatorFrequency(pcf8563.RTC_COT_1KHZ) 25 time.Sleep(3 * time.Second) 26 rtc.SetOscillatorFrequency(pcf8563.RTC_COT_32KHZ) 27 time.Sleep(3 * time.Second) 28 rtc.SetOscillatorFrequency(pcf8563.RTC_COT_DISABLE) 29 time.Sleep(3 * time.Second) 30 } 31 }