Main Page
Classes
Class List
Class Members
All
a
c
d
e
f
g
h
i
m
n
o
p
q
r
s
t
Functions
Variables
a
c
d
e
f
g
h
i
m
n
o
p
q
r
t
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
u
v
w
Functions
c
d
g
i
m
n
o
p
r
s
u
w
Variables
Enumerations
Enumerator
Macros
a
b
c
d
e
f
m
n
o
r
s
v
w
src
hcl_gpio_rpi.c
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// hcl_gpio_rpi.c - Seiko Epson Hardware Control Library
4
//
5
// This layer of indirection is added to allow the sample code to call
6
// generic functions to work on multiple hardware platforms. This is the
7
// Raspberry Pi specific implementation for GPIO
8
//
9
//
10
// THE SOFTWARE IS RELEASED INTO THE PUBLIC DOMAIN.
11
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
// NONINFRINGEMENT, SECURITY, SATISFACTORY QUALITY, AND FITNESS FOR A
14
// PARTICULAR PURPOSE. IN NO EVENT SHALL EPSON BE LIABLE FOR ANY LOSS, DAMAGE
15
// OR CLAIM, ARISING FROM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE
16
// SOFTWARE.
17
//
18
//==============================================================================
19
20
#include <stdint.h>
21
#include <wiringPi.h>
22
23
#include "
hcl.h
"
24
#include "
hcl_gpio.h
"
25
26
/*****************************************************************************
27
** Function name: gpioInit
28
** Description: Initialize the RPI GPIO Interface.
29
** Delay for RESET incase it was asserted
30
** Parameters: None
31
** Return value: OK or NG
32
** Note: This function assumes seInit() has been called first to
33
** initialise the wiringPI Library
34
*****************************************************************************/
35
int
gpioInit
(
void
) {
36
pinMode(
EPSON_RESET
, OUTPUT);
37
pinMode(
EPSON_CS
, OUTPUT);
38
pinMode(
EPSON_DRDY
, INPUT);
39
pullUpDnControl(
EPSON_DRDY
, PUD_DOWN);
40
41
// Force outputs to inactive state
42
gpioSet
(
EPSON_RESET
);
// RESET pin HIGH
43
gpioSet
(
EPSON_CS
);
// CS pin HIGH
44
printf(
"...delay for GPIO pins..."
);
45
seDelayMS
(3000);
// incase of RESET
46
return
OK
;
47
}
48
49
/*****************************************************************************
50
** Function name: gpioRelease
51
** Description: Release the RPI GPIO Interface.
52
** Parameters: None
53
** Return value: OK
54
*****************************************************************************/
55
int
gpioRelease
(
void
) {
return
OK
; }
56
57
/*****************************************************************************
58
** Function name: gpioSet
59
** Description: Set the RPI GPIO pin level HIGH.
60
** Parameters: uint8_t pin
61
** Return value: None
62
*****************************************************************************/
63
void
gpioSet
(uint8_t pin) { digitalWrite(pin, HIGH); }
64
65
/*****************************************************************************
66
** Function name: gpioClr
67
** Description: Set the RPI GPIO pin level LOW.
68
** Parameters: uint8_t pin
69
** Return value: None
70
*****************************************************************************/
71
void
gpioClr
(uint8_t pin) { digitalWrite(pin, LOW); }
72
73
/*****************************************************************************
74
** Function name: gpioGetPinLevel
75
** Description: Get the RPI GPIO pin level.
76
** Parameters: uint8_t pin
77
** Return value: uint8_t level (1 or 0)
78
*****************************************************************************/
79
uint8_t
gpioGetPinLevel
(uint8_t pin) {
return
(digitalRead(pin)); }
gpioSet
void gpioSet(uint8_t pin)
Definition:
hcl_gpio_rpi.c:63
seDelayMS
void seDelayMS(uint32_t millis)
Definition:
hcl_linux.c:47
gpioInit
int gpioInit(void)
Definition:
hcl_gpio_rpi.c:35
EPSON_DRDY
#define EPSON_DRDY
Definition:
hcl_gpio.h:33
hcl_gpio.h
hcl.h
gpioClr
void gpioClr(uint8_t pin)
Definition:
hcl_gpio_rpi.c:71
EPSON_RESET
#define EPSON_RESET
Definition:
hcl_gpio.h:32
EPSON_CS
#define EPSON_CS
Definition:
hcl_gpio.h:34
gpioGetPinLevel
uint8_t gpioGetPinLevel(uint8_t pin)
Definition:
hcl_gpio_rpi.c:79
OK
#define OK
Definition:
hcl.h:26
gpioRelease
int gpioRelease(void)
Definition:
hcl_gpio_rpi.c:55
ess_imu_driver
Author(s):
autogenerated on Wed Dec 11 2024 03:06:30