883 | | }}} |
884 | | * Manually writing to GSC (if you don't have the GSC driver) |
885 | | The following example will sleep the board for 10 seconds by setting the “add timer” to 10 seconds (from the current time) and then putting the board to sleep. This example uses the Linux I2C utilities. |
886 | | {{{ |
887 | | #!bash |
888 | | SECS=300 ;# 5 mins |
889 | | i2cset -f -y 0 0x20 6 $((SECS % 256)); SECS=$((SECS >> 8)) |
890 | | i2cset -f -y 0 0x20 7 $((SECS % 256)); SECS=$((SECS >> 8)) |
891 | | i2cset -f -y 0 0x20 8 $((SECS % 256)); SECS=$((SECS >> 8)) |
892 | | i2cset -f -y 0 0x20 9 $((SECS % 256)) |
893 | | # set add time bit - taking care to not disturb other bits |
894 | | R1=$(i2cget -f -y 0 0x20 1) && \ |
895 | | R1=$((R1 | 0x04)) && \ |
896 | | i2cset -f -y 0 0x20 1 $R1 || echo i2c error |
897 | | # set sleep enable and sleep activate bits - taking care not to disturb other bits |
898 | | R1=$(i2cget -f -y 0 0x20 1) && \ |
899 | | R1=$((R1 | 0x03)) && \ |
900 | | i2cset -f -y 0 0x20 1 $R1 || echo i2c error |