Initial fork + minor fixes for BMP085 (mBar output) + shell scripts for ADS1115 and...
[i2c-telemetry.git] / sethwclock
1 #!/bin/sh
2
3 I2CBUS=0
4 I2CADDR=0x68
5
6 if [ "$1" == "" ]
7 then
8   date=`date -u +%Y%m%d%H%M%S`
9 else
10   date=$1
11 fi
12
13 year=${date:2:2}
14 month=${date:4:2}
15 day=${date:6:2}
16
17 hour=${date:8:2}
18 min=${date:10:2}
19 sec=${date:12:2}
20
21 i2cset -y $I2CBUS $I2CADDR 0 0x$sec
22 i2cset -y $I2CBUS $I2CADDR 1 0x$min
23 i2cset -y $I2CBUS $I2CADDR 2 0x$hour
24 i2cset -y $I2CBUS $I2CADDR 4 0x$day
25 i2cset -y $I2CBUS $I2CADDR 5 0x$month
26 i2cset -y $I2CBUS $I2CADDR 6 0x$year