Skip to content

Commit ef8c648

Browse files
authored
Merge pull request #71 from arduino-libraries/update_docs
docs: Update the documentation.
2 parents 7355ae7 + 16de488 commit ef8c648

File tree

1 file changed

+36
-50
lines changed

1 file changed

+36
-50
lines changed

Diff for: docs/api.md

+36-50
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ AdvancedADC adc(analogPin);
2020

2121
`void`.
2222

23-
### `begin()`
23+
### `AdvancedADC.begin()`
2424

2525
Initializes and configures the ADC with the specified parameters. To reconfigure the ADC, `stop()` must be called first.
2626

@@ -56,7 +56,7 @@ adc0.begin(resolution, sample_rate, n_samples, n_buffers)
5656

5757
1 on success, 0 on failure.
5858

59-
### `available()`
59+
### `AdvancedADC.available()`
6060

6161
Checks if the ADC is readable.
6262

@@ -74,11 +74,11 @@ None.
7474

7575
Returns true, if there's at least one sample buffer in the read queue, otherwise returns false.
7676

77-
### `read()`
77+
### `AdvancedADC.read()`
7878

7979
Returns a sample buffer from the queue for reading.
8080

81-
### `start()`
81+
### `AdvancedADC.start()`
8282

8383
Starts the ADC sampling.
8484

@@ -92,7 +92,7 @@ adc.start()
9292

9393
1 on success, 0 on failure.
9494

95-
### `stop()`
95+
### `AdvancedADC.stop()`
9696

9797
Stops the ADC and releases all of its resources.
9898

@@ -127,7 +127,7 @@ AdvancedADCDual adc_dual(adc1, adc2);
127127

128128
`void`.
129129

130-
### `begin()`
130+
### `AdvancedADCDual.begin()`
131131

132132
Initializes and starts the two ADCs with the specified parameters.
133133

@@ -162,7 +162,7 @@ adc_dual.begin(resolution, sample_rate, n_samples, n_buffers)
162162

163163
1 on success, 0 on failure.
164164

165-
### `stop()`
165+
### `AdvancedADCDual.stop()`
166166

167167
Stops the dual ADCs and releases all resources.
168168

@@ -187,7 +187,7 @@ AdvancedDAC dac1(A13);
187187

188188
`void`.
189189

190-
### `begin()`
190+
### `AdvancedDAC.begin()`
191191

192192
Initializes the DAC with the specified parameters. To reconfigure the DAC, `stop()` must be called first.
193193

@@ -211,7 +211,7 @@ dac.begin(resolution, frequency, n_samples, n_buffers)
211211

212212
1 on success, 0 on failure.
213213

214-
### `available()`
214+
### `AdvancedDAC.available()`
215215

216216
Checks if the DAC is writable.
217217

@@ -229,7 +229,7 @@ None.
229229

230230
Returns true, if there's at least one free sample buffer in the write queue, otherwise returns false.
231231

232-
### `dequeue()`
232+
### `AdvancedDAC.dequeue()`
233233

234234
Returns a sample buffer from the queue for writing.
235235

@@ -245,7 +245,7 @@ for (size_t i=0; i<buf.size(); i++) {
245245
dac1.write(buf);
246246
```
247247

248-
### `write()`
248+
### `AdvancedDAC.write()`
249249

250250
Writes the sample buffer back to the DAC.
251251

@@ -259,7 +259,7 @@ dac1.write(buf);
259259

260260
- A sample buffer. See [SampleBuffer](#samplebuffer) for more details.
261261

262-
### `stop()`
262+
### `AdvancedDAC.stop()`
263263

264264
Stops the DAC and releases all of its resources.
265265

@@ -273,7 +273,7 @@ dac.stop()
273273

274274
- `1`
275275

276-
### `frequency()`
276+
### `AdvancedDAC.frequency()`
277277

278278
Sets the DAC's frequency. This function can only be used after `begin()` has been called.
279279

@@ -313,7 +313,7 @@ AdvancedI2S i2s(WS, CK, SDI, SDO, MCK);
313313

314314
`void`.
315315

316-
### `begin()`
316+
### `AdvancedI2S.begin()`
317317

318318
Initializes and starts the I2S device.
319319

@@ -337,7 +337,7 @@ i2s.begin(mode, resolution, frequency, n_samples, n_buffers)
337337

338338
1 on success, 0 on failure.
339339

340-
### `available()`
340+
### `AdvancedI2S.available()`
341341

342342
Checks if the I2S is readable, writable or both (in full-duplex mode).
343343

@@ -355,7 +355,7 @@ None.
355355

356356
Returns true if I2S is readable, writable or both (in full-duplex mode), false if not.
357357

358-
### `read()`
358+
### `AdvancedI2S.read()`
359359

360360
Returns a sample buffer from the queue for reading. This function can be called in half-duplex input or full-duplex modes. When the buffer is no longer needed, it should be returned to I2S by calling `release()`, see [SampleBuffer](#release) for more details.
361361

@@ -371,7 +371,7 @@ for (size_t i=0; i<buf.size(); i++) {
371371
i2s.release(buf);
372372
```
373373

374-
### `dequeue()`
374+
### `AdvancedI2S.dequeue()`
375375

376376
Returns a sample buffer from the queue for writing. This function can be called in half-duplex output or full-duplex modes. When the buffer is done, it can be added to the I2S write queue by calling `write()` (see [I2S](#write))
377377

@@ -387,7 +387,7 @@ for (size_t i=0; i<buf.size(); i++) {
387387
i2s.write(buf);
388388
```
389389

390-
### `write()`
390+
### `AdvancedI2S.write()`
391391

392392
Writes a sample buffer to I2S.
393393

@@ -401,7 +401,7 @@ i2s.write(buf);
401401

402402
- A buffer containing the samples (see [SampleBuffer](#samplebuffer)).
403403

404-
### `stop()`
404+
### `AdvancedI2S.stop()`
405405

406406
Stops the I2S and releases all of its resources.
407407

@@ -421,7 +421,7 @@ i2s.stop()
421421

422422
Creates a WAV file reader.
423423

424-
### `begin()`
424+
### `WavReader.begin()`
425425

426426
Initializes the WAV reader, opens the WAV file and reads the WAV header.
427427

@@ -438,25 +438,25 @@ wav.begin(path, n_samples, n_buffers, loop)
438438
- `int` - **n_buffers** - the number of sample buffers in the queue. See [SampleBuffer](#samplebuffer) for more details.
439439
- `bool` - **loop* - if true, the WAV reader will loop back to the start of the file, when the end file is reached.
440440

441-
### `stop()`
441+
### `WavReader.stop()`
442442

443443
Stops the WAV file and releases all of its resources (include the WAV file handle).
444444

445-
### `available()`
445+
### `WavReader.available()`
446446

447447
Returns true if the WAV file has more data to be read.
448448

449-
### `read()`
449+
### `WavReader.read()`
450450

451451
Returns a sample buffer from the queue for reading.
452452

453-
### `rewind()`
453+
### `WavReader.rewind()`
454454

455455
If `loop` is false, this functions restarts the file read position.
456456

457457
## SampleBuffer
458458

459-
### Sample
459+
### `Sample`
460460

461461
Represents a single data item in a [`SampleBuffer`](#samplebuffer-1). The `Sample` type is pre-defined by the library as an unsigned short (`uint16_t`) type.
462462

@@ -476,15 +476,15 @@ for (size_t i=0; i<buf.size(); i++) {
476476
dac1.write(buf);
477477
```
478478

479-
### `data()`
479+
### `SampleBuffer.data()`
480480

481481
Returns a pointer to the buffer's internal memory. The buffer's internal memory is contiguous and can be used with memcpy, for example.
482482

483483
```
484484
buf.data()
485485
```
486486

487-
### `size()`
487+
### `SampleBuffer.size()`
488488

489489
Returns the buffer size in samples (i.e., the number of samples in the buffer).
490490

@@ -496,7 +496,7 @@ buf.size()
496496

497497
- The buffer size in samples.
498498

499-
### `bytes()`
499+
### `SampleBuffer.bytes()`
500500

501501
Returns the buffer size in bytes (i.e., the `number of samples * number of channels * sample size`).
502502

@@ -508,23 +508,23 @@ buf.bytes()
508508

509509
- The buffer size in bytes.
510510

511-
### `flush()`
511+
### `SampleBuffer.flush()`
512512

513513
Flushes any cached data for the buffer.
514514

515515
```
516516
buf.flush()
517517
```
518518

519-
### `invalidate()`
519+
### `SampleBuffer.invalidate()`
520520

521521
Invalidats any cached data for the buffer.
522522

523523
```
524524
buf.invalidate()
525525
```
526526

527-
### `timestamp()`
527+
### `SampleBuffer.timestamp()`
528528

529529
Returns the timestamp of the buffer.
530530

@@ -536,7 +536,7 @@ buf.timestamp()
536536

537537
- Timestamp as `int`.
538538

539-
### `channels()`
539+
### `SampleBuffer.channels()`
540540

541541
Returns the number of channels in the buffer.
542542

@@ -548,32 +548,18 @@ buf.channels()
548548

549549
- Timestamp as `int`.
550550

551-
552-
### `release()`
553-
554-
Releases the buffer back to its memory pool.
555-
556-
```
557-
buf.release()
558-
```
559-
560-
#### Returns
561-
562-
`void`.
563-
564-
### `setflags()`
551+
### `SampleBuffer.setflags()`
565552

566553
This function is used internally by the library to set the buffer's flags. The flags can be one or both of two options: `DMA_BUFFER_DISCONT` set if the capture was stopped and then restarted, and `DMA_BUFFER_INTRLVD` which indicates that the data in the buffer is interleaved.
567554

568555
```
569556
buf.setflags(uint32_t mask)
570557
```
571558

572-
### `getflags()`
559+
### `SampleBuffer.getflags()`
573560

574561
Returns true if any of the buffer flags specified in the mask argument is set. The flags can be one or both of two options: `DMA_BUFFER_DISCONT` set if the capture was stopped and then restarted, and `DMA_BUFFER_INTRLVD` which indicates that the data in the buffer is interleaved.
575562

576-
577563
```
578564
buf.getflags(uint32_t mask)
579565
```
@@ -582,7 +568,7 @@ buf.getflags(uint32_t mask)
582568

583569
Returns true if any of the buffer flags specified in the mask argument is set, otherwise returns false.
584570

585-
### `clrflags(uin32_t mask)`
571+
### `SampleBuffer.clrflags()`
586572

587573
Clears the buffer flags specified in the mask argument.
588574

@@ -594,7 +580,7 @@ buf.clrflags(uint32_t mask)
594580

595581
`void`.
596582

597-
### `release()`
583+
### `SampleBuffer.release()`
598584

599585
Releases the buffer back to its memory pool.
600586

0 commit comments

Comments
 (0)