mbed base bard check program for BlueTooth USB dongle module (3 switches, 6 leds, I2C LCD, A/D)
Fork of BTstack by
BTstack/bt_control.h@3:7b7d1273e2d5, 2016-10-17 (annotated)
- Committer:
- tamaki
- Date:
- Mon Oct 17 00:25:18 2016 +0000
- Revision:
- 3:7b7d1273e2d5
- Parent:
- 0:1ed23ab1345f
mbed base bard check program
; for BlueTooth USB dongle module
; (3 switches, 6 leds, I2C LCD, A/D)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:1ed23ab1345f | 1 | /* |
va009039 | 0:1ed23ab1345f | 2 | * Copyright (C) 2009-2012 by Matthias Ringwald |
va009039 | 0:1ed23ab1345f | 3 | * |
va009039 | 0:1ed23ab1345f | 4 | * Redistribution and use in source and binary forms, with or without |
va009039 | 0:1ed23ab1345f | 5 | * modification, are permitted provided that the following conditions |
va009039 | 0:1ed23ab1345f | 6 | * are met: |
va009039 | 0:1ed23ab1345f | 7 | * |
va009039 | 0:1ed23ab1345f | 8 | * 1. Redistributions of source code must retain the above copyright |
va009039 | 0:1ed23ab1345f | 9 | * notice, this list of conditions and the following disclaimer. |
va009039 | 0:1ed23ab1345f | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
va009039 | 0:1ed23ab1345f | 11 | * notice, this list of conditions and the following disclaimer in the |
va009039 | 0:1ed23ab1345f | 12 | * documentation and/or other materials provided with the distribution. |
va009039 | 0:1ed23ab1345f | 13 | * 3. Neither the name of the copyright holders nor the names of |
va009039 | 0:1ed23ab1345f | 14 | * contributors may be used to endorse or promote products derived |
va009039 | 0:1ed23ab1345f | 15 | * from this software without specific prior written permission. |
va009039 | 0:1ed23ab1345f | 16 | * 4. Any redistribution, use, or modification is done solely for |
va009039 | 0:1ed23ab1345f | 17 | * personal benefit and not for any commercial purpose or for |
va009039 | 0:1ed23ab1345f | 18 | * monetary gain. |
va009039 | 0:1ed23ab1345f | 19 | * |
va009039 | 0:1ed23ab1345f | 20 | * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS |
va009039 | 0:1ed23ab1345f | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
va009039 | 0:1ed23ab1345f | 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
va009039 | 0:1ed23ab1345f | 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS |
va009039 | 0:1ed23ab1345f | 24 | * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
va009039 | 0:1ed23ab1345f | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
va009039 | 0:1ed23ab1345f | 26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
va009039 | 0:1ed23ab1345f | 27 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
va009039 | 0:1ed23ab1345f | 28 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
va009039 | 0:1ed23ab1345f | 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
va009039 | 0:1ed23ab1345f | 30 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
va009039 | 0:1ed23ab1345f | 31 | * SUCH DAMAGE. |
va009039 | 0:1ed23ab1345f | 32 | * |
va009039 | 0:1ed23ab1345f | 33 | * Please inquire about commercial licensing options at btstack@ringwald.ch |
va009039 | 0:1ed23ab1345f | 34 | * |
va009039 | 0:1ed23ab1345f | 35 | */ |
va009039 | 0:1ed23ab1345f | 36 | |
va009039 | 0:1ed23ab1345f | 37 | /* |
va009039 | 0:1ed23ab1345f | 38 | * bt_control.h |
va009039 | 0:1ed23ab1345f | 39 | * |
va009039 | 0:1ed23ab1345f | 40 | * BT Control API -- allows BT Daemon to initialize and control differnt hardware |
va009039 | 0:1ed23ab1345f | 41 | * |
va009039 | 0:1ed23ab1345f | 42 | * Created by Matthias Ringwald on 5/19/09. |
va009039 | 0:1ed23ab1345f | 43 | * |
va009039 | 0:1ed23ab1345f | 44 | */ |
va009039 | 0:1ed23ab1345f | 45 | |
va009039 | 0:1ed23ab1345f | 46 | #pragma once |
va009039 | 0:1ed23ab1345f | 47 | |
va009039 | 0:1ed23ab1345f | 48 | #include <stdint.h> |
va009039 | 0:1ed23ab1345f | 49 | |
va009039 | 0:1ed23ab1345f | 50 | typedef enum { |
va009039 | 0:1ed23ab1345f | 51 | POWER_WILL_SLEEP = 1, |
va009039 | 0:1ed23ab1345f | 52 | POWER_WILL_WAKE_UP |
va009039 | 0:1ed23ab1345f | 53 | } POWER_NOTIFICATION_t; |
va009039 | 0:1ed23ab1345f | 54 | |
va009039 | 0:1ed23ab1345f | 55 | typedef struct { |
va009039 | 0:1ed23ab1345f | 56 | int (*on) (void *config); // <-- turn BT module on and configure |
va009039 | 0:1ed23ab1345f | 57 | int (*off) (void *config); // <-- turn BT module off |
va009039 | 0:1ed23ab1345f | 58 | int (*sleep)(void *config); // <-- put BT module to sleep - only to be called after ON |
va009039 | 0:1ed23ab1345f | 59 | int (*wake) (void *config); // <-- wake BT module from sleep - only to be called after SLEEP |
va009039 | 0:1ed23ab1345f | 60 | int (*valid)(void *config); // <-- test if hardware can be supported |
va009039 | 0:1ed23ab1345f | 61 | const char * (*name) (void *config); // <-- return hardware name |
va009039 | 0:1ed23ab1345f | 62 | |
va009039 | 0:1ed23ab1345f | 63 | /** support for UART baud rate changes - cmd has to be stored in hci_cmd_buffer |
va009039 | 0:1ed23ab1345f | 64 | * @return have command |
va009039 | 0:1ed23ab1345f | 65 | */ |
va009039 | 0:1ed23ab1345f | 66 | int (*baudrate_cmd)(void * config, uint32_t baudrate, uint8_t *hci_cmd_buffer); |
va009039 | 0:1ed23ab1345f | 67 | |
va009039 | 0:1ed23ab1345f | 68 | /** support custom init sequences after RESET command - cmd has to be stored in hci_cmd_buffer |
va009039 | 0:1ed23ab1345f | 69 | * @return have command |
va009039 | 0:1ed23ab1345f | 70 | */ |
va009039 | 0:1ed23ab1345f | 71 | int (*next_cmd)(void *config, uint8_t * hci_cmd_buffer); |
va009039 | 0:1ed23ab1345f | 72 | |
va009039 | 0:1ed23ab1345f | 73 | void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event)); |
va009039 | 0:1ed23ab1345f | 74 | |
va009039 | 0:1ed23ab1345f | 75 | void (*hw_error)(void); |
va009039 | 0:1ed23ab1345f | 76 | } bt_control_t; |