Skip to content

Commit a9c1e9c

Browse files
author
Noel F Paz
committed
Modify comments to point to Paul Stoffregen's Serial Flash library in github
1 parent 0376547 commit a9c1e9c

File tree

5 files changed

+45
-42
lines changed

5 files changed

+45
-42
lines changed

libraries/CurieSerialFlash/examples/CopyFromSerial/CopyFromSerial.ino

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
11
/*
22
* This is free and unencumbered software released into the public domain.
3-
*
3+
*
44
* Anyone is free to copy, modify, publish, use, compile, sell, or
55
* distribute this software, either in source code form or as a compiled
66
* binary, for any purpose, commercial or non-commercial, and by any
77
* means.
8-
*
8+
*
99
* In jurisdictions that recognize copyright laws, the author or authors
1010
* of this software dedicate any and all copyright interest in the
1111
* software to the public domain. We make this dedication for the benefit
1212
* of the public at large and to the detriment of our heirs and
1313
* successors. We intend this dedication to be an overt act of
1414
* relinquishment in perpetuity of all present and future rights to this
1515
* software under copyright law.
16-
*
16+
*
1717
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1818
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1919
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2020
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2121
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2222
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2323
* OTHER DEALINGS IN THE SOFTWARE.
24-
*
24+
*
2525
* For more information, please refer to <http://unlicense.org>
2626
* -------------------------------------------------------------------------
27-
*
28-
* This is example code to 1) format an SPI Flash chip, and 2) copy raw
29-
* audio files (mono channel, 16 bit signed, 44100Hz) to it using the
30-
* SerialFlash library. The audio can then be played back using the
27+
*
28+
* This is example code to 1) format an SPI Flash chip, and 2) copy raw
29+
* audio files (mono channel, 16 bit signed, 44100Hz) to it using the
30+
* SerialFlash library. The audio can then be played back using the
3131
* AudioPlaySerialflashRaw object in the Teensy Audio library.
32-
*
32+
*
3333
* To convert a .wav file to the proper .RAW format, use sox:
3434
* sox input.wav -r 44100 -b 16 --norm -e signed-integer -t raw OUTPUT.RAW remix 1,2
35-
*
35+
*
3636
* Note that the OUTPUT.RAW filename must be all caps and contain only the following
3737
* characters: A-Z, 0-9, comma, period, colon, dash, underscore. (The SerialFlash
3838
* library converts filenames to caps, so to avoid confusion we just enforce it here).
39-
*
39+
*
4040
* It is a little difficult to see what is happening; aswe are using the Serial port
4141
* to upload files, we can't just throw out debug information. Instead, we use the LED
4242
* (pin 13) to convey state.
43-
*
44-
* While the chip is being formatted, the LED (pin 13) will toggle at 1Hz rate. When
45-
* the formatting is done, it flashes quickly (10Hz) for one second, then stays on
46-
* solid. When nothing has been received for 3 seconds, the upload is assumed to be
43+
*
44+
* While the chip is being formatted, the LED (pin 13) will toggle at 1Hz rate. When
45+
* the formatting is done, it flashes quickly (10Hz) for one second, then stays on
46+
* solid. When nothing has been received for 3 seconds, the upload is assumed to be
4747
* completed, and the light goes off.
48-
*
48+
*
4949
* Use the 'rawfile-uploader.py' python script (included in the extras folder) to upload
5050
* the files. You can start the script as soon as the Teensy is turned on, and the
5151
* USB serial upload will just buffer and wait until the flash is formatted.
52-
*
53-
* This code was written by Wyatt Olson <wyatt@digitalcave.ca> (originally as part
54-
* of Drum Master http://drummaster.digitalcave.ca and later modified into a
52+
*
53+
* This code was written by Wyatt Olson <wyatt@digitalcave.ca> (originally as part
54+
* of Drum Master http://drummaster.digitalcave.ca and later modified into a
5555
* standalone sample).
56-
*
56+
*
5757
* Enjoy!
5858
*
5959
* SerialFlash library API: https://github.com/PaulStoffregen/SerialFlash
6060
*
61-
* This example depens on http://librarymanager/all#SerialFlash&SPI (clickme!)
61+
* This example depends on Paul Stoffregen's SerialFlash library
62+
* Download at https://github.com/PaulStoffregen/SerialFlash
6263
*/
6364

6465
#include <CurieSerialFlash.h>
@@ -85,14 +86,14 @@ void setup(){
8586
Serial.begin(9600); //Teensy serial is always at full USB speed and buffered... the baud rate here is required but ignored
8687

8788
pinMode(13, OUTPUT);
88-
89+
8990
SerialFlash.begin(ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN);
9091

9192
//We start by formatting the flash...
9293
uint8_t id[5];
9394
SerialFlash.readID(id);
9495
SerialFlash.eraseAll();
95-
96+
9697
//Flash LED at 1Hz while formatting
9798
while (!SerialFlash.ready()) {
9899
delay(500);
@@ -109,26 +110,26 @@ void setup(){
109110
digitalWrite(13, LOW);
110111
}
111112
digitalWrite(13, HIGH);
112-
113+
113114
//We are now going to wait for the upload program
114115
while(!Serial.available());
115-
116+
116117
SerialFlashFile flashFile;
117-
118+
118119
uint8_t state = STATE_START;
119120
uint8_t escape = 0;
120121
uint8_t fileSizeIndex = 0;
121122
uint32_t fileSize = 0;
122123
char filename[FILENAME_STRING_SIZE];
123-
124+
124125
char usbBuffer[USB_BUFFER_SIZE];
125126
uint8_t flashBuffer[FLASH_BUFFER_SIZE];
126-
127+
127128
uint16_t flashBufferIndex = 0;
128129
uint8_t filenameIndex = 0;
129-
130+
130131
uint32_t lastReceiveTime = millis();
131-
132+
132133
//We assume the serial receive part is finished when we have not received something for 3 seconds
133134
while(Serial.available() || lastReceiveTime + 3000 > millis()){
134135
uint16_t available = Serial.readBytes(usbBuffer, USB_BUFFER_SIZE);
@@ -138,7 +139,7 @@ void setup(){
138139

139140
for (uint16_t usbBufferIndex = 0; usbBufferIndex < available; usbBufferIndex++){
140141
uint8_t b = usbBuffer[usbBufferIndex];
141-
142+
142143
if (state == STATE_START){
143144
//Start byte. Repeat start is fine.
144145
if (b == BYTE_START){
@@ -163,12 +164,12 @@ void setup(){
163164
flushError();
164165
return;
165166
}
166-
167+
167168
//Change state
168169
state = STATE_SIZE;
169170
fileSizeIndex = 0;
170171
fileSize = 0;
171-
172+
172173
}
173174
//Invalid character
174175
else {
@@ -187,11 +188,11 @@ void setup(){
187188
state = STATE_CONTENT;
188189
flashBufferIndex = 0;
189190
escape = 0;
190-
191+
191192
if (SerialFlash.exists(filename)){
192193
SerialFlash.remove(filename); //It doesn't reclaim the space, but it does let you create a new file with the same name.
193194
}
194-
195+
195196
//Create a new file and open it for writing
196197
if (SerialFlash.create(filename, fileSize)) {
197198
flashFile = SerialFlash.open(filename);
@@ -236,7 +237,7 @@ void setup(){
236237
else {
237238
flashBuffer[flashBufferIndex++] = b;
238239
}
239-
240+
240241
//The buffer is filled; write to SD card
241242
if (flashBufferIndex >= FLASH_BUFFER_SIZE){
242243
flashFile.write(flashBuffer, FLASH_BUFFER_SIZE);

libraries/CurieSerialFlash/examples/EraseEverything/EraseEverything.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// This example depens on http://librarymanager/all#SerialFlash&SPI (clickme!)
1+
// This example depends on Paul Stoffregen's SerialFlash library
2+
// Download at https://github.com/PaulStoffregen/SerialFlash
23

34
#include <CurieSerialFlash.h>
45
#include <SPI.h>
@@ -75,4 +76,3 @@ float eraseBytesPerSecond(const unsigned char *id) {
7576
void loop() {
7677

7778
}
78-

libraries/CurieSerialFlash/examples/FileWrite/FileWrite.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// This example depens on http://librarymanager/all#SerialFlash&SPI (clickme!)
1+
// This example depends on Paul Stoffregen's SerialFlash library
2+
// Download at https://github.com/PaulStoffregen/SerialFlash
23

34
#include <CurieSerialFlash.h>
45
#include <SPI.h>

libraries/CurieSerialFlash/examples/ListFiles/ListFiles.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// This example depens on http://librarymanager/all#SerialFlash&SPI (clickme!)
1+
// This example depends on Paul Stoffregen's SerialFlash library
2+
// Download at https://github.com/PaulStoffregen/SerialFlash
23

34
#include <CurieSerialFlash.h>
45
#include <SPI.h>

libraries/CurieSerialFlash/examples/RawHardwareTest/RawHardwareTest.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
// You MUST post the complete output of this program, and
2020
// the exact part number and manufacturer of the chip.
2121
//
22-
// This example depens on http://librarymanager/all#SerialFlash&SPI (clickme!)
22+
// This example depends on Paul Stoffregen's SerialFlash library
23+
// Download at https://github.com/PaulStoffregen/SerialFlash
2324

2425

2526
#include <CurieSerialFlash.h>
@@ -499,4 +500,3 @@ void printbuf(const void *buf, uint32_t len)
499500
} while (--len > 0);
500501
Serial.println();
501502
}
502-

0 commit comments

Comments
 (0)