Mistake on this page?
Report an issue in GitHub or email us
pal_io_exp.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief I/O expander driver definition.
6  *
7  * Copyright (c) 2019 Packetcraft, Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 /*************************************************************************************************/
22 
23 #ifndef PAL_IO_EXP_H
24 #define PAL_IO_EXP_H
25 
26 #include "pal_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*! \addtogroup PAL_IO_EXP
33  * \{ */
34 
35 /**************************************************************************************************
36  Data Types
37 **************************************************************************************************/
38 
39 /*! \brief Read register completion callback. */
40 typedef void (*PalIoExpRdRegCompCback_t)(bool_t status, uint8_t portValue);
41 
42 /*! \brief Write register completion callback. */
43 typedef void (*PalIoExpWrRegCompCback_t)(bool_t status);
44 
45 /*! \brief Operational states. */
46 typedef enum
47 {
48  PAL_IO_EXP_STATE_UNINIT = 0, /*!< Uninitialized state. */
49  PAL_IO_EXP_STATE_ERROR = 0, /*!< Error state. */
50  PAL_IO_EXP_STATE_INIT = 1, /*!< Initialized state. */
51  PAL_IO_EXP_STATE_READY = 2, /*!< Ready state. */
52  PAL_IO_EXP_STATE_BUSY = 3, /*!< Busy state. */
54 
55 /*! \brief Operations. */
56 typedef enum
57 {
58  PAL_IO_EXP_OP_INPUT = 0x00, /*!< Input Port. Read only. */
59  PAL_IO_EXP_OP_OUTPUT = 0x01, /*!< Output Port. Read/write. */
60  PAL_IO_EXP_OP_POL_INV = 0x02, /*!< Polarity Inversion. Read/write. */
61  PAL_IO_EXP_OP_CONFIG = 0x03 /*!< Configuration. Read/write. */
62 } PalIoOp_t;
63 
64 /**************************************************************************************************
65  Function Declarations
66 **************************************************************************************************/
67 
68 /* Initialization */
69 void PalIoExpInit(void);
70 void PalIoExpDeInit(void);
71 uint8_t PalIoExpRegisterDevice(uint8_t subAddr);
72 void PalIoExpRegisterCback(uint8_t devHandle, PalIoExpRdRegCompCback_t rdCback, PalIoExpWrRegCompCback_t wrCback);
73 
74 /* Control and Status */
75 PalIoExpState_t PalIoExpGetState(uint8_t devHandle);
76 
77 /* Data transfer */
78 void PalIoExpRead(uint8_t devHandle, PalIoOp_t op);
79 void PalIoExpWrite(uint8_t devHandle, PalIoOp_t op, uint8_t value);
80 
81 /*! \} */ /* PAL_IO_EXP */
82 
83 #ifdef __cplusplus
84 };
85 #endif
86 
87 #endif /* PAL_IO_EXP_H */
PalIoExpState_t
Operational states.
Definition: pal_io_exp.h:46
Platform-independent data types.
void(* PalIoExpWrRegCompCback_t)(uint8_t status)
Write register completion callback.
Definition: pal_io_exp.h:43
void(* PalIoExpRdRegCompCback_t)(uint8_t status, uint8_t portValue)
Read register completion callback.
Definition: pal_io_exp.h:40
PalIoOp_t
Operations.
Definition: pal_io_exp.h:56
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.