-
Notifications
You must be signed in to change notification settings - Fork 20
/
onesheeld.h
124 lines (114 loc) · 2.73 KB
/
onesheeld.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
Project: 1Sheeld Firmware
File: onesheeld.h
Compiler: avr-gcc 3.4.2
Author: Integreight
Date: 2014.5
*/
/**
* @file onesheeld.h
* @brief This library contains an Arduino abstraction layer to mimic Arduino methods and a set of 1Sheeld related methods.
* @author Integreight
* @version 1.1
*/
#ifndef ONESHEELD_H_
#define ONESHEELD_H_
#include "stdint.h"
#include "firmata.h"
#if (!defined(PLUS_BOARD) && !defined(CLASSIC_BOARD))
#error "Board not defined"
#endif
#if (defined(PLUS_BOARD) && defined(CLASSIC_BOARD))
#error "Defined PLUS_BOARD and CLASSIC_BOARD"
#endif
/**
* @brief Send a frame to Arduino that the app is disconected
* @param None
* @return None
*/
void sendArduinoAppDisconnected();
/**
* @brief Initializes the Hardware peripherals and setup for communications
* @param None
* @return None
*/
void initialization();
/**
* @brief Grab Time using Millis timer function
* @param None
* @return None
*/
void catchTimeForSomeVariables();
/**
* @brief Checks digitalPorts status
* @param None
* @return None
*/
void checkDigitalPinStatus();
/**
* @brief Process data coming from application.
* @param None.
* @return None.
*/
void processDataFromApp();
/**
* @brief Check if application responded to the Bluetooth reset request.
* @param None.
* @return None.
*/
void checkBluetoothResetResponse();
/**
* @brief Check if app responded as alive and is still connected.
* @param None.
* @return None.
*/
void checkAppConnection();
/**
* @brief Send Data to the application in 20bytes frame each 15ms.
* @param None.
* @return None.
*/
void sendDataToApp();
/**
* @brief Send a frame to Arduino to stop sending Data
* @param None
* @return None
*/
void sendArduinoToStopData();
/**
* @brief Send a frame to Arduino to start sending Data
* @param None
* @return None
*/
void sendArduinoToSendData();
/**
* @brief Check if the Arduino Buffer is Empty
* @param None
* @return None
*/
void checkArduinoRx0BufferSpace();
/**
* @brief Check digital ports pin state equality.
* @param oldPort state,newPort state,number of pins.
* @return None.
*/
uint16_t checkPortStateEquality(uint8_t * oldPort ,uint8_t * newPort,uint8_t numberOfPins);
/**
* @brief Put digital ports values in the 20byte buffer to be sent.
* @param None.
* @return None.
*/
void fillBufferWithPinStates(uint8_t * portArray,uint8_t portNumber);
/**
* @brief Put digital ports values in the 20byte buffer to be sent.
* @param None.
* @return None.
*/
uint8_t getSavedBaudRateFromEeprom();
/**
* @brief Check the changes of the pins and place them in the small buffer.
* @param None.
* @return None.
*/
void checkIfPinsChangedSendThem();
#endif /* 1SHEELDS_FUNCTIONS_H_ */