Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-dev-mbed5-deprecated
Fork of MTDOT-BOX-EVB-Factory-Firmware by
LayoutSemtechJoin.cpp
00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #include "LayoutSemtechJoin.h" 00020 00021 LayoutSemtechJoin::LayoutSemtechJoin(DOGS102* lcd, uint8_t band) 00022 : Layout(lcd), 00023 _band(band), 00024 _lId(0, 1, "NI="), 00025 _lKey(0, 2, "NK="), 00026 _lFsb(0, 3, "FSB="), 00027 _lRate(0, 5, "DR="), 00028 _lPower(6, 5, "P="), 00029 _lJoin(0, 7, "Join"), 00030 _fId(3, 1, 14), 00031 _fKey(3, 2, 14), 00032 _fFsb(4, 3, 2), 00033 _fRate(3, 5, 2), 00034 _fPower(8, 5, 2), 00035 _fStatus(0, 0, 17), 00036 _fSubBand(16,7,1) 00037 {} 00038 00039 LayoutSemtechJoin::~LayoutSemtechJoin() {} 00040 00041 void LayoutSemtechJoin::display() 00042 { 00043 clear(); 00044 startUpdate(); 00045 00046 writeLabel(_lId); 00047 writeLabel(_lKey); 00048 if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { 00049 writeLabel(_lFsb); 00050 } 00051 writeLabel(_lRate); 00052 writeLabel(_lPower); 00053 writeLabel(_lJoin); 00054 00055 endUpdate(); 00056 } 00057 00058 void LayoutSemtechJoin::updateId(std::string id) 00059 { 00060 writeField(_fId, id, true); 00061 } 00062 00063 void LayoutSemtechJoin::updateKey(std::string key) 00064 { 00065 writeField(_fKey, key, true); 00066 } 00067 00068 void LayoutSemtechJoin::updateFsb(uint8_t band) 00069 { 00070 if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { 00071 char buf[8]; 00072 size_t size; 00073 size = snprintf(buf, sizeof(buf), "%u", band); 00074 writeField(_fFsb, buf, size, true); 00075 writeField(_fSubBand, buf, size, true); 00076 } 00077 } 00078 00079 void LayoutSemtechJoin::updateRate(std::string rate) 00080 { 00081 writeField(_fRate, rate, true); 00082 } 00083 00084 void LayoutSemtechJoin::updatePower(uint32_t power) 00085 { 00086 char buf[16]; 00087 size_t size; 00088 00089 size = snprintf(buf, sizeof(buf), "%lu", power); 00090 writeField(_fPower, buf, size, true); 00091 }
Generated on Wed Jul 13 2022 01:58:37 by
1.7.2
