first commit
Fork of XBeeLib by
Embed:
(wiki syntax)
Show/hide line numbers
IOSample802.h
00001 /** 00002 * Copyright (c) 2015 Digi International Inc., 00003 * All rights not expressly granted are reserved. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 00007 * You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 00010 * ======================================================================= 00011 */ 00012 00013 #ifndef _IO_IOSAMPLE802_H_ 00014 #define _IO_IOSAMPLE802_H_ 00015 00016 #define MAX_IO_SAMPLE_802_LEN (2 + 2 * 6) 00017 00018 namespace XBeeLib { 00019 00020 /** Class to handle the incoming IO Data Samples in 802.15.4 modules */ 00021 class IOSample802 { 00022 public: 00023 /** Class constructor 00024 * @param raw_data The IO Sample data, as returned by an "IS" command response or in the Io16Bit (0x83) or Io64Bit (0x82) frames 00025 * @param size size (in bytes) of raw_data 00026 */ 00027 IOSample802(const uint8_t* const raw_data = NULL, size_t size = 0); 00028 00029 /** Class destructor */ 00030 ~IOSample802(); 00031 00032 /** get_dio - read the value of a DIO configured as digital input 00033 * 00034 * @param line DIO line being read 00035 * @param val pointer where the DIO value read will be stored 00036 * @returns 00037 * Success if the operation was successful, 00038 * Failure otherwise 00039 */ 00040 RadioStatus get_dio(XBee802::IoLine line, DioVal* const dio_value) const; 00041 00042 /** get_adc - read the value of the espcified ADC line 00043 * 00044 * @param line ADC line being read 00045 * @param val pointer where the value read from the ADC will be stored 00046 * @returns 00047 * Success if the operation was successful, 00048 * Failure otherwise 00049 */ 00050 RadioStatus get_adc(XBee802::IoLine line, uint16_t* const val) const; 00051 00052 /** is_valid - checks if the IOSample802 object has at least one DIO or ADC sample. 00053 * @returns true if valid, false otherwise 00054 */ 00055 inline bool is_valid() 00056 { 00057 return _channel_mask != 0; 00058 } 00059 00060 protected: 00061 uint16_t _channel_mask; 00062 uint8_t _sampled_data[MAX_IO_SAMPLE_802_LEN]; 00063 uint8_t _sampled_data_size; 00064 00065 inline bool dio_channels_present(void) const; 00066 inline uint8_t get_dio_channels(void) const; 00067 }; 00068 00069 } /* namespace XBeeLib */ 00070 00071 #endif /* _IO_IOSAMPLE802_H_ */
Generated on Tue Jul 12 2022 20:57:52 by 1.7.2