Program that uses the QuickStart Library to interface a SmartMesh IP mote: Connects to the default network and starts publishing a random walk value every 5 seconds.

Dependencies:   mbed millis

Fork of QSL_SimplePublish by Jon-Håkon Bøe Røli

QSL SimplePublish

SmartMesh IP QuickStart Library

Committer:
jhbr
Date:
Fri Nov 04 14:19:34 2016 +0000
Revision:
9:f723949a18b7
Parent:
0:d3f5fdf2e6da
Deactivated DEBUG prints and updated mbed library to v128

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhbr 0:d3f5fdf2e6da 1 /*
jhbr 0:d3f5fdf2e6da 2 Copyright (c) 2016, Dust Networks. All rights reserved.
jhbr 0:d3f5fdf2e6da 3
jhbr 0:d3f5fdf2e6da 4 Port of the endianness module to the NUCLEO-L053R8.
jhbr 0:d3f5fdf2e6da 5
jhbr 0:d3f5fdf2e6da 6 \license See attached DN_LICENSE.txt.
jhbr 0:d3f5fdf2e6da 7 */
jhbr 0:d3f5fdf2e6da 8
jhbr 0:d3f5fdf2e6da 9 #include "dn_endianness.h"
jhbr 0:d3f5fdf2e6da 10
jhbr 0:d3f5fdf2e6da 11 //=========================== variables =======================================
jhbr 0:d3f5fdf2e6da 12
jhbr 0:d3f5fdf2e6da 13 //=========================== prototypes ======================================
jhbr 0:d3f5fdf2e6da 14
jhbr 0:d3f5fdf2e6da 15 //=========================== public ==========================================
jhbr 0:d3f5fdf2e6da 16
jhbr 0:d3f5fdf2e6da 17 void dn_write_uint16_t(uint8_t* ptr, uint16_t val){
jhbr 0:d3f5fdf2e6da 18 // STM32L0 is a little-endian platform
jhbr 0:d3f5fdf2e6da 19 ptr[0] = (val>>8) & 0xff;
jhbr 0:d3f5fdf2e6da 20 ptr[1] = (val>>0) & 0xff;
jhbr 0:d3f5fdf2e6da 21 }
jhbr 0:d3f5fdf2e6da 22
jhbr 0:d3f5fdf2e6da 23 void dn_write_uint32_t(uint8_t* ptr, uint32_t val){
jhbr 0:d3f5fdf2e6da 24 // STM32L0 is a little-endian platform
jhbr 0:d3f5fdf2e6da 25 ptr[0] = (val>>24) & 0xff;
jhbr 0:d3f5fdf2e6da 26 ptr[1] = (val>>16) & 0xff;
jhbr 0:d3f5fdf2e6da 27 ptr[2] = (val>>8) & 0xff;
jhbr 0:d3f5fdf2e6da 28 ptr[3] = (val>>0) & 0xff;
jhbr 0:d3f5fdf2e6da 29 }
jhbr 0:d3f5fdf2e6da 30
jhbr 0:d3f5fdf2e6da 31 void dn_read_uint16_t(uint16_t* to, uint8_t* from){
jhbr 0:d3f5fdf2e6da 32 // STM32L0 is a little-endian platform
jhbr 0:d3f5fdf2e6da 33 *to = 0;
jhbr 0:d3f5fdf2e6da 34 *to |= (from[1]<<0);
jhbr 0:d3f5fdf2e6da 35 *to |= (from[0]<<8);
jhbr 0:d3f5fdf2e6da 36 }
jhbr 0:d3f5fdf2e6da 37
jhbr 0:d3f5fdf2e6da 38 void dn_read_uint32_t(uint32_t* to, uint8_t* from){
jhbr 0:d3f5fdf2e6da 39 // STM32L0 is a little-endian platform
jhbr 0:d3f5fdf2e6da 40 *to = 0;
jhbr 0:d3f5fdf2e6da 41 *to |= ( ((uint32_t)from[3])<<0 );
jhbr 0:d3f5fdf2e6da 42 *to |= ( ((uint32_t)from[2])<<8 );
jhbr 0:d3f5fdf2e6da 43 *to |= ( ((uint32_t)from[1])<<16);
jhbr 0:d3f5fdf2e6da 44 *to |= ( ((uint32_t)from[0])<<24);
jhbr 0:d3f5fdf2e6da 45 }
jhbr 0:d3f5fdf2e6da 46
jhbr 0:d3f5fdf2e6da 47 //=========================== private =========================================
jhbr 0:d3f5fdf2e6da 48
jhbr 0:d3f5fdf2e6da 49 //=========================== helpers =========================================
jhbr 0:d3f5fdf2e6da 50