-`date/day`: 01-31 or 1-7 (Sunday = 1, Saturday = 7)
####Returns
####Returns
nil
`nil`
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once
ds3231=require("ds3231")
ds3231=require("ds3231")
ds3231.init(3,4)
-- Setting PIN1 to triggers on interrupt when alarm triggers
-- Setting PIN1 to triggers on interrupt when alarm triggers
gpio.mode(1,gpio.INT)
gpio.mode(1,gpio.INT)
...
@@ -167,28 +140,26 @@ ds3231 = nil
...
@@ -167,28 +140,26 @@ ds3231 = nil
package.loaded["ds3231"]=nil
package.loaded["ds3231"]=nil
```
```
####See also
**-**[]()
<aid="ds3231_reloadAlarms"></a>
## reloadAlarms()
## reloadAlarms()
####Description
#### Description
Reload an already triggered alarm. Otherwise it will never be triggered again.
Reload an already triggered alarm. Otherwise it will never be triggered again.
There are two different alarms and they have to be reloaded both to let, even only one, to be triggered again. So there isn't a param to select which alarm to reload.
There are two different alarms and they have to be reloaded both to let, even only one, to be triggered again. So there isn't a param to select which alarm to reload.
####Syntax
####Syntax
reloadAlarms()
`ds3231.reloadAlarms()`
####Parameters
####Parameters
nil
None
####Returns
####Returns
nil
`nil`
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once
ds3231=require("ds3231")
ds3231=require("ds3231")
ds3231.init(3,4)
-- Setting PIN1 to triggers on interrupt when alarm triggers
-- Setting PIN1 to triggers on interrupt when alarm triggers
gpio.mode(1,gpio.INT)
gpio.mode(1,gpio.INT)
...
@@ -205,27 +176,25 @@ ds3231 = nil
...
@@ -205,27 +176,25 @@ ds3231 = nil
package.loaded["ds3231"]=nil
package.loaded["ds3231"]=nil
```
```
####See also
**-**[]()
<aid="ds3231_enableAlarm"></a>
## enableAlarm()
## enableAlarm()
####Description
#### Description
Enable an already setted alarm with the previous matching conditions. It reloads alarms internally.
Enable an already setted alarm with the previous matching conditions. It reloads alarms internally.
####Syntax
####Syntax
enableAlarm(alarmId)
`ds3231.enableAlarm(alarmId)`
####Parameters
####Parameters
alarmId: 1-2
`alarmId`: 1-2
####Returns
####Returns
nil
`nil`
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once
ds3231=require("ds3231")
ds3231=require("ds3231")
ds3231.init(3,4)
-- Trigger on x:20:15
-- Trigger on x:20:15
ds3231.setAlarm(1,ds3231.MINUTE,15,20)
ds3231.setAlarm(1,ds3231.MINUTE,15,20)
...
@@ -243,29 +212,29 @@ ds3231 = nil
...
@@ -243,29 +212,29 @@ ds3231 = nil
package.loaded["ds3231"]=nil
package.loaded["ds3231"]=nil
```
```
####See also
**-**[]()
<aid="ds3231_disableAlarm"></a>
## disableAlarm()
## disableAlarm()
####Description
#### Description
Disable an already setted alarm with the previous matching conditions.
Disable an already setted alarm with the previous matching conditions.
if _alarmId_ is not 1 or 2 it disables both alarms.
if _alarmId_ is not 1 or 2 it disables both alarms.
**Warning**: `disableAlarm()` prevent alarms to trigger interrupt over SQW pin but alarm itself will triggers at the matching conditions as it could be seen on _status byte_.
**Warning**: `disableAlarm()` prevent alarms to trigger interrupt over SQW pin but alarm itself will triggers at the matching conditions as it could be seen on _status byte_.
####Syntax
####Syntax
disableAlarm(alarmId)
`ds3231.disableAlarm(alarmId)`
####Parameters
####Parameters
alarmId: 0-2
`alarmId: 0-2`
####Returns
####Returns
nil
`nil`
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once
ds3231=require("ds3231")
ds3231=require("ds3231")
ds3231.init(3,4)
-- Trigger on x:20:15
-- Trigger on x:20:15
ds3231.setAlarm(1,ds3231.MINUTE,15,20)
ds3231.setAlarm(1,ds3231.MINUTE,15,20)
...
@@ -283,28 +252,26 @@ ds3231 = nil
...
@@ -283,28 +252,26 @@ ds3231 = nil
package.loaded["ds3231"]=nil
package.loaded["ds3231"]=nil
```
```
####See also
**-**[]()
<aid="ds3231_getBytes"></a>
## getBytes()
## getBytes()
####Description
#### Description
Get bytes of control, for debug purpose, and status of DS3231. To see what they means check the [Datasheet](http://datasheets.maximintegrated.com/en/ds/DS3231.pdf)
Get bytes of control, for debug purpose, and status of DS3231. To see what they means check the [Datasheet](http://datasheets.maximintegrated.com/en/ds/DS3231.pdf)
####Syntax
####Syntax
getBytes()
`ds3231.getBytes()`
####Parameters
####Parameters
nil
None
####Returns
####Returns
control: integer. Control 0-255
-`control`: integer. Control 0-255
status: integer. Status 0-143 (bit 6-5-4 unused)
-`status`: integer. Status 0-143 (bit 6-5-4 unused)
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once
ds3231=require("ds3231")
ds3231=require("ds3231")
ds3231.init(3,4)
control,status=ds3231.getBytes()
control,status=ds3231.getBytes()
print('Control byte: '..control)
print('Control byte: '..control)
...
@@ -315,29 +282,27 @@ ds3231 = nil
...
@@ -315,29 +282,27 @@ ds3231 = nil
package.loaded["ds3231"]=nil
package.loaded["ds3231"]=nil
```
```
####See also
**-**[]()
<aid="ds3231_resetStopFlag"></a>
## resetStopFlag()
## resetStopFlag()
####Description
Stop flag on status byte means that the oscillator either is stopped or was stopped for some period and may be used to judge the validity of the timekeeping data.
#### Description
When setted to 1 this flag keeps that values until changed to 0.
Stop flag on status byte means that the oscillator either is stopped or was stopped for some period and may be used to judge the validity of the timekeeping data. When set to 1 this flag keeps that values until changed to 0.
Call `resetStopFlag()` if you need to check validity of time data after that.
Call `resetStopFlag()` if you need to check validity of time data after that.
####Syntax
####Syntax
resetStopFlag()
`ds3231.resetStopFlag()`
####Parameters
####Parameters
nil
None
####Returns
####Returns
nil
`nil`
####Example
####Example
```lua
```lua
i2c.setup(3,4,scl,i2c.SLOW)-- call i2c.setup() only once