KETCube
Macros | Functions | Variables
ketCube_starNet.c File Reference

This file contains the KETCube starNet node and concentrator modules. More...

#include <string.h>
#include "hw.h"
#include "radio.h"
#include "low_power.h"
#include "ketCube_starNet.h"
#include "ketCube_common.h"
#include "ketCube_terminal.h"
#include "ketCube_modules.h"
#include "ketCube_i2c.h"
#include "ketCube_adc.h"
#include "ketCube_hdcX080.h"
#include "ketCube_rxDisplay.h"

Macros

#define FSK_FDEV   25000
 
#define FSK_DATARATE   50000
 
#define FSK_BANDWIDTH   50000
 
#define FSK_AFC_BANDWIDTH   83333
 
#define FSK_PREAMBLE_LENGTH   5
 
#define FSK_FIX_LENGTH_PAYLOAD_ON   FALSE
 
#define RX_TIMEOUT_VALUE   1000
 
#define TX_TIMEOUT_VALUE   500
 

Functions

static void ketCube_starNet_OnRxError (void)
 This function is executed on radio Rx Error event. More...
 
static void ketCube_starNet_OnRxTimeout (void)
 This function is executed on radio Rx Timeout event. More...
 
static void ketCube_starNet_OnTxTimeout (void)
 This function is executed on radio Tx Timeout event. More...
 
static void ketCube_starNet_OnTxDone (void)
 This function is executed on Tx Done event. More...
 
static void ketCube_starNet_OnRxDone (uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
 This function is executed on Rx Done event. More...
 
ketCube_cfg_ModError_t ketCube_starNet_Init (ketCube_starNet_NodeType_t nodeType)
 Initialize starNet module. More...
 
ketCube_cfg_ModError_t ketCube_starNet_SleepEnter (void)
 Prepare sleep mode. More...
 
ketCube_cfg_ModError_t ketCube_starNet_ConcentratorInit (ketCube_InterModMsg_t ***msg)
 Initialize starNet Concentrator. More...
 
ketCube_cfg_ModError_t ketCube_starNet_NodeInit (ketCube_InterModMsg_t ***msg)
 Initialize starNet Node. More...
 
ketCube_cfg_ModError_t ketCube_starNet_sendData (uint8_t *buffer, uint8_t *len)
 Send sensor data. More...
 

Variables

ketCube_starNet_moduleCfg_t ketCube_starNetConcentrator_moduleCfg
 
ketCube_starNet_moduleCfg_t ketCube_starNetNode_moduleCfg
 
static RadioEvents_t RadioEvents
 
uint8_t txBuffer_len = 0
 
static ketCube_starNet_State_t moduleState
 
static uint8_t ketCube_starNet_dataBuff [KETCUBE_STARNET_DATA_BUFFER_LEN]
 
ketCube_starNet_NodeType_t ketCube_starNet_nodeType
 
ketCube_starNet_NodeType_t nodeType
 

Detailed Description

This file contains the KETCube starNet node and concentrator modules.

Author
Jan Belohoubek
Version
0.2
Date
2019-08-27
Attention

© Copyright (c) 2018 University of West Bohemia in Pilsen All rights reserved.

Developed by: The SmartCampus Team Department of Technologies and Measurement www.smartcampus.cz | www.zcu.cz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.

Macro Definition Documentation

◆ FSK_AFC_BANDWIDTH

#define FSK_AFC_BANDWIDTH   83333

Hz

◆ FSK_BANDWIDTH

#define FSK_BANDWIDTH   50000

Hz

◆ FSK_DATARATE

#define FSK_DATARATE   50000

bps

◆ FSK_FDEV

#define FSK_FDEV   25000

Hz

◆ FSK_FIX_LENGTH_PAYLOAD_ON

#define FSK_FIX_LENGTH_PAYLOAD_ON   FALSE

◆ FSK_PREAMBLE_LENGTH

#define FSK_PREAMBLE_LENGTH   5

Same for Tx and Rx

◆ RX_TIMEOUT_VALUE

#define RX_TIMEOUT_VALUE   1000

◆ TX_TIMEOUT_VALUE

#define TX_TIMEOUT_VALUE   500

Timeout should be small, it should not occur in general, but it occurs (with some parts), see the in-code note above the woraround

Function Documentation

◆ ketCube_starNet_Init()

ketCube_cfg_ModError_t ketCube_starNet_Init ( ketCube_starNet_NodeType_t  nodeType)

Initialize starNet module.

Return values
KETCUBE_CFG_MODULE_OKin case of success
KETCUBE_CFG_MODULE_ERRORin case of failure

◆ ketCube_starNet_OnRxDone()

static void ketCube_starNet_OnRxDone ( uint8_t *  payload,
uint16_t  size,
int16_t  rssi,
int8_t  snr 
)
static

This function is executed on Rx Done event.

◆ ketCube_starNet_OnRxError()

static void ketCube_starNet_OnRxError ( void  )
static

This function is executed on radio Rx Error event.

◆ ketCube_starNet_OnRxTimeout()

static void ketCube_starNet_OnRxTimeout ( void  )
static

This function is executed on radio Rx Timeout event.

◆ ketCube_starNet_OnTxDone()

static void ketCube_starNet_OnTxDone ( void  )
static

This function is executed on Tx Done event.

◆ ketCube_starNet_OnTxTimeout()

static void ketCube_starNet_OnTxTimeout ( void  )
static

This function is executed on radio Tx Timeout event.

Variable Documentation

◆ ketCube_starNet_dataBuff

uint8_t ketCube_starNet_dataBuff[KETCUBE_STARNET_DATA_BUFFER_LEN]
static

◆ moduleState

ketCube_starNet_State_t moduleState
static

◆ nodeType

This device type: Node/Concentrator

◆ RadioEvents

RadioEvents_t RadioEvents
static

◆ txBuffer_len

uint8_t txBuffer_len = 0