source: azure_iot_hub_f767zi/trunk/asp_baseplatform/gdic/ble_shield2.1/utility/hal_platform.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 3.4 KB
Line 
1/* Copyright (c) 2014, Nordic Semiconductor ASA
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in all
11 * copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 * SOFTWARE.
20 */
21
22#ifndef PLATFORM_H__
23#define PLATFORM_H__
24
25/** @file
26* @brief
27*/
28
29//Board dependent defines
30#if defined (__AVR__)
31 //For Arduino this AVR specific library has to be used for reading from Flash memory
32 #include <avr/pgmspace.h>
33 #include "Arduino.h"
34 #ifdef PROGMEM
35 #undef PROGMEM
36 #define PROGMEM __attribute__(( section(".progmem.data") ))
37 #endif
38#elif defined(__PIC32MX__)
39 //For Chipkit add the following libraries.
40 #include <stdint.h>
41 #include <stdbool.h>
42 #include <string.h>
43 #include <wiring.h>
44 #include <WProgram.h>
45#else /* GCC */
46 #include <kernel.h>
47 #include <t_syslog.h>
48 #include <t_stdlib.h>
49 #include <stdbool.h>
50 #include <stdio.h>
51 #include <string.h>
52 #include <target_syssvc.h>
53 #include "syssvc/serial.h"
54 #include "syssvc/syslog.h"
55 #include "device.h"
56 #include "pinmode.h"
57 #include "spi.h"
58
59 #define delay dly_tsk
60 #define noInterrupts loc_cpu
61 #define interrupts unl_cpu
62
63 #define sil_orw_mem(a, b) sil_wrw_mem((a), sil_rew_mem(a) | (b))
64
65#define PORT_HIGH 1
66#define PORT_LOW 0
67
68#define LOW PORT_LOW
69#define HIGH PORT_HIGH
70
71#define INPUT 0
72#define INPUT_PULLUP 1
73#define OUTPUT 2
74
75#endif
76
77 //For making the Serial.Print compatible between Arduino and Chipkit
78 #define F(X) (X)
79
80 //For ChipKit neither PROGMEM or PSTR are needed for PIC32
81 #define PROGMEM
82 #define PSTR(s) (s)
83
84 #define pgm_read_byte(x) (*((char *)x))
85 #define pgm_read_byte_near(x) (*((char *)x))
86 #define pgm_read_byte_far(x) (*((char *)x))
87 #define pgm_read_word(x) (*((short *)x))
88 #define pgm_read_word_near(x) (*((short *)x))
89 #define pgm_read_workd_far(x) (*((short *)x))
90
91 #define prog_void const void
92 #define prog_char const char
93 #define prog_uchar const unsigned char
94 #define prog_int8_t const int8_t
95 #define prog_uint8_t const uint8_t
96 #define prog_int16_t const int16_t
97 #define prog_uint16_t const uint16_t
98 #define prog_int32_t const int32_t
99 #define prog_uint32_t const uint32_t
100 #define prog_int64_t const int64_t
101 #define prog_uint64_t const uint64_t
102
103 //Redefine the function for reading from flash in ChipKit
104 #define memcpy_P memcpy
105
106#endif /* PLATFORM_H__ */
Note: See TracBrowser for help on using the repository browser.