Revision 1304b12b
| README.txt | ||
|---|---|---|
| 93 | 93 |
The files are structured as follows: |
| 94 | 94 |
./ |
| 95 | 95 |
│ The project root directory contains this file, a license.html file as well as |
| 96 |
│ a Makefile that allows to easily integrate the project. Furthermore, two
|
|
| 96 |
│ a makefile that allows to easily integrate the project. Furthermore, two
|
|
| 97 | 97 |
│ interface headers are provided: amiro-lld.h and periphALtypes.h. These are |
| 98 | 98 |
│ entry points for any utilizing superproject, so it is not required (and not |
| 99 | 99 |
│ recommended) to include each driver individually. |
| 100 | 100 |
│ |
| 101 |
├── include/ |
|
| 101 |
├── docs/ |
|
| 102 |
│ UML graphs (using PlantUML; see plantuml.com for further information) |
|
| 103 |
│ visualize the structure of the AMiRo-LLD project. Doxygen related files |
|
| 104 |
│ can be used to gererate a documentation of the whole project (wip). |
|
| 105 |
│ |
|
| 106 |
├── drivers/ |
|
| 102 | 107 |
│ For each supported hardware device, there is exactly one directory in this |
| 103 | 108 |
│ folder. Further subfolders may contain various versions of a driver (e.g. |
| 104 | 109 |
│ 'v1/', 'v2/', etc.). By convention the root directory of a driver is named |
| ... | ... | |
| 107 | 112 |
│ <product_name> is a placeholder for the exact name of the according |
| 108 | 113 |
│ hardware, or the product familiy, if the driver is compatible with all |
| 109 | 114 |
│ parts. |
| 110 |
│ The root header consequently follows the naming scheme |
|
| 111 |
│ "alld_<product_name>.h" |
|
| 112 |
│ and header files within the version folders shall be named like |
|
| 113 |
│ "alld<product_name>_<driver_version>.h" |
|
| 114 |
│ |
|
| 115 |
├── source/ |
|
| 116 |
│ Any source files are placed in this directory. Naming conventions for |
|
| 117 |
│ folders and files are the same as described before for the include |
|
| 118 |
│ directory, as is the file structure. There is a dedicated folder for each |
|
| 119 |
│ device and further subfolders for multiple driver versions. Source files |
|
| 120 |
│ should only be put in these version folders. |
|
| 115 |
│ Each driver must provide a makefile script, which adds the required |
|
| 116 |
│ include folders to the AMIROLLD_INC variable and all C source files to the |
|
| 117 |
│ AMIROLLD_CSRC variable. |
|
| 121 | 118 |
│ |
| 122 | 119 |
└── templates/ |
| 123 |
AMiRo-LLD requires an implementation of the defined interface and an
|
|
| 124 |
configuration header to be accessible in the include paths at compile
|
|
| 125 |
time. Template files for both can be found in this folder. It is
|
|
| 126 |
recommended to place according implementations of these templated not in
|
|
| 127 |
the AMiRo-LLD project, but the superproject which includes AMiRo-LLD.
|
|
| 120 |
AMiRo-LLD expects a configuration header "alldconf.h" to be found in the
|
|
| 121 |
include paths. An according template for such file can be found here.
|
|
| 122 |
There is no template for an implementation of periphAL, though. The
|
|
| 123 |
provided interface header in the root directory (periphAL.h) should give
|
|
| 124 |
you all required information for such an implementation anyway.
|
|
| 128 | 125 |
|
| 129 | 126 |
|
| 130 | 127 |
|
| ... | ... | |
| 137 | 134 |
descriptions of the guides provide additional information about the underlying |
| 138 | 135 |
concepts and mechanisms, a short summary is provided at the end of each chapter. |
| 139 | 136 |
|
| 137 |
|
|
| 140 | 138 |
3.1 Adding a Device |
| 141 | 139 |
-------------------- |
| 142 | 140 |
|
| 143 | 141 |
When adding new device to the project, the very first step is to create the |
| 144 |
according folders in the include/ and source/ directories. For this guide, we |
|
| 145 |
will add the fictional DEVICE1234. For this example the folders to be created |
|
| 146 |
are "include/DEVICE1234/" and "source/DEVICE1234/". |
|
| 147 |
|
|
| 148 |
The first file should be the root header: "include/DEVICE1234/alld_DEVICE1234.h" |
|
| 149 |
Have a look at existing drivers and use one of those as template. This header |
|
| 150 |
should introduce a new configuration to be set in the alldconf.h file and check |
|
| 151 |
it using the preprocessor. Eventually, another header is included, pointing to |
|
| 152 |
the selected driver version/implementation. |
|
| 153 |
|
|
| 154 |
Such implementations are to be put in further subfolders, e.g. |
|
| 155 |
"include/DEVICE1234/v1/" and "source/DEVICE1234/v1/". The header and C-source |
|
| 156 |
files in those folders do not follow a strict scheme, although there are some |
|
| 157 |
conventions to consider (i.e. naming conventions, cf. chapter 2). |
|
| 142 |
according folder in the drivers/ directory. For this guide, we will add the |
|
| 143 |
fictional DEVICE1234. For this example the folders to be created are |
|
| 144 |
"drivers/DEVICE1234/" and "drivers/DEVICE1234/v1/". In case there already exists |
|
| 145 |
a driver implementation for this device, but you want to implement another |
|
| 146 |
version from scratch (not just an update), the version subfolder must be named |
|
| 147 |
accordingly (e.g. "drivers/DEVICE1234/v42/"). |
|
| 148 |
|
|
| 149 |
Most drivers will consist of exactly three files: |
|
| 150 |
- alld_DEVICE1234.mk |
|
| 151 |
- alld_DEVICE1234.h |
|
| 152 |
- alld_DEVICE1234.c |
|
| 153 |
However, some drivers may feature multiple .h and/or .c files or even come with |
|
| 154 |
additional subfolders. In any case, all those required folders, including the |
|
| 155 |
driver root folder (i.e. "drivers/DEVICE1234/v1/"), as well as all C source |
|
| 156 |
files must be added to the according makefile variables AMIROLLD_INC and |
|
| 157 |
AMIROLLD_CSRC by the makefile script. |
|
| 158 |
It is highly recommended that files in the driver root directory (i.e. |
|
| 159 |
"drivers/DEVICE1234/v1/") use the prefix "alld_" in their names. This not only |
|
| 160 |
helps to achieve an easy to understand file structure, but also prevents |
|
| 161 |
compilation issues due to naming conflicts of header files. |
|
| 158 | 162 |
|
| 159 | 163 |
Summing up, you have to |
| 160 |
1) create device folders. |
|
| 161 |
2) add a root header.
|
|
| 162 |
3) add further subfolders and implement the driver there.
|
|
| 164 |
1) create device and version folders.
|
|
| 165 |
2) add a makefile script.
|
|
| 166 |
3) add header- and source files as well as subfulders, implementing the diver
|
|
| 163 | 167 |
|
| 164 | 168 |
|
| 165 | 169 |
3.2 Implementing a Driver |
| 166 | 170 |
-------------------------- |
| 167 | 171 |
|
| 168 |
Implementation of a new driver usually is very straight-forward. You most
|
|
| 172 |
Implementation of a new driver usually is very straightforward. You most |
|
| 169 | 173 |
probably have a comprehensive datasheet of the device, or the manufacturer even |
| 170 | 174 |
provides a reference driver implementation. |
| 171 | 175 |
|
| 172 | 176 |
For the former case, you should first write a comprehensive header, containing |
| 173 | 177 |
all information like constants, register maps, etc. and according abstract |
| 174 | 178 |
access functions (e.g. for reading and writing registers, and convenient access |
| 175 |
to common functionalities). Only the you implement those functions, using |
|
| 176 |
periphAL to interface any hardware interfaces (e.g. I2C, SPI, etc.). |
|
| 179 |
to common functionalities). Only then you implement those functions, using |
|
| 180 |
periphAL to interface any hardware interfaces (e.g. I2C, SPI, etc.) in a |
|
| 181 |
separate C source file, or 'inline' in the header file itself. |
|
| 177 | 182 |
|
| 178 | 183 |
For the latter case, the reference implementation will specify some interface |
| 179 | 184 |
functions to interact with the hardware (e.g. I2C, SPI etc.). Even though all |
| 180 | 185 |
functionality should be covered by the reference driver, you still need to |
| 181 |
implement those interface functions. |
|
| 186 |
implement those interface functions and map them to periphAL.
|
|
| 182 | 187 |
|
| 183 | 188 |
Since AMiRo-LLD does not rely on specific hardware or operating system, the only |
| 184 | 189 |
valid way to interact with both is through periphAL. Under no circumstances you |
| 185 | 190 |
must use any function of your operating system and directly or indirectly access |
| 186 | 191 |
the hardware of your platform. For your driver, there is no knowledge about the |
| 187 | 192 |
world beyond periphAL! If periphAL does not provide the function you need, you |
| 188 |
can do the following: 1) Think again if you really need that funcionality or |
|
| 189 |
whether it can be replicated by existing functions. 2) File a feature request |
|
| 190 |
to extend periphAL. 3) Write a custom patch that modifies periphAL to meet your |
|
| 191 |
requirements. |
|
| 193 |
can do one of the following: |
|
| 194 |
1) Think again if you really need that funcionality or whether it can be |
|
| 195 |
replicated by the existing API. |
|
| 196 |
2) File a feature request to extend periphAL. |
|
| 197 |
3) Write a custom patch that modifies periphAL to meet your requirements. |
|
| 192 | 198 |
|
| 193 | 199 |
Summing up, you have to |
| 194 | 200 |
1) Get and read the datasheet of the device (A) or |
| amiro-lld.h | ||
|---|---|---|
| 24 | 24 |
*/ |
| 25 | 25 |
#define _AMIRO_LLD_ |
| 26 | 26 |
|
| 27 |
/*===========================================================================*/ |
|
| 27 | 28 |
/** |
| 28 | 29 |
* @name AMiRo-LLD version and relase information. |
| 29 | 30 |
* @{
|
| 30 | 31 |
*/ |
| 32 |
/*===========================================================================*/ |
|
| 31 | 33 |
|
| 32 | 34 |
/** |
| 33 | 35 |
* @brief Realease type of this version. |
| 34 | 36 |
* @note Possible values are "pre-alpha", "alpha", "beta", "release candidate", and "release". |
| 35 | 37 |
*/ |
| 36 |
#define AMIRO_LLD_RELEASE_TYPE "beta"
|
|
| 38 |
#define AMIROLLD_RELEASE_TYPE "beta"
|
|
| 37 | 39 |
|
| 38 | 40 |
/** |
| 39 | 41 |
* @brief The AMiRo-LLD major version. |
| 40 | 42 |
* @note Changes of the major version imply incompatibilities. |
| 41 | 43 |
*/ |
| 42 |
#define AMIRO_LLD_VERSION_MAJOR 1
|
|
| 44 |
#define AMIROLLD_VERSION_MAJOR 1
|
|
| 43 | 45 |
|
| 44 | 46 |
/** |
| 45 | 47 |
* @brief The AMiRo-LLD minor version. |
| 46 | 48 |
* @note A higher minor version implies new functionalty, but all old interfaces are still available. |
| 47 | 49 |
*/ |
| 48 |
#define AMIRO_LLD_VERSION_MINOR 0
|
|
| 50 |
#define AMIROLLD_VERSION_MINOR 1
|
|
| 49 | 51 |
|
| 50 | 52 |
/** |
| 51 | 53 |
* @brief The AMiRo-LLD patch level. |
| 52 | 54 |
*/ |
| 53 |
#define AMIRO_LLD_VERSION_PATCH 2 |
|
| 54 |
|
|
| 55 |
/** |
|
| 56 |
* @brief The periphery abstraction layer interface required major version. |
|
| 57 |
* @note Any other major version is assumed to be incompatible. |
|
| 58 |
*/ |
|
| 59 |
#define PERIPHAL_REQUIRED_MAJOR 1 |
|
| 60 |
|
|
| 61 |
/** |
|
| 62 |
* @brief The periphery abstraction layer interface required minor version. |
|
| 63 |
* @note Higher minor version values are assumed to be compatible, too. |
|
| 64 |
*/ |
|
| 65 |
#define PERIPHAL_REQUIRED_MINOR 1 |
|
| 55 |
#define AMIROLLD_VERSION_PATCH 0 |
|
| 66 | 56 |
|
| 67 | 57 |
/** @} */ |
| 68 | 58 |
|
| 59 |
/******************************************************************************/ |
|
| 60 |
/* CONFIGURATION & VERIFICATION */ |
|
| 61 |
/******************************************************************************/ |
|
| 62 |
|
|
| 69 | 63 |
#include <alldconf.h> |
| 64 |
|
|
| 70 | 65 |
#if !defined(_AMIRO_LLD_CFG_) |
| 71 |
#error "invalid AMiRo-LLD configuration file" |
|
| 72 |
#elif (AMIRO_LLD_CFG_VERSION_MAJOR != AMIRO_LLD_VERSION_MAJOR) || (AMIRO_LLD_CFG_VERSION_MINOR < AMIRO_LLD_VERSION_MINOR)
|
|
| 73 |
#error "incompatible AMiRo-LLD configuration file" |
|
| 66 |
#error "invalid AMiRo-LLD configuration file"
|
|
| 67 |
#elif (AMIRO_LLD_CFG_VERSION_MAJOR != AMIROLLD_VERSION_MAJOR) || (AMIRO_LLD_CFG_VERSION_MINOR < AMIROLLD_VERSION_MINOR)
|
|
| 68 |
#error "incompatible AMiRo-LLD configuration file"
|
|
| 74 | 69 |
#endif |
| 75 | 70 |
|
| 76 |
#include "periphALtypes.h" |
|
| 77 |
#include <periphAL.h> |
|
| 78 |
#if !defined(PERIPHAL_VERSION_MAJOR) || !defined(PERIPHAL_VERSION_MINOR) |
|
| 79 |
#error "invalid periphAL implementation" |
|
| 80 |
#elif (PERIPHAL_VERSION_MAJOR != PERIPHAL_REQUIRED_MAJOR) || (PERIPHAL_VERSION_MINOR < PERIPHAL_REQUIRED_MINOR) |
|
| 81 |
#error "incompatible periphAL implementation" |
|
| 71 |
#if !defined(AMIROLLD_CFG_TIME_SIZE) |
|
| 72 |
#error "AMIROLLD_CFG_TIME_SIZE not defined in alldconf.h" |
|
| 73 |
#endif /* !defined(AMIROLLD_CFG_TIME_SIZE) */ |
|
| 74 |
|
|
| 75 |
#if !defined(AMIROLLD_CFG_DBG) |
|
| 76 |
#error "AMIROLLD_CFG_DBG not defined in alldconf.h" |
|
| 77 |
#endif /* !defined(AMIROLLD_CFG_DBG) */ |
|
| 78 |
|
|
| 79 |
#if !defined(AMIROLLD_CFG_GPIO) |
|
| 80 |
#error "AMIROLLD_CFG_GPIO not defined in alldconf.h" |
|
| 81 |
#endif /* !defined(AMIROLLD_CFG_GPIO) */ |
|
| 82 |
|
|
| 83 |
#if !defined(AMIROLLD_CFG_PWM) |
|
| 84 |
#error "AMIROLLD_CFG_PWM not defined in alldconf.h" |
|
| 85 |
#endif /* !defined(AMIROLLD_CFG_PWM) */ |
|
| 86 |
|
|
| 87 |
#if !defined(AMIROLLD_CFG_QEI) |
|
| 88 |
#error "AMIROLLD_CFG_QEI not defined in alldconf.h" |
|
| 89 |
#endif /* !defined(AMIROLLD_CFG_QEI) */ |
|
| 90 |
|
|
| 91 |
#if !defined(AMIROLLD_CFG_I2C) |
|
| 92 |
#error "AMIROLLD_CFG_I2C not defined in alldconf.h" |
|
| 93 |
#endif /* !defined(AMIROLLD_CFG_I2C) */ |
|
| 94 |
|
|
| 95 |
#if !defined(AMIROLLD_CFG_SPI) |
|
| 96 |
#error "AMIROLLD_CFG_SPI not defined in alldconf.h" |
|
| 97 |
#endif /* !defined(AMIROLLD_CFG_SPI) */ |
|
| 98 |
|
|
| 99 |
#if ((AMIROLLD_CFG_GPIO == true) || \ |
|
| 100 |
(AMIROLLD_CFG_PWM == true) || \ |
|
| 101 |
(AMIROLLD_CFG_QEI == true) || \ |
|
| 102 |
(AMIROLLD_CFG_I2C == true) || \ |
|
| 103 |
(AMIROLLD_CFG_SPI == true)) && \ |
|
| 104 |
!defined(AMIROLLD_CFG_PERIPHAL_HEADER) |
|
| 105 |
#error "AMIROLLD_CFG_PERIPHAL_HEADER required but not defined in alldconf.h" |
|
| 82 | 106 |
#endif |
| 83 | 107 |
|
| 108 |
/******************************************************************************/ |
|
| 109 |
/* PERIPHERY ABSTRACTION LAYER (periphAL) */ |
|
| 110 |
/******************************************************************************/ |
|
| 111 |
|
|
| 112 |
#if defined(AMIROLLD_CFG_PERIPHAL_HEADER) |
|
| 113 |
#include AMIROLLD_CFG_PERIPHAL_HEADER |
|
| 114 |
#endif |
|
| 115 |
|
|
| 116 |
#include <periphAL.h> |
|
| 117 |
|
|
| 84 | 118 |
#endif /* AMIROLLD_H */ |
| periphAL.h | ||
|---|---|---|
| 1 |
/* |
|
| 2 |
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform. |
|
| 3 |
Copyright (C) 2016..2019 Thomas Schöpping et al. |
|
| 4 |
|
|
| 5 |
This program is free software: you can redistribute it and/or modify |
|
| 6 |
it under the terms of the GNU Lesser General Public License as published by |
|
| 7 |
the Free Software Foundation, either version 3 of the License, or |
|
| 8 |
(at your option) any later version. |
|
| 9 |
|
|
| 10 |
This program is distributed in the hope that it will be useful, |
|
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 13 |
GNU Lesser General Public License for more details. |
|
| 14 |
|
|
| 15 |
You should have received a copy of the GNU Lesser General Public License |
|
| 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 17 |
*/ |
|
| 18 |
|
|
| 19 |
#ifndef AMIROLLD_PERIPHAL_H |
|
| 20 |
#define AMIROLLD_PERIPHAL_H |
|
| 21 |
|
|
| 22 |
#include <amiro-lld.h> |
|
| 23 |
|
|
| 24 |
/*============================================================================*/ |
|
| 25 |
/* VERSION */ |
|
| 26 |
/*============================================================================*/ |
|
| 27 |
|
|
| 28 |
/** |
|
| 29 |
* @brief The periphery abstraction layer interface major version. |
|
| 30 |
* @note Changes of the major version imply incompatibilities. |
|
| 31 |
*/ |
|
| 32 |
#define PERIPHAL_VERSION_MAJOR 1 |
|
| 33 |
|
|
| 34 |
/** |
|
| 35 |
* @brief The periphery abstraction layer interface minor version. |
|
| 36 |
* @note A higher minor version implies new functionalty, but all old interfaces are still available. |
|
| 37 |
*/ |
|
| 38 |
#define PERIPHAL_VERSION_MINOR 2 |
|
| 39 |
|
|
| 40 |
/*============================================================================*/ |
|
| 41 |
/* DEPENDENCIES */ |
|
| 42 |
/*============================================================================*/ |
|
| 43 |
|
|
| 44 |
#include <stdint.h> |
|
| 45 |
|
|
| 46 |
/*============================================================================*/ |
|
| 47 |
/* GENERAL */ |
|
| 48 |
/*============================================================================*/ |
|
| 49 |
|
|
| 50 |
/** |
|
| 51 |
* @brief Status values used as return value for all (or most) function calls. |
|
| 52 |
* @note The status can be used as mask of flags. |
|
| 53 |
*/ |
|
| 54 |
typedef int8_t apalExitStatus_t; |
|
| 55 |
|
|
| 56 |
/** |
|
| 57 |
* @brief Status value for success (no error or warning occurred). |
|
| 58 |
*/ |
|
| 59 |
#define APAL_STATUS_OK ((apalExitStatus_t)0) |
|
| 60 |
#define APAL_STATUS_SUCCESS ((apalExitStatus_t)0) |
|
| 61 |
|
|
| 62 |
/** |
|
| 63 |
* @brief Status value for unspecified failure. |
|
| 64 |
*/ |
|
| 65 |
#define APAL_STATUS_ERROR ((apalExitStatus_t)-1) |
|
| 66 |
#define APAL_STATUS_FAILURE ((apalExitStatus_t)-1) |
|
| 67 |
|
|
| 68 |
/** |
|
| 69 |
* @brief Status value for timeout failure. |
|
| 70 |
*/ |
|
| 71 |
#define APAL_STATUS_TIMEOUT ((apalExitStatus_t)-2) |
|
| 72 |
|
|
| 73 |
/** |
|
| 74 |
* @brief Status value for failure because of invalid arguments. |
|
| 75 |
*/ |
|
| 76 |
#define APAL_STATUS_INVALIDARGUMENTS ((apalExitStatus_t)-4) |
|
| 77 |
|
|
| 78 |
/** |
|
| 79 |
* @brief Status value for failure because the function is not available/implemented. |
|
| 80 |
*/ |
|
| 81 |
#define APAL_STATUS_UNAVAILABLE ((apalExitStatus_t)-8) |
|
| 82 |
|
|
| 83 |
/** |
|
| 84 |
* @brief Status value for unspecified warning. |
|
| 85 |
*/ |
|
| 86 |
#define APAL_STATUS_WARNING ((apalExitStatus_t)1) |
|
| 87 |
|
|
| 88 |
/*============================================================================*/ |
|
| 89 |
/* DEBUG */ |
|
| 90 |
/*============================================================================*/ |
|
| 91 |
|
|
| 92 |
#if (AMIROLLD_CFG_DBG == true) || defined(__DOXYGEN__) |
|
| 93 |
|
|
| 94 |
#if defined(__cplusplus) |
|
| 95 |
extern "C" {
|
|
| 96 |
#endif /* defined(__cplusplus) */ |
|
| 97 |
|
|
| 98 |
#if !defined(apalDbgAssertMsg) || defined(__DOXYGEN__) |
|
| 99 |
/** |
|
| 100 |
* @brief Assert function to check a given condition and print a message string. |
|
| 101 |
* |
|
| 102 |
* @param[in] c The condition to check. |
|
| 103 |
* @param[in] fmt Formatted message string to print. |
|
| 104 |
*/ |
|
| 105 |
void apalDbgAssertMsg(const bool c, const char* fmt, ...); |
|
| 106 |
#endif |
|
| 107 |
|
|
| 108 |
#if !defined(apalDbgPrintf) || defined(__DOXYGEN__) |
|
| 109 |
/** |
|
| 110 |
* @brief Printf function for messages printed only in debug builds. |
|
| 111 |
* |
|
| 112 |
* @param[in] fmt Formatted string to print. |
|
| 113 |
* |
|
| 114 |
* return Number of printed characters. |
|
| 115 |
*/ |
|
| 116 |
int apalDbgPrintf(const char* fmt, ...); |
|
| 117 |
#endif |
|
| 118 |
|
|
| 119 |
#if defined(__cplusplus) |
|
| 120 |
} |
|
| 121 |
#endif /* defined(__cplusplus) */ |
|
| 122 |
|
|
| 123 |
/** |
|
| 124 |
* @brief Assert function to check a given condition. |
|
| 125 |
* |
|
| 126 |
* @param[in] c The condition to check. |
|
| 127 |
*/ |
|
| 128 |
#define apalDbgAssert(c) apalDbgAssertMsg(c, "%s(%u): apalDbgAssert failed", __FILE__, __LINE__) |
|
| 129 |
|
|
| 130 |
#endif /* (AMIROLLD_CFG_DBG == true) */ |
|
| 131 |
|
|
| 132 |
/*============================================================================*/ |
|
| 133 |
/* TIMING */ |
|
| 134 |
/*============================================================================*/ |
|
| 135 |
|
|
| 136 |
/** |
|
| 137 |
* @brief Time measurement type (in microseconds). |
|
| 138 |
*/ |
|
| 139 |
#if (AMIROLLD_CFG_TIME_SIZE == 8) |
|
| 140 |
typedef uint8_t apalTime_t; |
|
| 141 |
#elif (AMIROLLD_CFG_TIME_SIZE == 16) |
|
| 142 |
typedef uint16_t apalTime_t; |
|
| 143 |
#elif (AMIROLLD_CFG_TIME_SIZE == 32) |
|
| 144 |
typedef uint32_t apalTime_t; |
|
| 145 |
#elif (AMIROLLD_CFG_TIME_SIZE == 64) |
|
| 146 |
typedef uint64_t apalTime_t; |
|
| 147 |
#else |
|
| 148 |
#error "AMIROLLD_CFG_TIME_SIZE must be 8, 16, 32 or 64" |
|
| 149 |
#endif |
|
| 150 |
|
|
| 151 |
#ifdef __cplusplus |
|
| 152 |
extern "C" {
|
|
| 153 |
#endif |
|
| 154 |
|
|
| 155 |
#if !defined(apalSleep) || defined(__DOXYGEN__) |
|
| 156 |
/** |
|
| 157 |
* @brief Delay execution by a specific number of microseconds. |
|
| 158 |
* |
|
| 159 |
* @param[in] us Time to sleep until execution continues in microseconds. |
|
| 160 |
*/ |
|
| 161 |
void apalSleep(apalTime_t us); |
|
| 162 |
#endif |
|
| 163 |
|
|
| 164 |
#ifdef __cplusplus |
|
| 165 |
} |
|
| 166 |
#endif |
|
| 167 |
|
|
| 168 |
/*============================================================================*/ |
|
| 169 |
/* GPIO */ |
|
| 170 |
/*============================================================================*/ |
|
| 171 |
|
|
| 172 |
#if (AMIROLLD_CFG_GPIO == true) || defined(__DOXYGEN__) |
|
| 173 |
|
|
| 174 |
/* |
|
| 175 |
* The following type must be defined by the implementation: |
|
| 176 |
* |
|
| 177 |
* apalGpio_t |
|
| 178 |
* Type to represent a GPIO object. |
|
| 179 |
* Is only used via pointer by the API. |
|
| 180 |
*/ |
|
| 181 |
|
|
| 182 |
/** |
|
| 183 |
* @brief Status values to read/write a GPIO port. |
|
| 184 |
*/ |
|
| 185 |
typedef uint8_t apalGpioState_t; |
|
| 186 |
|
|
| 187 | ||