-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathxyglobals.cpp
73 lines (63 loc) · 3.06 KB
/
xyglobals.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
MIT License
Copyright (c) 2018 gdsports625@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if defined(ADAFRUIT_ITSYBITSY_M0) || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0) || defined(ADAFRUIT_METRO_M0_EXPRESS)
#include <SPI.h>
#include <Adafruit_SPIFlash.h>
#include <Adafruit_SPIFlash_FatFs.h>
// Include the FatFs library header to use its low level functions
// directly. Specifically the f_fdisk and f_mkfs functions are used
// to partition and create the filesystem.
#include "utility/ff.h"
// Configuration of the flash chip pins and flash fatfs object.
// You don't normally need to change these if using a Feather/Metro
// M0 express board.
#define FLASH_TYPE SPIFLASHTYPE_W25Q16BV // Flash chip type.
// If you change this be
// sure to change the fatfs
// object type below to match.
#if defined(ADAFRUIT_ITSYBITSY_M0)
#define FLASH_SS SS1 // Flash chip SS pin.
#define FLASH_SPI_PORT SPI1 // What SPI port is Flash on?
#define NEOPIN 40
#else
#if !defined(SS1)
#define FLASH_SS SS // Flash chip SS pin.
#define FLASH_SPI_PORT SPI // What SPI port is Flash on?
#define NEOPIN 8
#else
#define FLASH_SS SS1 // Flash chip SS pin.
#define FLASH_SPI_PORT SPI1 // What SPI port is Flash on?
#define NEOPIN 40
#endif
#endif
Adafruit_SPIFlash flash(FLASH_SS, &FLASH_SPI_PORT); // Use hardware SPI
Adafruit_W25Q16BV_FatFs fatfs(flash);
#elif defined(ADAFRUIT_METRO_M4_EXPRESS)
#include <Adafruit_SPIFlash.h>
#include <Adafruit_SPIFlash_FatFs.h>
// Include the FatFs library header to use its low level functions
// directly. Specifically the f_fdisk and f_mkfs functions are used
// to partition and create the filesystem.
#include "utility/ff.h"
#include "Adafruit_QSPI_GD25Q.h"
#define FLASH_TYPE SPIFLASHTYPE_W25Q16BV // Flash chip type.
Adafruit_QSPI_GD25Q flash;
Adafruit_W25Q16BV_FatFs fatfs(flash);
#endif