OneWay  3.0-3-ge9d4fa4
htv.h
Go to the documentation of this file.
1 /* This file is part of OneWay
2  * Copyright (C) 2010, 2011 Enrico Rossi
3  *
4  * OneWay is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * OneWay is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
22 #ifndef HTV_H
23 #define HTV_H
24 
26 #define MAX_CMD_LENGHT 20
27 
28 #define MAX_SUBSTR_LENGHT 10
29 
30 /*#define HTV_USE_RTX */
32 #define AU_PORT PORTA
33 
34 #define AU_DDR DDRA
35 
36 #define AU_ENABLE PA5
37 
38 #define AU_TXRX PA6
39 
41 struct htv_t {
43  uint16_t address;
45  uint8_t pin;
47  uint8_t cmd;
49  uint8_t crc;
51  char *x10str;
53  char *substr;
55  uint16_t ee_addr;
56 };
57 
58 void htv_store_address(struct htv_t *htv);
59 struct htv_t *htv_init(struct htv_t *htv);
60 void htv_free(struct htv_t *htv);
61 uint8_t crc8_str(const char *str);
62 uint8_t htv_check_cmd(struct htv_t *htv);
63 
64 #endif
Definition: htv.h:41
uint16_t ee_addr
Definition: htv.h:55
void htv_free(struct htv_t *htv)
free the htv struct.
Definition: htv.c:62
char * substr
Definition: htv.h:53
uint8_t crc
Definition: htv.h:49
uint16_t address
Definition: htv.h:43
uint8_t crc8_str(const char *str)
return the crc8 of the string.
Definition: htv.c:73
uint8_t htv_check_cmd(struct htv_t *htv)
check the validity of the x10str command string.
Definition: htv.c:150
uint8_t pin
Definition: htv.h:45
char * x10str
Definition: htv.h:51
uint8_t cmd
Definition: htv.h:47
void htv_store_address(struct htv_t *htv)
store the address of the unit in EEPROM.
Definition: htv.c:38
struct htv_t * htv_init(struct htv_t *htv)
initialize the htv struct
Definition: htv.c:45