-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCore.h
112 lines (93 loc) · 2.12 KB
/
Core.h
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef _CORE_H_
#define _CORE_H_
/*! \mainpage Documentation for the chipKIT pic32lib by PONTECH
*
* \section intro_sec Introduction
*
* These libraries were built to support PONTECH Quick240 product but
* other chipKIT users may find them useful as well.
*
* \section install_sec Installation
* These libraries are available for cloning or forking at https://github.com/pontech/pic32lib
*
*/
/*
CPU Type = 32MX795F512L
size of char = 1
size of short = 2
size of int = 4
size of long = 4
size of ull = 8
size of float = 4
size of double= 4
size of void* = 4
*/
//typedef bool us1;
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
//typedef signed long s64;
typedef unsigned char us8;
typedef unsigned short us16;
typedef unsigned int us32;
//typedef unsigned long us64;
#warning "PIC32 Arduino: don't know how to make reset(),nop(),clear_wdt(),us1,fptr,fptr_us8"
//typedef enum {false = 0, true} us1;
typedef void (*fptr)(void);
typedef void (*fptr_us8)(us8);
typedef enum {
data_out = 0,
data_in = 1
} data_direction;
typedef unsigned char bcd8;
typedef union {
us8 value;
} uus8;
typedef struct {
uus8 lo;
uus8 hi;
} sus16;
typedef union {
us16 value;
sus16 parts;
} uus16;
typedef struct {
uus16 lo;
uus16 hi;
} sus32;
typedef union {
us32 value;
sus32 parts;
} uus32;
//uus32.value = 0x12345678
//uus32.parts.hi.value = 0x1234
//uus32.parts.lo.value = 0x5678
//uus32.parts.hi.parts.hi = 0x12
//uus32.parts.hi.parts.lo = 0x34
//uus32.parts.lo.parts.hi = 0x56
//uus32.parts.lo.parts.lo = 0x78
typedef uus32 lba;
typedef uus32 fat;
typedef struct packed_int {
unsigned char b0 :1;
unsigned char b1 :1;
unsigned char b2 :1;
unsigned char b3 :1;
unsigned char b4 :1;
unsigned char b5 :1;
unsigned char b6 :1;
unsigned char b7 :1;
unsigned char b8 :1;
unsigned char b9 :1;
unsigned char b10 :1;
unsigned char b11 :1;
unsigned char b12 :1;
unsigned char b13 :1;
unsigned char b14 :1;
unsigned char b15 :1;
} packed_int;
typedef union {
unsigned int i;
packed_int b;
} packed;
#endif