File tree 6 files changed +11
-15
lines changed
libraries/CurieSerialFlash/examples
6 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 81
81
#define BYTE_ESCAPE 0x7d
82
82
#define BYTE_SEPARATOR 0x7c
83
83
84
- #define CSPIN 21
85
-
86
84
void setup (){
87
85
Serial.begin (9600 ); // Teensy serial is always at full USB speed and buffered... the baud rate here is required but ignored
88
86
89
87
pinMode (13 , OUTPUT);
90
88
91
- SerialFlash.begin (SPI1, CSPIN );
89
+ SerialFlash.begin (ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN );
92
90
93
91
// We start by formatting the flash...
94
92
uint8_t id[5 ];
Original file line number Diff line number Diff line change 3
3
#include < CurieSerialFlash.h>
4
4
#include < SPI.h>
5
5
6
- const int FlashChipSelect = 21 ; // digital pin for flash chip CS pin
7
-
8
6
SerialFlashFile file;
9
7
10
8
const unsigned long testIncrement = 4096 ;
@@ -26,7 +24,7 @@ void setup() {
26
24
while (!Serial && (millis () - startMillis < 10000 )) ;
27
25
delay (100 );
28
26
29
- SerialFlash.begin (SPI1, FlashChipSelect );
27
+ SerialFlash.begin (ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN );
30
28
unsigned char id[5 ];
31
29
SerialFlash.readID (id);
32
30
unsigned long size = SerialFlash.capacity (id);
Original file line number Diff line number Diff line change 8
8
const char *filename = " myfile.txt" ;
9
9
const char *contents = " 0123456789ABCDEF" ;
10
10
11
- const int FlashChipSelect = 21 ; // digital pin for flash chip CS pin
12
-
13
11
void setup () {
14
12
Serial.begin (9600 );
15
13
@@ -18,7 +16,7 @@ void setup() {
18
16
delay (100 );
19
17
20
18
// Init. SPI Flash chip
21
- if (!SerialFlash.begin (SPI1, FlashChipSelect )) {
19
+ if (!SerialFlash.begin (ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN )) {
22
20
Serial.println (" Unable to access SPI Flash chip" );
23
21
}
24
22
Original file line number Diff line number Diff line change 3
3
#include < CurieSerialFlash.h>
4
4
#include < SPI.h>
5
5
6
- const int FlashChipSelect = 21 ; // digital pin for flash chip CS pin
7
-
8
6
void setup () {
9
7
// uncomment these if using Teensy audio shield
10
8
// SPI.setSCK(14); // Audio shield has SCK on pin 14
@@ -22,7 +20,7 @@ void setup() {
22
20
delay (100 );
23
21
Serial.println (" All Files on SPI Flash chip:" );
24
22
25
- if (!SerialFlash.begin (SPI1, FlashChipSelect )) {
23
+ if (!SerialFlash.begin (ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN )) {
26
24
error (" Unable to access SPI Flash chip" );
27
25
}
28
26
Original file line number Diff line number Diff line change 25
25
#include < CurieSerialFlash.h>
26
26
#include < SPI.h>
27
27
28
- const int FlashChipSelect = 21 ; // digital pin for flash chip CS pin
29
-
30
28
SerialFlashFile file;
31
29
32
30
const unsigned long testIncrement = 4096 ;
@@ -48,7 +46,7 @@ void setup() {
48
46
delay (100 );
49
47
50
48
Serial.println (" Raw SerialFlash Hardware Test" );
51
- SerialFlash.begin (SPI1, FlashChipSelect );
49
+ SerialFlash.begin (ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN );
52
50
53
51
if (test ()) {
54
52
Serial.println ();
Original file line number Diff line number Diff line change @@ -113,6 +113,12 @@ extern "C"{
113
113
* ADC
114
114
*/
115
115
116
+ /*
117
+ * ONBOARD SPI FLASH
118
+ */
119
+ #define ONBOARD_FLASH_SPI_PORT SPI1
120
+ #define ONBOARD_FLASH_CS_PIN 21
121
+
116
122
/* EAI ADC device registers */
117
123
#define ADC_SET (0x80015000)
118
124
#define ADC_DIVSEQSTAT (0x80015001)
You can’t perform that action at this time.
0 commit comments