Skip to content

Commit f54ca87

Browse files
author
Cruz Monrreal
authored
Merge pull request #8410 from cmonr/rollup-aus_writathon
Rollup: Austin Writathon + a few more docs PRs
2 parents 6d7b655 + 940c685 commit f54ca87

File tree

15 files changed

+210
-178
lines changed

15 files changed

+210
-178
lines changed

.github/issue_template.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Description
2-
<!--
2+
3+
<!--
34
Required
45
Add detailed description of what you are reporting.
56
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
@@ -13,19 +14,15 @@
1314

1415

1516
### Issue request type
16-
<!--
17-
Required
18-
Please add only one X to one of the following types. Do not fill multiple types. (Split the issue otherwise.)
19-
Please note this is not a GitHub task list; indenting the boxes or changing the format to add a '.' or '*' in front
20-
of them changes the meaning incorrectly. The only changes to make are to add a description under the
21-
description heading and to add an 'x' to the correct box.
2217

23-
[X] Question
24-
[ ] Enhancement
25-
[ ] Bug
18+
<!--
19+
Required
20+
Please add only one X to one of the following types. Do not fill multiple types (split the issue otherwise.)
21+
Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front
22+
of them would change the meaning incorrectly. The only changes to be made are to add a description text under the
23+
description heading and to add a 'x' to the correct box.
2624
-->
27-
28-
[ ] Question
29-
[ ] Enhancement
30-
[ ] Bug
25+
[ ] Question
26+
[ ] Enhancement
27+
[ ] Bug
3128

UNITTESTS/README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Unit testing
22

3-
This document describes how to write and test unit tests for Mbed OS. To prevent and solve problems, please see the [troubleshooting](#troubleshooting) section.
3+
This document describes how to write and test unit tests for Arm Mbed OS. To prevent and solve problems, please see the [troubleshooting](#troubleshooting) section.
44

55
### Introduction
66

@@ -16,7 +16,7 @@ Please install the following dependencies to use Mbed OS unit testing.
1616
- Python 2.7.x, 3.5 or newer.
1717
- Pip 10.0 or newer.
1818
- Gcovr 4.1 or newer.
19-
- Mbed CLI 1.8.0 or newer.
19+
- Arm Mbed CLI 1.8.0 or newer.
2020

2121
Detailed instructions for supported operating systems are below.
2222

@@ -30,7 +30,7 @@ Detailed instructions for supported operating systems are below.
3030
sudo easy_install pip
3131
```
3232

33-
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
33+
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/developing-arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
3434

3535
#### Installing dependencies on macOS
3636

@@ -43,15 +43,15 @@ Detailed instructions for supported operating systems are below.
4343
sudo easy_install pip
4444
```
4545

46-
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
46+
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/developing-arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
4747

4848
#### Installing dependencies on Windows
4949

5050
1. Download and install [MinGW-W64](http://mingw-w64.org/).
5151
1. Download CMake binaries from https://cmake.org/download/, and run the installer.
5252
1. Download Python 2.7 or Python 3 from https://www.python.org/getit/, and run the installer.
5353
1. Add MinGW, CMake and Python into system PATH.
54-
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
54+
1. Install Gcovr and [Mbed CLI](https://os.mbed.com/docs/latest/tools/developing-arm-mbed-cli.html) with `pip install "gcovr>=4.1" mbed-cli`.
5555

5656
### Test code structure
5757

@@ -69,7 +69,7 @@ The build system automatically generates names of test suites. The name is const
6969

7070
### Unit testing with Mbed CLI
7171

72-
Mbed CLI supports unit tests through `mbed test --unittests` command. For information on using Mbed CLI, please see the [CLI documentation in handbook](https://os.mbed.com/docs/latest/tools/arm-mbed-cli.html).
72+
Mbed CLI supports unit tests through `mbed test --unittests` command. For information on using Mbed CLI, please see the [CLI documentation](https://os.mbed.com/docs/latest/tools/developing-arm-mbed-cli.html).
7373

7474
### Writing unit tests
7575

@@ -154,17 +154,19 @@ TEST_F(TestSemaphore, constructor)
154154

155155
### Building and running unit tests
156156

157-
Use Mbed CLI to build and run unit tests. For advanced use, you can run CMake and a make program directly.
157+
Use Mbed CLI to build and run unit tests. For advanced use, you can run CMake and a Make program directly.
158158

159159
#### Build tests directly with CMake
160160

161161
1. Create a build directory `mkdir UNITTESTS/build`.
162162
1. Move to the build directory `cd UNITTESTS/build`.
163163
1. Run CMake using a relative path to `UNITTESTS` folder as the argument. So from `UNITTESTS/build` use `cmake ..`:
164164
- Add `-g [generator]` if generating other than Unix Makefiles such in case of MinGW use `-g "MinGW Makefiles"`.
165-
- Add `-DCOVERAGE:True` to add coverage compiler flags.
165+
- Add `-DCMAKE_MAKE_PROGRAM=<value>`, `-DCMAKE_CXX_COMPILER=<value>` and `-DCMAKE_C_COMPILER=<value>` to use a specific Make program and compilers.
166+
- Add `-DCMAKE_BUILD_TYPE=Debug` to build a debug build.
167+
- Add `-DCOVERAGE=True` to add coverage compiler flags.
166168
- See the [CMake manual](https://cmake.org/cmake/help/v3.0/manual/cmake.1.html) for more information.
167-
1. Run a make program (Make, Gmake, Mingw32-make and so on) to build the tests.
169+
1. Run a Make program to build the tests.
168170

169171
#### Run tests directly with CTest
170172

@@ -177,14 +179,24 @@ Run a test binary in the build directory to run a unit test suite. To run multip
177179
1. Add test executables into the list.
178180
1. Run them.
179181

182+
### Debugging
183+
184+
1. Use Mbed CLI to build a debug build. For advanced use, run CMake directly with `-DCMAKE_BUILD_TYPE=Debug`, and then run a Make program.
185+
1. Run GDB with a test executable as an argument to debug unit tests.
186+
180187
### Get code coverage
181188

182-
Use Mbed CLI to generate code coverage reports. For advanced use, you can run Gcovr or any other code coverage tool directly in the build directory.
189+
Use Mbed CLI to generate code coverage reports. For advanced use, follow these steps:
190+
191+
1. Run CMake with both `-DCMAKE_BUILD_TYPE=Debug` and `-DCOVERAGE=True`.
192+
1. Run a Make program to build the tests.
193+
1. Run the tests.
194+
1. Run Gcovr or any other code coverage tool directly in the build directory.
183195

184196
### Troubleshooting
185197

186198
**Problem:** Generic problems with CMake or with the build process.
187-
* **Solution**: Delete the build directory. Make sure that CMake, g++, gcc and a make program can be found in the path and are correct versions.
199+
* **Solution**: Delete the build directory. Make sure that CMake, g++, GCC and a Make program can be found in the path and are correct versions.
188200

189201
**Problem:** Virus protection identifies files generated by CMake as malicious and quarantines the files on Windows.
190202
* **Solution**: Restore the false positive files from the quarantine.

drivers/CAN.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class CANMessage : public CAN_Message {
8585
class CAN : private NonCopyable<CAN> {
8686

8787
public:
88-
/** Creates an CAN interface connected to specific pins.
88+
/** Creates a CAN interface connected to specific pins.
8989
*
9090
* @param rd read from transmitter
9191
* @param td transmit to transmitter
@@ -94,11 +94,14 @@ class CAN : private NonCopyable<CAN> {
9494
* @code
9595
* #include "mbed.h"
9696
*
97+
*
9798
* Ticker ticker;
9899
* DigitalOut led1(LED1);
99100
* DigitalOut led2(LED2);
100-
* CAN can1(p9, p10);
101-
* CAN can2(p30, p29);
101+
* //The constructor takes in RX, and TX pin respectively.
102+
* //These pins, for this example, are defined in mbed_app.json
103+
* CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD);
104+
* CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD);
102105
*
103106
* char counter = 0;
104107
*
@@ -121,14 +124,15 @@ class CAN : private NonCopyable<CAN> {
121124
* wait(0.2);
122125
* }
123126
* }
127+
*
124128
* @endcode
125129
*/
126130
CAN(PinName rd, PinName td);
127131

128132
/** Initialize CAN interface and set the frequency
129133
*
130-
* @param rd the rd pin
131-
* @param td the td pin
134+
* @param rd the read pin
135+
* @param td the transmit pin
132136
* @param hz the bus frequency in hertz
133137
*/
134138
CAN(PinName rd, PinName td, int hz);
@@ -288,12 +292,14 @@ class CAN : private NonCopyable<CAN> {
288292

289293
static void _irq_handler(uint32_t id, CanIrqType type);
290294

295+
#if !defined(DOXYGEN_ONLY)
291296
protected:
292297
virtual void lock();
293298
virtual void unlock();
294299
can_t _can;
295300
Callback<void()> _irq[IrqCnt];
296301
PlatformMutex _mutex;
302+
#endif
297303
};
298304

299305
} // namespace mbed

drivers/InterruptIn.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace mbed {
4848
* }
4949
*
5050
* int main() {
51+
* // register trigger() to be called upon the rising edge of event
5152
* event.rise(&trigger);
5253
* while(1) {
5354
* led = !led;
@@ -71,7 +72,10 @@ class InterruptIn : private NonCopyable<InterruptIn> {
7172
* and the pin configured to the specified mode.
7273
*
7374
* @param pin InterruptIn pin to connect to
74-
* @param mode The mode to set the pin to (PullUp/PullDown/etc.)
75+
* @param mode Desired Pin mode configuration.
76+
* (Valid values could be PullNone, PullDown, PullUp and PullDefault.
77+
* See PinNames.h for your target for definitions)
78+
*
7579
*/
7680
InterruptIn(PinName pin, PinMode mode);
7781

@@ -142,11 +146,12 @@ class InterruptIn : private NonCopyable<InterruptIn> {
142146

143147
/** Set the input pin mode
144148
*
145-
* @param pull PullUp, PullDown, PullNone
149+
* @param pull PullUp, PullDown, PullNone, PullDefault
150+
* See PinNames.h for your target for definitions)
146151
*/
147152
void mode(PinMode pull);
148153

149-
/** Enable IRQ. This method depends on hw implementation, might enable one
154+
/** Enable IRQ. This method depends on hardware implementation, might enable one
150155
* port interrupts. For further information, check gpio_irq_enable().
151156
*/
152157
void enable_irq();
@@ -157,7 +162,7 @@ class InterruptIn : private NonCopyable<InterruptIn> {
157162
void disable_irq();
158163

159164
static void _irq_handler(uint32_t id, gpio_irq_event event);
160-
165+
#if !defined(DOXYGEN_ONLY)
161166
protected:
162167
gpio_t gpio;
163168
gpio_irq_t gpio_irq;
@@ -166,6 +171,7 @@ class InterruptIn : private NonCopyable<InterruptIn> {
166171
Callback<void()> _fall;
167172

168173
void irq_init(PinName pin);
174+
#endif
169175
};
170176

171177
} // namespace mbed

drivers/QSPI.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,22 @@ class QSPI : private NonCopyable<QSPI> {
8484
* @param io3 4th IO pin used for sending/receiving data during data phase of a transaction
8585
* @param sclk QSPI Clock pin
8686
* @param ssel QSPI chip select pin
87-
* @param mode Mode specifies the SPI mode(Mode=0 uses CPOL=0, CPHA=0, Mode=1 uses CPOL=1, CPHA=1)
88-
* default value = 0
87+
* @param mode Clock polarity and phase mode (0 - 3) of SPI
88+
* (Default: Mode=0 uses CPOL=0, CPHA=0, Mode=1 uses CPOL=1, CPHA=1)
8989
*
9090
*/
9191
QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel = NC, int mode = 0);
92+
virtual ~QSPI()
93+
{
94+
}
9295

9396
/** Configure the data transmission format
9497
*
9598
* @param inst_width Bus width used by instruction phase(Valid values are QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_DUAL, QSPI_CFG_BUS_QUAD)
9699
* @param address_width Bus width used by address phase(Valid values are QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_DUAL, QSPI_CFG_BUS_QUAD)
97100
* @param address_size Size in bits used by address phase(Valid values are QSPI_CFG_ADDR_SIZE_8, QSPI_CFG_ADDR_SIZE_16, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_ADDR_SIZE_32)
98101
* @param alt_width Bus width used by alt phase(Valid values are QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_DUAL, QSPI_CFG_BUS_QUAD)
99-
* @param alt_size Size in bits used by alt phase(Valid values are QSPI_CFG_ADDR_SIZE_8, QSPI_CFG_ADDR_SIZE_16, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_ADDR_SIZE_32)
102+
* @param alt_size Size in bits used by alt phase(Valid values are QSPI_CFG_ALT_SIZE_8, QSPI_CFG_ALT_SIZE_16, QSPI_CFG_ALT_SIZE_24, QSPI_CFG_ALT_SIZE_32)
100103
* @param data_width Bus width used by data phase(Valid values are QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_DUAL, QSPI_CFG_BUS_QUAD)
101104
* @param dummy_cycles Number of dummy clock cycles to be used after alt phase
102105
*
@@ -179,6 +182,7 @@ class QSPI : private NonCopyable<QSPI> {
179182
*/
180183
qspi_status_t command_transfer(int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length);
181184

185+
#if !defined(DOXYGEN_ONLY)
182186
protected:
183187
/** Acquire exclusive access to this SPI bus
184188
*/
@@ -188,12 +192,6 @@ class QSPI : private NonCopyable<QSPI> {
188192
*/
189193
virtual void unlock(void);
190194

191-
public:
192-
virtual ~QSPI()
193-
{
194-
}
195-
196-
protected:
197195
qspi_t _qspi;
198196

199197
bool acquire(void);
@@ -223,6 +221,7 @@ class QSPI : private NonCopyable<QSPI> {
223221
* This function builds the qspi command struct to be send to Hal
224222
*/
225223
inline void _build_qspi_command(int instruction, int address, int alt);
224+
#endif
226225
};
227226

228227
} // namespace mbed

drivers/Ticker.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace mbed {
3535
*
3636
* Example:
3737
* @code
38-
* // Toggle the blinking led after 5 seconds
38+
* // Toggle the blinking LED after 5 seconds
3939
*
4040
* #include "mbed.h"
4141
*
@@ -70,7 +70,7 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
7070
{
7171
}
7272

73-
// When low power ticker is in use, then do not disable deep-sleep.
73+
// When low power ticker is in use, then do not disable deep sleep.
7474
Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(true)
7575
{
7676
#if DEVICE_LPTICKER
@@ -106,13 +106,13 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
106106
attach(callback(obj, method), t);
107107
}
108108

109-
/** Attach a function to be called by the Ticker, specifying the interval in micro-seconds
109+
/** Attach a function to be called by the Ticker, specifying the interval in microseconds
110110
*
111111
* @param func pointer to the function to be called
112112
* @param t the time between calls in micro-seconds
113113
*
114-
* @note setting @a t to a value shorter that it takes to process the ticker callback
115-
* will cause the system to hang. Ticker callback will be called constantly with no time
114+
* @note setting @a t to a value shorter than it takes to process the ticker callback
115+
* causes the system to hang. Ticker callback is called constantly with no time
116116
* for threads scheduling.
117117
*
118118
*/
@@ -128,11 +128,11 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
128128
core_util_critical_section_exit();
129129
}
130130

131-
/** Attach a member function to be called by the Ticker, specifying the interval in micro-seconds
131+
/** Attach a member function to be called by the Ticker, specifying the interval in microseconds
132132
*
133133
* @param obj pointer to the object to call the member function on
134134
* @param method pointer to the member function to be called
135-
* @param t the time between calls in micro-seconds
135+
* @param t the time between calls in microseconds
136136
* @deprecated
137137
* The attach_us function does not support cv-qualifiers. Replaced by
138138
* attach_us(callback(obj, method), t).
@@ -155,14 +155,16 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
155155
*/
156156
void detach();
157157

158+
#if !defined(DOXYGEN_ONLY)
158159
protected:
159160
void setup(us_timestamp_t t);
160161
virtual void handler();
161162

162163
protected:
163-
us_timestamp_t _delay; /**< Time delay (in microseconds) for re-setting the multi-shot callback. */
164+
us_timestamp_t _delay; /**< Time delay (in microseconds) for resetting the multishot callback. */
164165
Callback<void()> _function; /**< Callback. */
165-
bool _lock_deepsleep; /**< Flag which indicates if deep-sleep should be disabled. */
166+
bool _lock_deepsleep; /**< Flag which indicates if deep sleep should be disabled. */
167+
#endif
166168
};
167169

168170
} // namespace mbed

drivers/Timeout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace mbed {
2525

2626
/** A Timeout is used to call a function at a point in the future
2727
*
28-
* You can use as many seperate Timeout objects as you require.
28+
* You can use as many separate Timeout objects as you require.
2929
*
3030
* @note Synchronization level: Interrupt safe
3131
*

0 commit comments

Comments
 (0)