Mistake on this page?
Report an issue in GitHub or email us
H4TransportDriver.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-2017 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef IMPL_H4_TRANSPORT_DRIVER_H_
18 #define IMPL_H4_TRANSPORT_DRIVER_H_
19 
20 #if (DEVICE_SERIAL && DEVICE_SERIAL_FC) || defined(DOXYGEN_ONLY)
21 
22 #include <cstdint>
23 #include "drivers/UnbufferedSerial.h"
24 #include "ble/driver/CordioHCITransportDriver.h"
25 
26 namespace ble {
27 
28 /**
29  * Implementation of the H4 driver.
30  *
31  * @note This HCI transport implementation is not accessible to devices that do
32  * not expose serial flow control.
33  */
35 public:
36  /**
37  * Initialize the transport driver.
38  *
39  * @param tx tx pin name.
40  * @param rx rx pin name
41  * @param cts cts pin name
42  * @param rts rts pin name.
43  * @param baud baud use to communicate with the ble module
44  */
45  H4TransportDriver(PinName tx, PinName rx, PinName cts, PinName rts, int baud);
46 
47  /**
48  * Destructor
49  */
50  ~H4TransportDriver() override = default;
51 
52  /**
53  * @see CordioHCITransportDriver::initialize
54  */
55  void initialize() override;
56 
57  /**
58  * @see CordioHCITransportDriver::terminate
59  */
60  void terminate() override;
61 
62  /**
63  * @see CordioHCITransportDriver::write
64  */
65  uint16_t write(uint8_t type, uint16_t len, uint8_t *pData) override;
66 
67 private:
68  void on_controller_irq();
69 
70  // Use UnbufferedSerial as we don't require locking primitives.
71  // We access the peripheral in interrupt context.
73  PinName cts;
74  PinName rts;
75 };
76 
77 } // namespace ble
78 
79 #endif
80 
81 #endif /* IMPL_H4_TRANSPORT_DRIVER_H_ */
void initialize() override
uint16_t write(uint8_t type, uint16_t len, uint8_t *pData) override
Base class of the HCI transport driver.
Class implementation for unbuffered I/O for an interrupt driven application or one that needs to have...
void terminate() override
~H4TransportDriver() override=default
Destructor.
Implementation of the H4 driver.
H4TransportDriver(PinName tx, PinName rx, PinName cts, PinName rts, int baud)
Initialize the transport driver.
Entry namespace for all BLE API definitions.
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.