ccNOos  v0.0.0
Build Portable Microcontroller Applications!
io_device_class.cpp
Go to the documentation of this file.
1 /** \file io_device_class.cpp
2 * \brief <a href="https://www.inmechasol.org/" target="_blank">IMS</a>:
3  <a href="https://github.com/InMechaSol/ccNOos" target="_blank">ccNOos</a>,
4  Implementation for C++ wrappers
5 
6  Copyright 2021 <a href="https://www.inmechasol.org/" target="_blank">InMechaSol, Inc</a>
7 
8  Licensed under the Apache License, Version 2.0(the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 Notes:
21  (.c includes .h) - for straight C or
22  (.cpp includes .c which includes .h) - for C++ wrapped straight C
23  *Always compiled to a single compilation unit, either C or CPP, not both
24 
25 */
26 
27 #include "io_device.c"
28 
29 void IODeviceClass::ClearNewDataReadInFlag()
30 {
31  devdataptr->newDataReadIn = ui8FALSE;
32 }
33 bool IODeviceClass::ReadTriggerWriteOperationFlag()
34 {
35  return devdataptr->triggerWriteOperation;
36 }
37 void IODeviceClass::TriggerWriteOperation()
38 {
39  devdataptr->triggerWriteOperation = ui8TRUE;
40 }
41 bool IODeviceClass::NewDataReadIn()
42 {
43  return devdataptr->newDataReadIn;
44 }
45 
46 struct devicedatastruct* IODeviceClass::GetDevPtr()
47 {
48  return devdataptr;
49 }
50 
51 IODeviceClass::IODeviceClass(struct devicedatastruct* devdataptrin)
52 {
53  devdataptr = devdataptrin;
54 }
55 int IODeviceClass::OpenDev()
56 {
57  return opendevice();
58 }
59 int IODeviceClass::CloseDev()
60 {
61  return closedevice();
62 }
63 int IODeviceClass::ReadDev()
64 {
65  return readdevice();
66 }
67 int IODeviceClass::WriteDev()
68 {
69  return writedevice();
70 }
71 bool IODeviceClass::IsDevOpen()
72 {
73  return isdeviceopen();
74 }
75 
76 
77 
78 SPI_DeviceClass::SPI_DeviceClass(struct SPIDeviceStruct* spidevdataptrin) :IODeviceClass(&spidevdataptrin->devdata) { spidevptr = spidevdataptrin; }
79 
80 Serial_DeviceClass::Serial_DeviceClass(struct SerialDeviceStruct* serialdevdataptrin) : IODeviceClass(&serialdevdataptrin->devdata) { serialdevptr = serialdevdataptrin; }
ui8FALSE
#define ui8FALSE
Definition: version_config.h:190
SerialDeviceStruct
Definition: io_device.h:116
ui8TRUE
#define ui8TRUE
Definition: version_config.h:191
SPIDeviceStruct
Definition: io_device.h:82
devicedatastruct
the common data struct of io devices
Definition: io_device.h:62
io_device.c
IMS: ccNOos, Implementation for straight C