-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuart_aci.h
75 lines (65 loc) · 2.58 KB
/
uart_aci.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Copyright (c) 2014, Nordic Semiconductor ASA
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _UART_ACI_H__
#define _UART_ACI_H__
//#include <application.h>
#include "lib_aci.h"
#include "aci_setup.h"
#include "uart_over_ble.h"
#include "services.h"
// aci_struct that will contain
// total initial credits
// current credit
// current state of the aci (setup/standby/active/sleep)
// open remote pipe pending
// close remote pipe pending
// Current pipe available bitmap
// Current pipe closed bitmap
// Current connection interval, slave latency and link supervision timeout
// Current State of the the GATT client (Service Discovery)
// Status of the bond (R) Peer address
extern struct aci_state_t aci_state;
/**
* Wrapper for the Serial.print() function, added in order to reduce memory usage
* for comments.
*/
//#define NRF_DO_PRINT (1)
#ifdef NRF_DO_PRINT
#define PRINT(x) UART1_Write(x);
#define PRINT_BASE(x, y) UART1_Write_Text(x, y);
#else
#define PRINT(x) UART1_Write(x)
#define PRINT_BASE(x, y)
#endif
/**
* BLE UART handling of incoming UART configuration data
*/
bool uart_process_control_point_rx(uint8_t *byte, uint8_t length);
/**
* Top level nRF8001 event handling. Checks and handles all incoming ACI events from the aci_queue.
* This function does application specific event handling, and was the main application layer loop in the
* Hello_BLE example for the Arduino library.
*
* Directs any incoming UART messages to the nRF8001BleUartRx callback function defined in nrf8001-ble-uart.h,
* which should be implemented by the user
*/
void aci_loop(void);
#endif