OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
flags.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * flags.h
17  * Copyright (C) 2015 Simon Newton
18  */
19 
37 #ifndef FIRMWARE_SRC_FLAGS_H_
38 #define FIRMWARE_SRC_FLAGS_H_
39 
40 #include "flags_private.h"
41 #include "transport.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
48 extern FlagsData g_flags;
50 
61 
66 static inline bool Flags_HasChanged() {
67  return g_flags.has_changed;
68 }
69 
75 static inline void Flags_SetLogOverflow() {
76  g_flags.flags.log_overflow = true;
77  g_flags.has_changed = true;
78 }
79 
86 static inline void Flags_SetTXDrop() {
87  g_flags.flags.tx_drop = true;
88  g_flags.has_changed = true;
89 }
90 
96 static inline void Flags_SetTXError() {
97  g_flags.flags.tx_error = true;
98  g_flags.has_changed = true;
99 }
100 
108 void Flags_SendResponse(uint8_t token);
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
118 #endif // FIRMWARE_SRC_FLAGS_H_
Definition: flags_private.h:37
The Host <-> Device communication transport.
static void Flags_SetTXDrop()
Set the TX Drop flag.
Definition: flags.h:86
static void Flags_SetLogOverflow()
Set the log overflow flag.
Definition: flags.h:75
bool(* TransportTXFunction)(uint8_t, Command, uint8_t, const IOVec *, unsigned int)
A function pointer to send a message to the host.
Definition: transport.h:57
void Flags_SendResponse(uint8_t token)
Send a flags message.
static bool Flags_HasChanged()
Check if the flags have changed since the last GET_FLAGS message.
Definition: flags.h:66
static void Flags_SetTXError()
Set the TX Error flag.
Definition: flags.h:96
void Flags_Initialize(TransportTXFunction tx_cb)
Initialize the Flags sub-system.