Naze32 clone with Frysky receiver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FileBase.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* mbed Microcontroller Library
  2. * Copyright (c) 2006-2013 ARM Limited
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MBED_FILEBASE_H
  17. #define MBED_FILEBASE_H
  18. typedef int FILEHANDLE;
  19. #include <stdio.h>
  20. #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
  21. # define O_RDONLY 0
  22. # define O_WRONLY 1
  23. # define O_RDWR 2
  24. # define O_CREAT 0x0200
  25. # define O_TRUNC 0x0400
  26. # define O_APPEND 0x0008
  27. # define NAME_MAX 255
  28. typedef int mode_t;
  29. typedef int ssize_t;
  30. typedef long off_t;
  31. #else
  32. # include <sys/fcntl.h>
  33. # include <sys/types.h>
  34. # include <sys/syslimits.h>
  35. #endif
  36. #include "platform.h"
  37. namespace mbed {
  38. typedef enum {
  39. FilePathType,
  40. FileSystemPathType
  41. } PathType;
  42. class FileBase {
  43. public:
  44. FileBase(const char *name, PathType t);
  45. virtual ~FileBase();
  46. const char* getName(void);
  47. PathType getPathType(void);
  48. static FileBase *lookup(const char *name, unsigned int len);
  49. static FileBase *get(int n);
  50. protected:
  51. static FileBase *_head;
  52. FileBase *_next;
  53. const char *_name;
  54. PathType _path_type;
  55. /* disallow copy constructor and assignment operators */
  56. private:
  57. FileBase(const FileBase&);
  58. FileBase & operator = (const FileBase&);
  59. };
  60. } // namespace mbed
  61. #endif