rename FileIO.h to Bluefruit_FileIO to prevent lib conflict
This commit is contained in:
1 parent
f15508ad90
commit
a63b676f27
16 files changed
+45
-45
No files matched your search
@@ -13,8 +13,8 @@
|
||||
*********************************************************************/
|
||||
|
||||
/*
|
||||
* This sketch demonstrate the central API(). A additional bluefruit
|
||||
* that has bleuart as peripheral is required for the demo.
|
||||
* This sketch demonstrate the central API(). An additional bluefruit
|
||||
* that has blehid as peripheral is required for the demo.
|
||||
*/
|
||||
#include <bluefruit.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name=Adafruit BLE Libraries for Bluefruit52
|
||||
name=Adafruit BLE Libraries
|
||||
version=0.9.1
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/**************************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "FileIO.h"
|
||||
#include "Bluefruit_FileIO.h"
|
||||
#include "bonding.h"
|
||||
#include "bluefruit.h"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
// the setup function runs once when you press reset or power the board
|
||||
void setup()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <bluefruit.h>
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
/* This example print out External Flash contents up to
|
||||
* MAX_LEVEL level of directories (including root)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
#define FILENAME "/adafruit.txt"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
// the setup function runs once when you press reset or power the board
|
||||
void setup()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <bluefruit.h>
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
/* This example print out Internal Flash contents up to
|
||||
* MAX_LEVEL level of directories (including root)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
#include <FileIO.h>
|
||||
#include <Bluefruit_FileIO.h>
|
||||
|
||||
#define FILENAME "/adafruit.txt"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name=Adafruit File System Libraries for Bluefruit52
|
||||
name=Adafruit File System Libraries
|
||||
version=0.9.1
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
@@ -6,5 +6,5 @@ sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules
|
||||
paragraph=Arduino library for nRF52-based Adafruit Bluefruit LE modules
|
||||
category=Communication
|
||||
url=https://github.com/adafruit/Adafruit_nRF52_Arduino
|
||||
architectures=*
|
||||
includes=FileIO.h
|
||||
architectures=nrf52
|
||||
includes=Bluefruit_FileIO.h
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file FileIO.cpp
|
||||
@file Bluefruit_FileIO.cpp
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@@ -35,9 +35,9 @@
|
||||
/**************************************************************************/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "FileIO.h"
|
||||
#include "Bluefruit_FileIO.h"
|
||||
|
||||
namespace BluefuritLib
|
||||
namespace BluefruitFS
|
||||
{
|
||||
|
||||
File::File (FileSystemClass &fs)
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file FileIO.h
|
||||
@file Bluefruit_FileIO.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@@ -41,7 +41,7 @@
|
||||
class LittleFS;
|
||||
class FatFS;
|
||||
|
||||
namespace BluefuritLib
|
||||
namespace BluefruitFS
|
||||
{
|
||||
|
||||
class FileSystemClass;
|
||||
@@ -144,16 +144,16 @@ class FileSystemClass
|
||||
|
||||
}
|
||||
|
||||
// We enclose File and FileSystem classes in namespace BluefuritLib to avoid
|
||||
// We enclose File and FileSystem classes in namespace BluefruitFS to avoid
|
||||
// conflicts with legacy SD library.
|
||||
|
||||
// This ensure compatibility with older sketches that uses only Bridge lib
|
||||
// (the user can still use File instead of BridgeFile)
|
||||
using namespace BluefuritLib;
|
||||
using namespace BluefruitFS;
|
||||
|
||||
// This allows sketches to use BluefuritLib::File together with SD library
|
||||
// This allows sketches to use BluefruitFS::File together with SD library
|
||||
// (you must use BridgeFile instead of File when needed to disambiguate)
|
||||
typedef BluefuritLib::File BluefruitFile;
|
||||
typedef BluefruitFS::File BluefruitFile;
|
||||
|
||||
#include "InternalFS.h"
|
||||
#include "ExternalFS.h"
|
||||
@@ -184,7 +184,7 @@ bool FatFS::format (bool eraseall)
|
||||
|
||||
File FatFS::_open_file (char const *filepath, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
int flags = (mode == FILE_READ) ? FA_READ :
|
||||
(mode == FILE_WRITE) ? (FA_READ | FA_WRITE | FA_OPEN_APPEND) : 0;
|
||||
@@ -214,7 +214,7 @@ File FatFS::_open_file (char const *filepath, uint8_t mode)
|
||||
|
||||
File FatFS::_open_dir (char const *filepath)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
DIR* fhdl = (DIR*) rtos_malloc(sizeof(DIR));
|
||||
int rc = f_opendir(fhdl, filepath);
|
||||
@@ -238,7 +238,7 @@ File FatFS::_open_dir (char const *filepath)
|
||||
|
||||
File FatFS::open (char const *filepath, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
FILINFO fno;
|
||||
FRESULT rc = FR_OK;
|
||||
@@ -347,7 +347,7 @@ uint32_t FatFS::_f_size (void* fhdl)
|
||||
|
||||
File FatFS::_f_openNextFile (void* fhdl, char const* cwd, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
FILINFO fno;
|
||||
FRESULT rc;
|
||||
|
||||
@@ -37,20 +37,20 @@
|
||||
#ifndef EXTERNALFS_H_
|
||||
#define EXTERNALFS_H_
|
||||
|
||||
#include "FileIO.h"
|
||||
#include "Bluefruit_FileIO.h"
|
||||
|
||||
// External Flash uses Fat FS as file system
|
||||
// http://elm-chan.org/fsw/ff/00index_e.html
|
||||
#include "fatfs/source/ff.h"
|
||||
|
||||
class FatFS: public BluefuritLib::FileSystemClass
|
||||
class FatFS: public BluefruitFS::FileSystemClass
|
||||
{
|
||||
public:
|
||||
FatFS ();
|
||||
virtual ~FatFS ();
|
||||
|
||||
bool begin (void);
|
||||
BluefuritLib::File open (char const *filepath, uint8_t mode = FILE_READ);
|
||||
BluefruitFS::File open (char const *filepath, uint8_t mode = FILE_READ);
|
||||
bool exists (char const *filepath);
|
||||
bool mkdir (char const *filepath);
|
||||
bool remove (char const *filepath);
|
||||
@@ -66,7 +66,7 @@ class FatFS: public BluefuritLib::FileSystemClass
|
||||
virtual uint32_t _f_position (void* fhdl);
|
||||
virtual uint32_t _f_size (void* fhdl);
|
||||
|
||||
virtual BluefuritLib::File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual BluefruitFS::File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual void _f_rewindDirectory (void* fhdl);
|
||||
|
||||
// called when Flash contents is changed out of the awareness of ExternalFS such as USB MSC write
|
||||
@@ -76,8 +76,8 @@ class FatFS: public BluefuritLib::FileSystemClass
|
||||
FATFS* _fs;
|
||||
bool _begun;
|
||||
|
||||
BluefuritLib::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefuritLib::File _open_dir (char const *filepath);
|
||||
BluefruitFS::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefruitFS::File _open_dir (char const *filepath);
|
||||
};
|
||||
|
||||
extern FatFS ExternalFS;
|
||||
|
||||
@@ -233,9 +233,9 @@ bool LittleFS::format (bool eraseall)
|
||||
return true;
|
||||
}
|
||||
|
||||
BluefuritLib::File LittleFS::_open_file (char const *filepath, uint8_t mode)
|
||||
BluefruitFS::File LittleFS::_open_file (char const *filepath, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
int flags = (mode == FILE_READ) ? LFS_O_RDONLY :
|
||||
(mode == FILE_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) : 0;
|
||||
@@ -268,9 +268,9 @@ BluefuritLib::File LittleFS::_open_file (char const *filepath, uint8_t mode)
|
||||
return file;
|
||||
}
|
||||
|
||||
BluefuritLib::File LittleFS::_open_dir (char const *filepath)
|
||||
BluefruitFS::File LittleFS::_open_dir (char const *filepath)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
|
||||
lfs_dir_t* fhdl = (lfs_dir_t*) rtos_malloc(sizeof(lfs_dir_t));
|
||||
int rc = lfs_dir_open(&_lfs, fhdl, filepath);
|
||||
@@ -292,9 +292,9 @@ BluefuritLib::File LittleFS::_open_dir (char const *filepath)
|
||||
return file;
|
||||
}
|
||||
|
||||
BluefuritLib::File LittleFS::open (char const *filepath, uint8_t mode)
|
||||
BluefruitFS::File LittleFS::open (char const *filepath, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
struct lfs_info info;
|
||||
|
||||
int rc = lfs_stat(&_lfs, filepath, &info);
|
||||
@@ -423,7 +423,7 @@ void LittleFS::_f_close (void* fhdl, bool is_dir)
|
||||
|
||||
File LittleFS::_f_openNextFile (void* fhdl, char const* cwd, uint8_t mode)
|
||||
{
|
||||
BluefuritLib::File file(*this);
|
||||
BluefruitFS::File file(*this);
|
||||
struct lfs_info info;
|
||||
|
||||
int rc;
|
||||
|
||||
@@ -37,20 +37,20 @@
|
||||
#ifndef INTERNALFS_H_
|
||||
#define INTERNALFS_H_
|
||||
|
||||
#include "FileIO.h"
|
||||
#include "Bluefruit_FileIO.h"
|
||||
|
||||
// Internal Flash uses ARM Little FileSystem
|
||||
// https://github.com/ARMmbed/littlefs
|
||||
#include "littlefs/lfs.h"
|
||||
|
||||
class LittleFS: public BluefuritLib::FileSystemClass
|
||||
class LittleFS: public BluefruitFS::FileSystemClass
|
||||
{
|
||||
public:
|
||||
LittleFS (void);
|
||||
virtual ~LittleFS ();
|
||||
|
||||
bool begin (void);
|
||||
BluefuritLib::File open (char const *filepath, uint8_t mode = FILE_READ);
|
||||
BluefruitFS::File open (char const *filepath, uint8_t mode = FILE_READ);
|
||||
bool exists (char const *filepath);
|
||||
bool mkdir (char const *filepath);
|
||||
bool remove (char const *filepath);
|
||||
@@ -66,7 +66,7 @@ class LittleFS: public BluefuritLib::FileSystemClass
|
||||
virtual uint32_t _f_position (void* fhdl);
|
||||
virtual uint32_t _f_size (void* fhdl);
|
||||
|
||||
virtual BluefuritLib::File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual BluefruitFS::File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual void _f_rewindDirectory (void* fhdl);
|
||||
|
||||
private:
|
||||
@@ -74,8 +74,8 @@ class LittleFS: public BluefuritLib::FileSystemClass
|
||||
lfs_t _lfs;
|
||||
bool _begun;
|
||||
|
||||
BluefuritLib::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefuritLib::File _open_dir (char const *filepath);
|
||||
BluefruitFS::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefruitFS::File _open_dir (char const *filepath);
|
||||
};
|
||||
|
||||
extern LittleFS InternalFS;
|
||||
|
||||
Reference in new issue
Block a user