1
- /* ----------------------------------------------------------------------------
2
- * ATMEL Microcontroller Software Support
3
- * ----------------------------------------------------------------------------
4
- * Copyright (c) 2010, Atmel Corporation
5
- *
6
- * All rights reserved.
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions are met:
10
- *
11
- * - Redistributions of source code must retain the above copyright notice,
12
- * this list of conditions and the disclaimer below.
13
- *
14
- * Atmel's name may not be used to endorse or promote products derived from
15
- * this software without specific prior written permission.
16
- *
17
- * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20
- * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- * ----------------------------------------------------------------------------
28
- */
1
+ /*
2
+ Copyright (c) 2013 Arduino. All right reserved.
3
+
4
+ This library is free software; you can redistribute it and/or
5
+ modify it under the terms of the GNU Lesser General Public
6
+ License as published by the Free Software Foundation; either
7
+ version 2.1 of the License, or (at your option) any later version.
8
+
9
+ This library 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.
12
+ See the GNU Lesser General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Lesser General Public
15
+ License along with this library; if not, write to the Free Software
16
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
29
19
/**
30
20
* \file
31
21
*
46
36
*/
47
37
extern uint32_t SN65HVD234_Init ( SSN65HVD234_Data * pComponent )
48
38
{
49
- pComponent -> pPIO_Rs = NULL ;
50
39
pComponent -> dwPin_Rs = 0u ;
51
-
52
- pComponent -> pPIO_EN = NULL ;
53
40
pComponent -> dwPin_EN = 0u ;
54
41
55
42
return 0u ;
@@ -64,12 +51,11 @@ extern uint32_t SN65HVD234_Init( SSN65HVD234_Data* pComponent )
64
51
*
65
52
* \return 0 if OK
66
53
*/
67
- extern uint32_t SN65HVD234_SetRs ( SSN65HVD234_Data * pComponent , Pio * pPIO_Rs , uint32_t dwPin_Rs )
54
+ extern uint32_t SN65HVD234_SetRs ( SSN65HVD234_Data * pComponent , uint32_t dwPin_Rs )
68
55
{
69
- pComponent -> pPIO_Rs = pPIO_Rs ;
70
56
pComponent -> dwPin_Rs = dwPin_Rs ;
71
57
72
- PIO_SetOutput ( pPIO_Rs , dwPin_Rs , 0 , 0 , 1 ) ;
58
+ pinMode ( dwPin_Rs , OUTPUT ) ;
73
59
74
60
return 0u ;
75
61
}
@@ -83,12 +69,11 @@ extern uint32_t SN65HVD234_SetRs( SSN65HVD234_Data* pComponent, Pio* pPIO_Rs, ui
83
69
*
84
70
* \return 0 if OK
85
71
*/
86
- extern uint32_t SN65HVD234_SetEN ( SSN65HVD234_Data * pComponent , Pio * pPIO_EN , uint32_t dwPin_EN )
72
+ extern uint32_t SN65HVD234_SetEN ( SSN65HVD234_Data * pComponent , uint32_t dwPin_EN )
87
73
{
88
- pComponent -> pPIO_EN = pPIO_EN ;
89
74
pComponent -> dwPin_EN = dwPin_EN ;
90
75
91
- PIO_SetOutput ( pPIO_EN , dwPin_EN , 0 , 0 , 1 ) ;
76
+ pinMode ( dwPin_EN , OUTPUT ) ;
92
77
93
78
return 0u ;
94
79
}
@@ -103,7 +88,7 @@ extern uint32_t SN65HVD234_SetEN( SSN65HVD234_Data* pComponent, Pio* pPIO_EN, ui
103
88
extern uint32_t SN65HVD234_Enable ( SSN65HVD234_Data * pComponent )
104
89
{
105
90
// Raise EN of SN65HVD234 to High Level (Vcc)
106
- pComponent -> pPIO_EN -> PIO_SODR = pComponent -> dwPin_EN ;
91
+ digitalWrite ( pComponent -> dwPin_EN , HIGH ) ;
107
92
108
93
return 0u ;
109
94
}
@@ -118,7 +103,7 @@ extern uint32_t SN65HVD234_Enable( SSN65HVD234_Data* pComponent )
118
103
extern uint32_t SN65HVD234_Disable ( SSN65HVD234_Data * pComponent )
119
104
{
120
105
// Lower EN of SN65HVD234 to Low Level (0.0v)
121
- pComponent -> pPIO_EN -> PIO_CODR = pComponent -> dwPin_EN ;
106
+ digitalWrite ( pComponent -> dwPin_EN , LOW ) ;
122
107
123
108
return 0u ;
124
109
}
@@ -133,7 +118,7 @@ extern uint32_t SN65HVD234_Disable( SSN65HVD234_Data* pComponent )
133
118
extern uint32_t SN65HVD234_EnableLowPower ( SSN65HVD234_Data * pComponent )
134
119
{
135
120
// Raise Rs of SN65HVD234 to more than 0.75v
136
- pComponent -> pPIO_Rs -> PIO_SODR = pComponent -> dwPin_Rs ;
121
+ digitalWrite ( pComponent -> dwPin_Rs , HIGH ) ;
137
122
138
123
// Now, SN65HVD234 is only listening
139
124
@@ -150,7 +135,7 @@ extern uint32_t SN65HVD234_EnableLowPower( SSN65HVD234_Data* pComponent )
150
135
extern uint32_t SN65HVD234_DisableLowPower ( SSN65HVD234_Data * pComponent )
151
136
{
152
137
// Lower Rs of SN65HVD234 to 0.0v < 0.33v
153
- pComponent -> pPIO_Rs -> PIO_CODR = pComponent -> dwPin_Rs ;
138
+ digitalWrite ( pComponent -> dwPin_Rs , LOW ) ;
154
139
155
140
return 0u ;
156
141
}
0 commit comments