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