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


ess_imu_driver
Author(s):
autogenerated on Wed Dec 11 2024 03:06:30