1 /*
2  * \file
3  *
4  * \brief ATSHA204 header file for the I2C layer for the device
5  *
6  *
7  * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved.
8  *
9  * \asf_license_start
10  *
11  * \page License
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  *
16  * 1. Redistributions of source code must retain the above copyright notice,
17  *    this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright notice,
20  *    this list of conditions and the following disclaimer in the documentation
21  *    and/or other materials provided with the distribution.
22  *
23  * 3. The name of Atmel may not be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * 4. This software may only be redistributed and used in connection with an
27  *    Atmel microcontroller product.
28  *
29  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
30  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
32  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
33  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39  * POSSIBILITY OF SUCH DAMAGE.
40  *
41  * \asf_license_stop
42  *
43  */
44 /*
45  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
46  */
47 
48 #ifndef SHA204_PHYSICAL_H
49 #   define SHA204_PHYSICAL_H
50 
51 #include "sha204_config.h"                           //!< configuration values
52 
53 #define SHA204_RSP_SIZE_MIN          ((uint8_t)  4)  //!< minimum number of bytes in response
54 #define SHA204_RSP_SIZE_MAX          ((uint8_t) 35)  //!< maximum size of response packet
55 
56 #define SHA204_BUFFER_POS_COUNT      (0)             //!< buffer index of count byte in command or response
57 #define SHA204_BUFFER_POS_DATA       (1)             //!< buffer index of data in response
58 
59 //! delay between Wakeup pulse and communication in ms
60 #define SHA204_WAKEUP_DELAY          (3)
61 /**
62  * \defgroup sha204_communication_physical_group SHA204 Service - hardware dependent communication functions
63  *
64  * @{
65  */
66 void    sha204p_init(void);
67 void    sha204p_set_device_id(uint8_t id);
68 uint8_t sha204p_send_command(uint8_t count, uint8_t *command);
69 uint8_t sha204p_receive_response(uint8_t size, uint8_t *response);
70 uint8_t sha204p_wakeup(void);
71 uint8_t sha204p_idle(void);
72 uint8_t sha204p_sleep(void);
73 uint8_t sha204p_reset_io(void);
74 uint8_t sha204p_resync(uint8_t size, uint8_t *response);
75 //! @}
76 
77 #endif
78