Skip to content

Commit

Permalink
Merge pull request #2 from brainelectronics/bugfix/docs-and-usage-fixes
Browse files Browse the repository at this point in the history
docs and usage fixes
  • Loading branch information
brainelectronics authored Jun 12, 2023
2 parents 7dfc8ce + 48c9aec commit 0b92b90
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ jobs:
--setup_file setup.py \
--package_changelog_file changelog.md \
--package_file package.json \
--validate
--validate \
--ignore-version
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Connect the MicroPython device to a network (if possible)
```python
import network
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect('SSID', 'PASSWORD')
station.isconnected()
```
Expand Down Expand Up @@ -160,17 +161,18 @@ cp examples/boot.py /pyboard
## Usage

```python
from eeprom import DS1307
from ds1307 import DS1307
from machine import I2C, Pin
from time import gmtime
from time import gmtime, time

I2C_ADDR = 0x68
# DS1307 on 0x68
I2C_ADDR = 0x68 # DEC 104, HEX 0x68

# define custom I2C interface, default is 'I2C(0)'
# check the docs of your device for further details and pin infos
# this are the pins for the Raspberry Pi Pico adapter board
i2c = I2C(0, scl=Pin(13), sda=Pin(12), freq=800000)
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c) # DS1307 on 0x68
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c)

# get the current RTC time
print("Current RTC time: {}".format(ds1307.datetime))
Expand Down
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
-->

## Released
## [0.1.1] - 2023-06-12
### Fixed
- Usage documentation with more comments and WiFi instructions in root README
- Ignore version of `package.json` file in test workflow

## [0.1.0] - 2023-05-01
### Added
- `ds1307.py` in `ds1307` module
Expand All @@ -29,6 +34,7 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
- Not used files provided with [template repo](https://github.com/brainelectronics/micropython-i2c-lcd)

<!-- Links -->
[Unreleased]: https://github.com/brainelectronics/micropython-ds1307/compare/0.1.0...main
[Unreleased]: https://github.com/brainelectronics/micropython-ds1307/compare/0.1.1...main

[0.1.1]: https://github.com/brainelectronics/micropython-ds1307/tree/0.1.1
[0.1.0]: https://github.com/brainelectronics/micropython-ds1307/tree/0.1.0
7 changes: 4 additions & 3 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ An example of all implemented functionalities can be found at the
## Setup DS1307

```python
from eeprom import DS1307
from ds1307 import DS1307
from machine import I2C, Pin

I2C_ADDR = 0x68
# DS1307 on 0x68
I2C_ADDR = 0x68 # DEC 104, HEX 0x68

# define custom I2C interface, default is 'I2C(0)'
# check the docs of your device for further details and pin infos
# this are the pins for the Raspberry Pi Pico adapter board
i2c = I2C(0, scl=Pin(13), sda=Pin(12), freq=800000)
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c) # DS1307 on 0x68
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c)

# get LCD infos/properties
print("DS1307 is on I2C address 0x{0:02x}".format(ds1307.addr))
Expand Down
9 changes: 5 additions & 4 deletions examples/main.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

"""I2C EEPROM showcase"""
"""I2C DS1307 showcase"""

from eeprom import DS1307
from ds1307 import DS1307
from machine import I2C, Pin
from time import gmtime, sleep, time

I2C_ADDR = 0x68
# DS1307 on 0x68
I2C_ADDR = 0x68 # DEC 104, HEX 0x68

# define custom I2C interface, default is 'I2C(0)'
# check the docs of your device for further details and pin infos
# this are the pins for the Raspberry Pi Pico adapter board
i2c = I2C(0, scl=Pin(13), sda=Pin(12), freq=800000)
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c) # DS1307 on 0x68
ds1307 = DS1307(addr=I2C_ADDR, i2c=i2c)

# get LCD infos/properties
print("DS1307 is on I2C address 0x{0:02x}".format(ds1307.addr))
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ flake8>=5.0.0,<6
coverage>=6.4.2,<7
nose2>=0.12.0,<1
yamllint>=1.29,<2
setup2upypackage>=0.1.0,<1
setup2upypackage>=0.2.0,<1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
setup(
name='micropython-ds1307',
version=__version__,
description=" MicroPython driver for DS1307 RTC ",
description="MicroPython driver for DS1307 RTC",
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/brainelectronics/micropython-ds1307',
Expand Down

0 comments on commit 0b92b90

Please sign in to comment.