/
main.h
105 lines (86 loc) · 3.82 KB
/
main.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
/* ******************************************************************************
* VSCP (Very Simple Control Protocol)
* http://www.vscp.org
*
* Accra Counter Module
* ====================
*
* Copyright (C)1995-2020 Ake Hedman, Grodans Paradis AB
* http://www.grodansparadis.com
* <akhe@grodansparadis.com>
*
* This work is licensed under the Creative Common
* Attribution-NonCommercial-ShareAlike 3.0 Unported license. The full
* license is available in the top folder of this project (LICENSE) or here
* http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
* It is also available in a human readable form here
* http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* This file is part of VSCP - Very Simple Control Protocol
* http://www.vscp.org
*
* ******************************************************************************
*/
#ifndef MAIN_H
#define MAIN_H
/*
// EEPROM Storage
#define VSCP_EEPROM_BOOTLOADER_FLAG 0x00 // Reserved for bootloader
#define VSCP_EEPROM_NICKNAME 0x01 // Persistant nickname id storage
#define VSCP_EEPROM_SEGMENT_CRC 0x02 // Persistant segment crc storage
#define VSCP_EEPROM_CONTROL 0x03 // Persistant control byte
#define VSCP_EEPROM_REG_USERID 0x04
#define VSCP_EEPROM_REG_USERID1 0x05
#define VSCP_EEPROM_REG_USERID2 0x06
#define VSCP_EEPROM_REG_USERID3 0x07
#define VSCP_EEPROM_REG_USERID4 0x08
// The following can be stored in flash or eeprom
#define VSCP_EEPROM_REG_MANUFACTUR_ID0 0x09
#define VSCP_EEPROM_REG_MANUFACTUR_ID1 0x0A
#define VSCP_EEPROM_REG_MANUFACTUR_ID2 0x0B
#define VSCP_EEPROM_REG_MANUFACTUR_ID3 0x0C
#define VSCP_EEPROM_REG_MANUFACTUR_SUBID0 0x0D
#define VSCP_EEPROM_REG_MANUFACTUR_SUBID1 0x0E
#define VSCP_EEPROM_REG_MANUFACTUR_SUBID2 0x0F
#define VSCP_EEPROM_REG_MANUFACTUR_SUBID3 0x10
// The following can be stored in program ROM (recommended) or in EEPROM
#define VSCP_EEPROM_REG_GUID 0x11 // Start of GUID MSB
// 0x11 - 0x20
#define VSCP_EEPROM_REG_DEVICE_URL 0x21 // Start of Device URL storage
// 0x21 - 0x40
#define VSCP_EEPROM_END 0x41 // marks end of VSCP EEPROM usage
*/ // (next free position)
// Function Prototypes
void doWork( void );
void init( void );
void init_app_ram( void );
void init_app_eeprom( void );
void read_app_register( unsigned char reg );
void write_app_register( unsigned char reg, unsigned char val );
void sendDMatrixInfo( void );
void SendInformationEvent( unsigned char idx, unsigned char eventClass, unsigned char eventTypeId );
void doDM( void );
void doActionOn( unsigned char dmflags, unsigned char arg );
void doActionOff( unsigned char dmflags, unsigned char arg );
void doActionPulse( unsigned char dmflags, unsigned char arg );
void doActionStatus( unsigned char dmflags, unsigned char arg );
void doActionDisable( unsigned char dmflags, unsigned char arg );
void doActionToggle( unsigned char dmflags, unsigned char arg );
void doApplicationOneSecondWork( void );
/*!
Send Extended ID CAN frame
@param id CAN extended ID for frame.
@param size Number of databytes 0-8
@param pData Pointer to databytes of frame.
@return TRUE (!=0) on success, FALSE (==0) on failure.
*/
int8_t sendCANFrame( uint32_t id, uint8_t size, uint8_t *pData );
/*!
Get extended ID CAN frame
@param pid Pointer to CAN extended ID for frame.
@param psize Pointer to number of databytes 0-8
@param pData Pointer to databytes of frame.
@return TRUE (!=0) on success, FALSE (==0) on failure.
*/
int8_t getCANFrame( uint32_t *pid, uint8_t *psize, uint8_t *pData );
#endif