-
Notifications
You must be signed in to change notification settings - Fork 0
/
hcl_rpi.c
67 lines (61 loc) · 2.87 KB
/
hcl_rpi.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//==============================================================================
//
// hcl_rpi.c - Seiko Epson Hardware Control Library
//
// This layer of indirection is added to allow the sample code to call
// generic functions to work on multiple hardware platforms. This is the
// Raspberry Pi specific implementation which uses the wiringPi library,
// whose init needs to be called.
//
//
// THE SOFTWARE IS RELEASED INTO THE PUBLIC DOMAIN.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// NONINFRINGEMENT, SECURITY, SATISFACTORY QUALITY, AND FITNESS FOR A
// PARTICULAR PURPOSE. IN NO EVENT SHALL EPSON BE LIABLE FOR ANY LOSS, DAMAGE
// OR CLAIM, ARISING FROM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE
// SOFTWARE.
//
//==============================================================================
#include <stdint.h>
#include <stdio.h>
#include <wiringPi.h>
#include "hcl.h"
/*****************************************************************************
** Function name: seInit
** Description: Initialize the Seiko Epson Hardware Control Library
** In this case, we initialize the wiringPi library.
** Parameters: None
** Return value: OK if successful, otherwise NG
*****************************************************************************/
int seInit(void) {
// Initialize wiringPi libraries
printf("...Initializing wiringPI library...");
if (wiringPiSetupGpio() != 0) {
printf("\r\nError: could not initialize wiringPI library. Exiting...\r\n");
return NG;
}
printf("...done.");
return OK;
}
/*****************************************************************************
** Function name: seRelease
** Description: Release any resources held by this module.
** Parameters: None
** Return value: OK
*****************************************************************************/
int seRelease(void) { return OK; }
/*****************************************************************************
** Function name: seDelayMS
** Description: Generates software delay in milliseconds.
** Parameters: Delay value in milliseconds
** Return value: None
*****************************************************************************/
void seDelayMS(uint32_t millis) { delay(millis); }
/*****************************************************************************
** Function name: seDelayMicroSecs
** Description: Generates software delay in microseconds.
** Parameters: Delay value in microseconds
** Return value: None
*****************************************************************************/
void seDelayMicroSecs(uint32_t micros) { delayMicroseconds(micros); }