Mistake on this page?
Report an issue in GitHub or email us
pal_radio2.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Radio interface file.
6  *
7  * Copyright (c) 2019-2020 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_RADIO_H
24 #define PAL_RADIO_H
25 
26 #include <stdint.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*! \addtogroup PAL_RADIO
33  * \{ */
34 
35 /**************************************************************************************************
36  Macros
37 **************************************************************************************************/
38 
39 /* Use this to enable debugging stuff */
40 #define PAL_RADIO_DEBUG
41 
42 /**************************************************************************************************
43  Data Types
44 **************************************************************************************************/
45 
46 typedef enum
47 {
48  PAL_RADIO_STATE_UNINIT = 0, /*!< Uninitialized state. */
49  PAL_RADIO_STATE_ERROR = 0, /*!< Error state. */
50  PAL_RADIO_STATE_IDLE, /*!< Idle state. */
51  PAL_RADIO_STATE_TX, /*!< Tx state. */
52  PAL_RADIO_STATE_RX, /*!< Rx state. */
53  PAL_RADIO_STATE_DIAG /*!< Diagnostics state. */
55 
56 typedef enum
57 {
58  PAL_RADIO_STATUS_SUCCESS, /*!< Operation completed successfully. */
59  PAL_RADIO_STATUS_FAILED, /*!< General failure. */
60  PAL_RADIO_STATUS_TIMEOUT, /*!< Rx timed out. */
61  PAL_RADIO_STATUS_CRC_FAILED /*!< Rx CRC match failed. */
63 
64 typedef enum
65 {
66  PAL_RADIO_PHY_1M, /*!< 1M PHY. */
67  PAL_RADIO_PHY_2M, /*!< 2M PHY. */
68  PAL_RADIO_PHY_CODED_DEFAULT, /*!< Coded with options not specified. */
69  PAL_RADIO_PHY_CODED_S2, /*!< Coded S2 PHY (500-kbps). */
70  PAL_RADIO_PHY_CODED_S8 /*!< Coded S8 PHY (128-kbps). */
72 
73 /*! \brief Tx completion call signature. */
74 typedef void (*PalRadioTxComp_t)(PalRadioStatus_t status);
75 
76 /*! \brief Rx completion call signature. */
77 typedef void (*PalRadioRxComp_t)(PalRadioStatus_t status, uint32_t tstamp, PalRadioPhy_t phy, int8_t rssi);
78 
79 /**************************************************************************************************
80  Functions
81 **************************************************************************************************/
82 
83 /* Initialization */
84 void PalRadioInit(void);
85 void PalRadioDeInit(void);
86 
87 /* Control and Status */
88 void PalRadioRegisterTxComplete(PalRadioTxComp_t cback);
89 void PalRadioRegisterRxComplete(PalRadioRxComp_t cback);
90 void PalRadioSetAccessAddress(uint32_t addr);
91 void PalRadioSetCrcInit(uint32_t crcInit);
92 void PalRadioSetChannel(uint8_t chIdx);
93 void PalRadioSetTxPower(int8_t level);
94 int8_t PalRadioGetTxPower(void);
95 void PalRadioSetPhy(PalRadioPhy_t txPhy, PalRadioPhy_t rxPhy);
96 void PalRadioSetDataWhitening(uint8_t ena);
97 void PalRadioSetPrbs15(uint8_t ena);
98 PalRadioState_t PalRadioGetState(void);
99 
100 /* Data Transfer */
101 void PalRadioTxStart(uint32_t dueTime);
102 void PalRadioTxNext(uint32_t offsUsec);
103 void PalRadioTxData(uint8_t *pBuf, uint16_t len);
104 void PalRadioRxStart(uint32_t dueTime, uint32_t rxTimeoutUsec);
105 void PalRadioRxNext(uint32_t offsUsec, uint32_t rxTimeoutUsec);
106 void PalRadioRxData(uint8_t *pBuf, uint16_t len);
107 void PalRadioStop(void);
108 
109 /*! \} */ /* PAL_RADIO */
110 
111 #ifdef __cplusplus
112 };
113 #endif
114 
115 #endif /* PAL_RADIO_H */
PalRadioPhy_t
Definition: pal_radio2.h:64
void(* PalRadioRxComp_t)(PalRadioStatus_t status, uint32_t tstamp, PalRadioPhy_t phy, int8_t rssi)
Rx completion call signature.
Definition: pal_radio2.h:77
PalRadioStatus_t
Definition: pal_radio2.h:56
void(* PalRadioTxComp_t)(PalRadioStatus_t status)
Tx completion call signature.
Definition: pal_radio2.h:74
PalRadioState_t
Definition: pal_radio2.h:46
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.