-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodule.h
More file actions
121 lines (96 loc) · 3.92 KB
/
module.h
File metadata and controls
121 lines (96 loc) · 3.92 KB
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
112
113
114
115
116
117
118
119
120
/*
Routines for CBUS FLiM operations - part of CBUS libraries for PIC 18F
This work is licensed under the:
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit:
http://creativecommons.org/licenses/by-nc-sa/4.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
License summary:
You are free to:
Share, copy and redistribute the material in any medium or format
Adapt, remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the license terms.
Attribution : You must give appropriate credit, provide a link to the license,
and indicate if changes were made. You may do so in any reasonable manner,
but not in any way that suggests the licensor endorses you or your use.
NonCommercial : You may not use the material for commercial purposes. **(see note below)
ShareAlike : If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions : You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
** For commercial use, please contact the original copyright holder(s) to agree licensing terms
**************************************************************************************************************
The FLiM routines have no code or definitions that are specific to any
module, so they can be used to provide FLiM facilities for any module
using these libraries.
*/
/*
* File: module.h
* Author: Ian
*
* The CBUS library files include this module specific header.
* This is the means to isolate dependencies between the library and the module
* specific code. All the dependencies of the library on the module specific code
* should be defined in this file.
*
* In particular EEPROM, NV and Event definitions should be here or included from here.
*
* Created on 15 April 2017, 21:33
*/
#ifndef MODULE_H
#define MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************** MODULE OPTIONS **************************/
// BOOTLOADER
#define BOOTLOADER_PRESENT
// We'll be using event hash tables for fast access - at the expense of some RAM
//#define HASH_TABLE
// enable this for additional validation checks
//#define SAFETY
// Whether NVs are cached in RAM
//#define NV_CACHE
/************************* END OF OPTIONS ************************/
// Whether the module uses high or low priority for CAN interrupts
// set to 0 for LP. Set to 0xFF for HP
#define CAN_INTERRUPT_PRIORITY 0 // all low priority
#define ACTION_T unsigned char
#define HAPPENING_T unsigned char
#include "computeNv.h"
#include "computeEEPROM.h"
#include "rules.h"
/* callback definitions from CBUSlib back into the application */
#define APP_addEvent addEvent // No need for adding EV callback
/*
* EVENTS
*/
typedef struct {
BYTE dataIndex;
} COMPUTE_ACTION_T;
#include "computeEvents.h"
/*
* FLASH bounds
*/
#define MIN_WRITEABLE_FLASH ((int)(AT_NVPTR)&0xFFC0)
#ifdef __18F25K80
#define MAX_WRITEABLE_FLASH 0x7FFF
#endif
#ifdef __18F26K80
#define MAX_WRITEABLE_FLASH 0xFFFF
#endif
#include "cancompute.h"
/*
* Actions
*/
#define ACTION_QUEUE_SIZE 16 // The size needs to be big enough to store all the pending actions
// Need to allow +1 to separate the ends of the cyclic buffer so need to
// move the next power of two since cyclic wrapping is done with a bitmask.
// 16 is safer as we have wait actions
#define NUM_ACTION_QUEUES 6
#define TIMED_RESPONSE
extern WORD globalTimeStamp;
#ifdef __cplusplus
}
#endif
#endif /* MODULE_H */