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+
2919/**
3020 * \file
3121 *
4636 */
4737extern uint32_t SN65HVD234_Init ( SSN65HVD234_Data * pComponent )
4838{
49- pComponent -> pPIO_Rs = NULL ;
5039 pComponent -> dwPin_Rs = 0u ;
51-
52- pComponent -> pPIO_EN = NULL ;
5340 pComponent -> dwPin_EN = 0u ;
5441
5542 return 0u ;
@@ -64,12 +51,11 @@ extern uint32_t SN65HVD234_Init( SSN65HVD234_Data* pComponent )
6451 *
6552 * \return 0 if OK
6653 */
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 )
6855{
69- pComponent -> pPIO_Rs = pPIO_Rs ;
7056 pComponent -> dwPin_Rs = dwPin_Rs ;
7157
72- PIO_SetOutput ( pPIO_Rs , dwPin_Rs , 0 , 0 , 1 ) ;
58+ pinMode ( dwPin_Rs , OUTPUT ) ;
7359
7460 return 0u ;
7561}
@@ -83,12 +69,11 @@ extern uint32_t SN65HVD234_SetRs( SSN65HVD234_Data* pComponent, Pio* pPIO_Rs, ui
8369 *
8470 * \return 0 if OK
8571 */
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 )
8773{
88- pComponent -> pPIO_EN = pPIO_EN ;
8974 pComponent -> dwPin_EN = dwPin_EN ;
9075
91- PIO_SetOutput ( pPIO_EN , dwPin_EN , 0 , 0 , 1 ) ;
76+ pinMode ( dwPin_EN , OUTPUT ) ;
9277
9378 return 0u ;
9479}
@@ -103,7 +88,7 @@ extern uint32_t SN65HVD234_SetEN( SSN65HVD234_Data* pComponent, Pio* pPIO_EN, ui
10388extern uint32_t SN65HVD234_Enable ( SSN65HVD234_Data * pComponent )
10489{
10590 // Raise EN of SN65HVD234 to High Level (Vcc)
106- pComponent -> pPIO_EN -> PIO_SODR = pComponent -> dwPin_EN ;
91+ digitalWrite ( pComponent -> dwPin_EN , HIGH ) ;
10792
10893 return 0u ;
10994}
@@ -118,7 +103,7 @@ extern uint32_t SN65HVD234_Enable( SSN65HVD234_Data* pComponent )
118103extern uint32_t SN65HVD234_Disable ( SSN65HVD234_Data * pComponent )
119104{
120105 // Lower EN of SN65HVD234 to Low Level (0.0v)
121- pComponent -> pPIO_EN -> PIO_CODR = pComponent -> dwPin_EN ;
106+ digitalWrite ( pComponent -> dwPin_EN , LOW ) ;
122107
123108 return 0u ;
124109}
@@ -133,7 +118,7 @@ extern uint32_t SN65HVD234_Disable( SSN65HVD234_Data* pComponent )
133118extern uint32_t SN65HVD234_EnableLowPower ( SSN65HVD234_Data * pComponent )
134119{
135120 // Raise Rs of SN65HVD234 to more than 0.75v
136- pComponent -> pPIO_Rs -> PIO_SODR = pComponent -> dwPin_Rs ;
121+ digitalWrite ( pComponent -> dwPin_Rs , HIGH ) ;
137122
138123 // Now, SN65HVD234 is only listening
139124
@@ -150,7 +135,7 @@ extern uint32_t SN65HVD234_EnableLowPower( SSN65HVD234_Data* pComponent )
150135extern uint32_t SN65HVD234_DisableLowPower ( SSN65HVD234_Data * pComponent )
151136{
152137 // Lower Rs of SN65HVD234 to 0.0v < 0.33v
153- pComponent -> pPIO_Rs -> PIO_CODR = pComponent -> dwPin_Rs ;
138+ digitalWrite ( pComponent -> dwPin_Rs , LOW ) ;
154139
155140 return 0u ;
156141}
0 commit comments