Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Jun 1, 2021
2 parents d8e3104 + 525dfc9 commit 38c6d63
Show file tree
Hide file tree
Showing 56 changed files with 3,535 additions and 77 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

custom: ['paypal.me/tilz0R']
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
See the CHANGELOG.md
draft: false
prerelease: false
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Changelog

## v3.0.2

- Update CMSIS OS driver to support FreeRTOS aware kernel

## v3.0.1

- Change configuration options from _CONFIG_ to _OPT
- Apply code style settings with Artistic style options
- Update docs

## v3.0.0

- Break compatibility vs `2.0.0`
- New name of library is now LwOW - Lightweight onewire
- Added `_ex` functions to read/write bytes or bits
- Added drivers features as set of callback functions with drv pointer
- Rename private functions to `prv_` prefix

## v2.0.0

- LL drivers are now passed as custom structure to allow multiple blocks as separate drivers
- Added first sphinx documentation
- Updated examples

## v1.2.0

- Automatically set result to OK when search function finds at least 1 connected device
- Upgrade examples to CMSIS OS V2
- Use pre-increment/decrement
- Other C code style fixes

## v1.1.0

- Added assert for all API functions
- Added new owPARERR enumerator for wrong parameters
- Added `ow_deinit` function implementation

## v1.0.0

- Use separate ROM structure instead of byte array
- Add option to search devices with command and save result directly to input array
- Make all variables as local instead of using user pointers

## v0.2.0

- Removed `protect` parameter in API functions
- Added `_raw` functions to provide non-thread-safe implementation for operating systems
- Separate API functions with operating system protection

## v0.1.0

- Support for UART interface instead of software emulation on microcontroller or PC application
- Support for operating systems (including non-real-time)
- Added API driver for *DS18x20* temperature sensor
2 changes: 1 addition & 1 deletion dev/VisualStudio/lwow_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of OneWire library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v3.0.1
* Version: v3.0.2
*/
#ifndef LWOW_HDR_OPTS_H
#define LWOW_HDR_OPTS_H
Expand Down
29 changes: 17 additions & 12 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,32 @@
copyright = '2020, Tilen MAJERLE'
author = 'Tilen MAJERLE'

# The full version, including alpha/beta/rc tags
version = '3.0.1'

# Try to get branch at which this is running
# and try to determine which version to display in sphinx
# Version is using git tag if on master or "latest-develop" if on develop branch
version = ''
git_branch = ''

# Get current branch
res = os.popen('git branch').read().strip()
for line in res.split("\n"):
if line[0] == '*':
git_branch = line[1:].strip()

# Decision for display version
try:
if git_branch.index('develop') >= 0:
version = "latest-develop"
except Exception:
print("Exception for index check")

# For debugging purpose
git_branch = git_branch.replace('(HEAD detached at ', '').replace(')', '')
if git_branch.find('master') >= 0 or git_branch.find('main') >= 0:
version = os.popen('git describe --tags --abbrev=0').read().strip()
if version == '':
version = 'v0.0.0'
elif git_branch.find('develop') != -1 and not (git_branch.find('develop-') >= 0 or git_branch.find('develop/') >= 0):
version = 'latest-develop'
else:
version = 'branch-' + git_branch

# For debugging purpose only
print("GIT BRANCH: " + git_branch)
print("VERSION: " + version)
print("GIT VERSION: " + version)

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -112,7 +117,7 @@
'css/custom.css',
]
html_js_files = [
'https://kit.fontawesome.com/3102794088.js'
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css'
]

master_doc = 'index'
Expand Down
45 changes: 30 additions & 15 deletions docs/get-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
Getting started
===============

Getting started may be the most challenging part of every new library.
This guide is describing how to start with the library quickly and effectively

.. _download_library:

Download library
^^^^^^^^^^^^^^^^

Library is primarly hosted on `Github <https://github.com/MaJerle/lwow>`_.

* Download latest release from `releases area <https://github.com/MaJerle/lwow/releases>`_ on Github
* Clone `develop` branch for latest development
You can get it with:

* Downloading latest release from `releases area <https://github.com/MaJerle/lwow/releases>`_ on Github
* Cloning ``master`` branch for latest stable version
* Cloning ``develop`` branch for latest development

Download from releases
**********************
Expand All @@ -24,7 +30,9 @@ Clone from Github
First-time clone
""""""""""""""""

* Download and install ``git`` if not already
This is used when you do not have yet local copy on your machine.

* Make sure ``git`` is installed.
* Open console and navigate to path in the system to clone repository to. Use command ``cd your_path``
* Clone repository with one of available ``3`` options

Expand All @@ -38,40 +46,47 @@ Update cloned to latest version
"""""""""""""""""""""""""""""""

* Open console and navigate to path in the system where your resources repository is. Use command ``cd your_path``
* Run ``git pull origin master --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules
* Run ``git pull origin master --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules on ``master`` branch
* Run ``git pull origin develop --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules on ``develop`` branch
* Run ``git submodule foreach git pull origin master`` to update & merge all submodules

.. note::
This is preferred option to use when you want to evaluate library and run prepared examples.
Repository consists of multiple submodules which can be automatically downloaded when cloning and pulling changes from root repository.
This is preferred option to use when you want to evaluate library and run prepared examples.
Repository consists of multiple submodules which can be automatically downloaded when cloning and pulling changes from root repository.

Add library to project
^^^^^^^^^^^^^^^^^^^^^^

At this point it is assumed that you have successfully download library, either cloned it or from releases page.
Next step is to add the library to the project, by means of source files to compiler inputs and header files in search path

* Copy ``lwow`` folder to your project
* Add ``lwow/src/include`` folder to `include path` of your toolchain
* Add source files from ``lwow/src/`` folder to toolchain build
* Copy ``lwow`` folder to your project, it contains library files
* Add ``lwow/src/include`` folder to `include path` of your toolchain. This is where `C/C++` compiler can find the files during compilation process. Usually using ``-I`` flag
* Add source files from ``lwow/src/`` folder to toolchain build. These files are built by `C/C++` compiler
* Copy ``lwow/src/include/lwow/lwow_opts_template.h`` to project folder and rename it to ``lwow_opts.h``
* Implement device drivers for UART hardware
* Build the project

Configuration file
^^^^^^^^^^^^^^^^^^

Configuration file is used to overwrite default settings defined for the essential use case.
Library comes with template config file, which can be modified according to needs.
This file shall be named ``lwow_opts.h`` and its default template looks like the one below.
and it should be copied (or simply renamed in-place) and named ``lwow_opts.h``

.. note::
Default configuration template file location: ``lwow/src/include/lwow/lwow_opts_template.h``.
File must be renamed to ``lwow_opts.h`` first and then copied to the project directory (or simply renamed in-place) where compiler
File must be renamed to ``lwow_opts.h`` first and then copied to the project directory where compiler
include paths have access to it by using ``#include "lwow_opts.h"``.

.. tip::
Check :ref:`api_lwow_opt` section for possible configuration settings
List of configuration options are available in the :ref:`api_lwow_opt` section.
If any option is about to be modified, it should be done in configuration file

.. literalinclude:: ../../lwow/src/include/lwow/lwow_opts_template.h
:language: c
:linenos:
:caption: Config template file
:caption: Template configuration file

.. note::
If you prefer to avoid using configuration file, application must define
a global symbol ``LWOW_IGNORE_USER_OPTS``, visible across entire application.
This can be achieved with ``-D`` compiler option.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Its primary focus is UART hardware for physical communication for sensors and ot
.. rst-class:: center
.. rst-class:: index_links

:ref:`download_library` :ref:`getting_started` `Open Github <https://github.com/MaJerle/lwow>`_
:ref:`download_library` :ref:`getting_started` `Open Github <https://github.com/MaJerle/lwow>`_ `Donate <https://paypal.me/tilz0R>`_

Features
^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
breathe>=4.9.1
colorama
docutils>=0.14
sphinx>=2.0.1
docutils==0.16
sphinx>=3.5.1
sphinx_rtd_theme
sphinx-tabs
sphinxcontrib-svg2pdfconverter
Expand Down
1 change: 0 additions & 1 deletion docs/static/images/logo

This file was deleted.

1 change: 1 addition & 0 deletions docs/static/images/logo.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2020-12-05T00:15:00.957Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.3.2 Chrome/78.0.3904.113 Electron/7.1.2 Safari/537.36" etag="jMeqaFJTr0wvlWGl624g" version="12.3.2" type="device" pages="1"><diagram id="FREXYNdFMBb21ydttZkC" name="Page-1">jZLLboMwEEW/xstIgANNl02aPtRWXWSRqDsHT7AVg5HjFOjX19RjCIoiVfLCc2bGj3uH0FXZPhtWiw/NQZEk4i2hjyRJsiQh/Yp450GaUg8KI7lH8Qg28gcQRkjPksNpUmi1VlbWU5jrqoLcThgzRjfTsoNW01trVsAV2ORMXdOt5FZ4ukijkb+ALES4OY4wU7JQjOAkGNfNBaJrQldGa+t3ZbsC1WsXdPF9Tzeyw8MMVPY/DXz/8PU2n5ldd3e/Wyxnx/3ydYanfDN1xg+/N59bfLDtggpGnysO/UExoctGSAubmuV9tnG2OyZsqTB9skYfB7UyRw66smgt7eNBisgF+AIwFtqbX4sHwdyggS7Bms6VYAOdp74FhywJcTNaFmfog7iwK9jIcEqK4ehRSLdBLUM4evaXuxh8uv4F</diagram></mxfile>
2 changes: 1 addition & 1 deletion docs/static/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwOW.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v3.0.1
* Version: v3.0.2
*/
#ifndef LWOW_HDR_OPTS_H
#define LWOW_HDR_OPTS_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,15 @@ const osThreadAttr_t lwow_task_attributes = {

/* Custom structure for link between onewire and uarts */
typedef struct {
lwow_t ow;
uint8_t id;
lwow_t* ow;
UART_HandleTypeDef* uart;
} ow_uart_link_t;

/* OneWire instances */
lwow_t ow1, ow2, ow3;

/* Make links between ow and uart */
static ow_uart_link_t ow_uart_link_1 = { .id = 1, .ow = &ow1, .uart = &huart1 };
static ow_uart_link_t ow_uart_link_2 = { .id = 2, .ow = &ow2, .uart = &huart2 };
static ow_uart_link_t ow_uart_link_3 = { .id = 3, .ow = &ow3, .uart = &huart6 };
static ow_uart_link_t ow_uart_link_1 = { .id = 1, .uart = &huart1 };
static ow_uart_link_t ow_uart_link_2 = { .id = 2, .uart = &huart2 };
static ow_uart_link_t ow_uart_link_3 = { .id = 3, .uart = &huart6 };

/* Use extern low-level for OW using HAL */
extern const lwow_ll_drv_t lwow_ll_drv_stm32_hal;
Expand Down Expand Up @@ -474,14 +471,14 @@ void start_lwow_task(void *argument)
}

/* Initialize OW instance */
res = lwow_init(link->ow, &lwow_ll_drv_stm32_hal, link->uart);
res = lwow_init(&link->ow, &lwow_ll_drv_stm32_hal, link->uart);

/* Initialize OW with UART instance as custom parameter */
safeprintf("[OW %d] Init OW: %d\r\n", (int)link->id, (int)res);

/* Scan device procedure */
do {
if (scan_onewire_devices(link->ow, rom_ids, ROM_IDS_SIZE, &rom_found) == lwowOK) {
if (scan_onewire_devices(&link->ow, rom_ids, ROM_IDS_SIZE, &rom_found) == lwowOK) {
safeprintf("[OW %d] Devices scanned, found %d devices!\r\n", (int)link->id, (int)rom_found);
} else {
safeprintf("[OW %d] Device scan error\r\n", (int)link->id);
Expand Down
Loading

0 comments on commit 38c6d63

Please sign in to comment.