1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

Fix license headers in new files

This commit is contained in:
Ivan Grokhotkov 2016-03-03 12:59:50 +03:00
parent 1f97e000d0
commit 266962f9fe
7 changed files with 127 additions and 78 deletions

View File

@ -1,10 +1,18 @@
// /*
// Arduino.cpp Arduino.cpp - Mocks for common Arduino APIs
// esp8266-host-tests Copyright © 2016 Ivan Grokhotkov
//
// Created by Ivan Grokhotkov on 02/03/16. Permission is hereby granted, free of charge, to any person obtaining a copy
// Copyright © 2016 esp8266.com. All rights reserved. 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.
*/
#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN
#include <catch.hpp> #include <catch.hpp>
#include <sys/time.h> #include <sys/time.h>

View File

@ -1,10 +1,21 @@
// /*
// Arduino.hpp Arduino.h - Main include file for the Arduino SDK
// esp8266-host-tests Copyright (c) 2005-2013 Arduino Team. All right reserved.
//
// Created by Ivan Grokhotkov on 02/03/16. This library is free software; you can redistribute it and/or
// Copyright © 2016 esp8266.com. All rights reserved. modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Arduino_h #ifndef Arduino_h
#define Arduino_h #define Arduino_h

View File

@ -1,3 +1,17 @@
/*
pgmspace.cpp - PROGMEM stubs for host-side tests
Copyright © 2016 Ivan Grokhotkov
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.
*/
#ifndef __PGMSPACE_H_ #ifndef __PGMSPACE_H_
#define __PGMSPACE_H_ #define __PGMSPACE_H_
@ -7,7 +21,7 @@
#define PROGMEM #define PROGMEM
#define PGM_P const char * #define PGM_P const char *
#define PGM_VOID_P const void * #define PGM_VOID_P const void *
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) #define PSTR(s) (s)
#define _SFR_BYTE(n) (n) #define _SFR_BYTE(n) (n)
@ -22,47 +36,35 @@ typedef uint16_t prog_uint16_t;
typedef int32_t prog_int32_t; typedef int32_t prog_int32_t;
typedef uint32_t prog_uint32_t; typedef uint32_t prog_uint32_t;
#define SIZE_IRRELEVANT 0x7fffffff #define memcmp_P memcmp
#define memccpy_P memccpy
#define memmem_P memmem
#define memcpy_P memcpy
#define strncpy_P strncpy
#define strcpy_P strcpy
int memcmp_P(const void* buf1, PGM_VOID_P buf2P, size_t size); #define strncat_P strncat
// memccpy_P is only valid when used with pointers to 8bit data, due to size aligned pointers #define strcat_P strcat
// and endianess of the values greater than 8bit, matching c may return invalid aligned pointers
void* memccpy_P(void* dest, PGM_VOID_P src, int c, size_t count);
void* memmem_P(const void* buf, size_t bufSize, PGM_VOID_P findP, size_t findPSize);
void* memcpy_P(void* dest, PGM_VOID_P src, size_t count);
#define strncpy_P(dest, src, size) strncpy(dest, src, size) #define strncmp_P strncmp
#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT) #define strcmp_P strcmp
#define strncat_P(dest, src, size) strncat(dest, src, size) #define strncasecmp_P strncasecmp
#define strcat_P(dest, src) strncat_P((dest), (src), SIZE_IRRELEVANT) #define strcasecmp_P strcasecmp
#define strncmp_P(str1, str2P, size) strncmp(str1, str2P, size) #define strnlen_P strnlen
#define strcmp_P(str1, str2P) strncmp_P((str1), (str2P), SIZE_IRRELEVANT) #define strlen_P strlen
#define strncasecmp_P(str1, str2P, size) strncasecmp(str1, str2P, size) #define printf_P printf
#define strcasecmp_P(str1, str2P) strncasecmp_P((str1), (str2P), SIZE_IRRELEVANT) #define sprintf_P sprintf
#define snprintf_P snprintf
#define vsnprintf_P vsnprintf
#define strnlen_P(s, size) strnlen(s, size) #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT) #define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
#define pgm_read_float(addr) (*reinterpret_cast<const float*>(addr))
#define printf_P(formatP, ...) printf(formatP, __VA_ARGS__) #define pgm_read_dword(addr) (*reinterpret_cast<const uint32_t*>(addr))
#define sprintf_P(str, formatP, ...) sprintf(str, formatP, __VA_ARGS__)
#define snprintf_P(str, strSize, formatP, ...) snprintf(str, strSize, formatP, __VA_ARGS__)
#define vsnprintf_P(str, strSize, formatP, ap) vsnprintf(str, strSize, formatP, ap)
// flash memory must be read using 32 bit aligned addresses else a processor
// exception will be triggered
// order within the 32 bit values are
// --------------
// b3, b2, b1, b0
// w1, w0
#define pgm_read_byte(x) (*reinterpret_cast<const uint8_t*>(x))
#define pgm_read_word(x) (*reinterpret_cast<const uint16_t*>(x))
#define pgm_read_float(x) (*reinterpret_cast<const float*>(x))
#define pgm_read_dword(x) (*reinterpret_cast<const uint32_t*>(x))
#define pgm_read_byte_near(addr) pgm_read_byte(addr) #define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr) #define pgm_read_word_near(addr) pgm_read_word(addr)

View File

@ -1,11 +1,17 @@
// /*
// pins_arduino.h pins_arduino.h
// esp8266-host-tests Copyright © 2016 Ivan Grokhotkov
//
// Created by Ivan Grokhotkov on 02/03/16.
// Copyright © 2016 esp8266.com. All rights reserved.
//
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.
*/
#ifndef pins_arduino_h #ifndef pins_arduino_h
#define pins_arduino_h #define pins_arduino_h

View File

@ -1,10 +1,18 @@
// /*
// spiffs_mock.cpp spiffs_mock.cpp - SPIFFS HAL mock for host side testing
// esp8266-host-tests Copyright © 2016 Ivan Grokhotkov
//
// Created by Ivan Grokhotkov on 03/03/16. Permission is hereby granted, free of charge, to any person obtaining a copy
// Copyright © 2016 esp8266.com. All rights reserved. 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.
*/
#include "spiffs_mock.h" #include "spiffs_mock.h"
#include "spiffs/spiffs.h" #include "spiffs/spiffs.h"

View File

@ -1,10 +1,17 @@
// /*
// spiffs_mock.hpp spiffs_mock.h - SPIFFS HAL mock for host side testing
// esp8266-host-tests Copyright © 2016 Ivan Grokhotkov
//
// Created by Ivan Grokhotkov on 03/03/16. Permission is hereby granted, free of charge, to any person obtaining a copy
// Copyright © 2016 esp8266.com. All rights reserved. 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.
*/
#ifndef spiffs_mock_hpp #ifndef spiffs_mock_hpp
#define spiffs_mock_hpp #define spiffs_mock_hpp

View File

@ -1,10 +1,17 @@
// /*
// test_fs.cpp test_fs.cpp - host side file system tests
// esp8266-host-tests Copyright © 2016 Ivan Grokhotkov
//
// Created by Ivan Grokhotkov on 02/03/16. Permission is hereby granted, free of charge, to any person obtaining a copy
// Copyright © 2016 esp8266.com. All rights reserved. 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.
*/
#include <catch.hpp> #include <catch.hpp>
#include <FS.h> #include <FS.h>