Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
tempsense_app.h File Reference

Chili temperature sensing app declarations. More...

Include dependency graph for tempsense_app.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APP_WAKEUPINTERVALL   5
 wakeup interval for application [seconds] More...
 
#define APP_TIMEOUTINTERVALL   15
 timeout interval for end devices that havent sent anything for some time [seconds] More...
 
#define APP_DEVICETIMEOUT   1000
 device timeout in [ms] for max. time staying awake More...
 
#define APP_DEVICE_MAX_RETRIES   1
 maximum number of retries for device before disconnection and re-scanning More...
 
#define APP_MAX_DEVICES   32
 maximum devices/sensors that can connect to coordinator More...
 
#define APP_DEFAULT_PDN_MODE   PDM_DPD
 default powerdown mode for device/sensor More...
 
#define APP_USE_EXTERNAL_CLOCK   1
 use clock from cax8210 xtal oscillator (when 1) or nano120 internal RC oscillator as system clock (when 0) More...
 
#define APP_LQI_LIMIT   75
 link quality limit for joining coordinator More...
 
#define APP_ED_LIMIT   50
 energy detect limit (triggers warning) More...
 
#define APP_VBAT_LIMIT   1862 /* = 2.5 V */
 battery voltage limit when unplugged (triggers warning) More...
 
#define APP_REPORT_VBATT   1
 report battery voltage with every reading (otherwise just issue warning if it drops below APP_VBAT_LIMIT) More...
 
#define APP_REPORT_LQI   1
 report lqi values (both from device and coordinator) More...
 
#define APP_REPORT_ED   1
 report ed values (both from device and coordinator) More...
 
#define APP_COORD_REPORTN   1
 report every nth data package More...
 
#define APP_COORD_SREINIT   0
 soft re-initialisation of coordinator More...
 
#define APP_USE_DEBUG   0
 use over-air debug mode More...
 
#define MAC_PANID   0xCA5C
 
#define MAC_SHORTADD   0xCA00
 
#define MAC_LONGADD
 
#define MAC_CHANNELLIST
 
#define APP_ST_NORMAL   0
 Application disabled, EVBME. More...
 
#define APP_ST_COORDINATOR   1
 Network Coordinator. More...
 
#define APP_ST_DEVICE   2
 Sensing Device. More...
 
#define APP_CST_DONE   0x00
 communication completed More...
 
#define APP_CST_WAKEUP_REQUESTED   0x01
 wakeup pkt requested (device) More...
 
#define APP_CST_WAKEUP_CONFIRMED   0x02
 wakeup pkt confirmed (device) More...
 
#define APP_CST_WAKEUP_RECEIVED   0x03
 wakeup pkt received (coord) More...
 
#define APP_CST_C_DATA_REQUESTED   0x04
 coord data requested (coord) More...
 
#define APP_CST_C_DATA_CONFIRMED   0x05
 coord data confirmed (coord) More...
 
#define APP_CST_C_DATA_RECEIVED   0x06
 coord data received (device) More...
 
#define APP_CST_D_DATA_REQUESTED   0x07
 device data requested (device) More...
 
#define APP_CST_GO_POWERDOWN   0x08
 go into powerdown (device) More...
 
#define APP_CST_ASSOC_REQUESTED   0x09
 
#define APP_CST_SCANNING   0x0A
 
#define PT_MSDU_D_WAKEUP   0x01
 device wakeup indication More...
 
#define PT_MSDU_C_DATA   0x02
 coordinator data More...
 
#define PT_MSDU_D_DATA   0x03
 device data More...
 

Functions

void TEMPSENSE_APP_Handler (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Handler. More...
 
void TEMPSENSE_APP_Initialise (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Initialisation of MAC etc. More...
 
int TEMPSENSE_APP_UpStreamDispatch (struct SerialBuffer *SerialRxBuffer, struct ca821x_dev *pDeviceRef)
 TEMPSENSE Dispatch Branch (UpStream, Serial) More...
 
void TEMPSENSE_APP_SwitchMode (u8_t mode)
 TEMPSENSE Switch Mode. More...
 
void TEMPSENSE_APP_InitPIB (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Initialisation of MAC PIB. More...
 
u8_t TEMPSENSE_APP_GetTempVal (void)
 TEMPSENSE App. More...
 
u16_t TEMPSENSE_APP_GetVoltsVal (void)
 TEMPSENSE App. More...
 
u32_t TEMPSENSE_APP_GetScanChannels (void)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_PrintScanChannels (void)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_PrintSeconds (void)
 Prints AboluteTime in Seconds. More...
 
void TEMPSENSE_APP_LED_Handler (void)
 module LEDs signalling More...
 
void TEMPSENSE_APP_Coordinator_Handler (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Handler for Coordinator. More...
 
void TEMPSENSE_APP_Coordinator_Initialise (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Initialisation for Coordinator. More...
 
void TEMPSENSE_APP_Coordinator_Start (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_ProcessScanCnf (struct MLME_SCAN_confirm_pset *params, struct ca821x_dev *pDeviceRef)
 Coordinator Process incoming Scan Confirm. More...
 
void TEMPSENSE_APP_Coordinator_AssociateResponse (struct MLME_ASSOCIATE_indication_pset *params, struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_ProcessDataInd (struct MCPS_DATA_indication_pset *params, struct ca821x_dev *pDeviceRef)
 Coordinator Process incoming Data Indications. More...
 
void TEMPSENSE_APP_Coordinator_ProcessDataCnf (struct MCPS_DATA_confirm_pset *params, struct ca821x_dev *pDeviceRef)
 Coordinator Process incoming Data Confirmations. More...
 
void TEMPSENSE_APP_Coordinator_DisplayData (u8_t device, u8_t edcoord, struct MCPS_DATA_indication_pset *params, struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_CheckTimeouts (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_CheckVbatt (u16_t vbat)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_CheckLQI (u8_t lqi_ts, u8_t lqi_coord)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_CheckED (u8_t ed_ts, u8_t ed_coord)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_SoftReinit (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Coordinator_ReportStatus (void)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_Handler (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Handler for Sensor Device. More...
 
void TEMPSENSE_APP_Device_Initialise (struct ca821x_dev *pDeviceRef)
 TEMPSENSE Application Initialisation for Sensor Device. More...
 
void TEMPSENSE_APP_Device_GetLongAddress (void)
 TEMPSENSE Get Device LongAddress from Dataflash. More...
 
void TEMPSENSE_APP_Device_Start (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_ProcessScanCnf (struct MLME_SCAN_confirm_pset *params, struct ca821x_dev *pDeviceRef)
 Device Process incoming Scan Confirm. More...
 
void TEMPSENSE_APP_Device_ProcessAssociateCnf (struct MLME_ASSOCIATE_confirm_pset *params, struct ca821x_dev *pDeviceRef)
 Device Process incoming Data Indications. More...
 
void TEMPSENSE_APP_Device_ProcessDataInd (struct MCPS_DATA_indication_pset *params, struct ca821x_dev *pDeviceRef)
 Device Process incoming Data Indications. More...
 
void TEMPSENSE_APP_Device_ProcessDataCnf (struct MCPS_DATA_confirm_pset *params, struct ca821x_dev *pDeviceRef)
 Device Process incoming Data Confirms. More...
 
void TEMPSENSE_APP_Device_ExchangeData (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_CheckTimeout (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_GoPowerDown (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_RestoreStateFromFlash (struct ca821x_dev *pDeviceRef)
 TEMPSENSE App. More...
 
void TEMPSENSE_APP_Device_SaveStateToFlash (void)
 TEMPSENSE App. More...
 

Variables

u8_t APP_STATE
 module state More...
 
u8_t APP_STATE_new
 module state set in interrupts More...
 
u8_t APP_INITIALISE
 flag for re-initialising application More...
 
u8_t APP_CONNECTED
 sensor module is connected to coordinator More...
 
u16_t APP_PANId
 
u16_t APP_ShortAddress
 
u8_t APP_LongAddress [8]
 
u8_t APP_Channel
 

Detailed Description

Chili temperature sensing app declarations.

Macro Definition Documentation

◆ APP_COORD_REPORTN

#define APP_COORD_REPORTN   1

report every nth data package

◆ APP_COORD_SREINIT

#define APP_COORD_SREINIT   0

soft re-initialisation of coordinator

◆ APP_CST_ASSOC_REQUESTED

#define APP_CST_ASSOC_REQUESTED   0x09

◆ APP_CST_C_DATA_CONFIRMED

#define APP_CST_C_DATA_CONFIRMED   0x05

coord data confirmed (coord)

◆ APP_CST_C_DATA_RECEIVED

#define APP_CST_C_DATA_RECEIVED   0x06

coord data received (device)

◆ APP_CST_C_DATA_REQUESTED

#define APP_CST_C_DATA_REQUESTED   0x04

coord data requested (coord)

◆ APP_CST_D_DATA_REQUESTED

#define APP_CST_D_DATA_REQUESTED   0x07

device data requested (device)

◆ APP_CST_DONE

#define APP_CST_DONE   0x00

communication completed

◆ APP_CST_GO_POWERDOWN

#define APP_CST_GO_POWERDOWN   0x08

go into powerdown (device)

◆ APP_CST_SCANNING

#define APP_CST_SCANNING   0x0A

◆ APP_CST_WAKEUP_CONFIRMED

#define APP_CST_WAKEUP_CONFIRMED   0x02

wakeup pkt confirmed (device)

◆ APP_CST_WAKEUP_RECEIVED

#define APP_CST_WAKEUP_RECEIVED   0x03

wakeup pkt received (coord)

◆ APP_CST_WAKEUP_REQUESTED

#define APP_CST_WAKEUP_REQUESTED   0x01

wakeup pkt requested (device)

◆ APP_DEFAULT_PDN_MODE

#define APP_DEFAULT_PDN_MODE   PDM_DPD

default powerdown mode for device/sensor

◆ APP_DEVICE_MAX_RETRIES

#define APP_DEVICE_MAX_RETRIES   1

maximum number of retries for device before disconnection and re-scanning

◆ APP_DEVICETIMEOUT

#define APP_DEVICETIMEOUT   1000

device timeout in [ms] for max. time staying awake

◆ APP_ED_LIMIT

#define APP_ED_LIMIT   50

energy detect limit (triggers warning)

◆ APP_LQI_LIMIT

#define APP_LQI_LIMIT   75

link quality limit for joining coordinator

◆ APP_MAX_DEVICES

#define APP_MAX_DEVICES   32

maximum devices/sensors that can connect to coordinator

◆ APP_REPORT_ED

#define APP_REPORT_ED   1

report ed values (both from device and coordinator)

◆ APP_REPORT_LQI

#define APP_REPORT_LQI   1

report lqi values (both from device and coordinator)

◆ APP_REPORT_VBATT

#define APP_REPORT_VBATT   1

report battery voltage with every reading (otherwise just issue warning if it drops below APP_VBAT_LIMIT)

◆ APP_ST_COORDINATOR

#define APP_ST_COORDINATOR   1

Network Coordinator.

◆ APP_ST_DEVICE

#define APP_ST_DEVICE   2

Sensing Device.

◆ APP_ST_NORMAL

#define APP_ST_NORMAL   0

Application disabled, EVBME.

◆ APP_TIMEOUTINTERVALL

#define APP_TIMEOUTINTERVALL   15

timeout interval for end devices that havent sent anything for some time [seconds]

◆ APP_USE_DEBUG

#define APP_USE_DEBUG   0

use over-air debug mode

◆ APP_USE_EXTERNAL_CLOCK

#define APP_USE_EXTERNAL_CLOCK   1

use clock from cax8210 xtal oscillator (when 1) or nano120 internal RC oscillator as system clock (when 0)

◆ APP_VBAT_LIMIT

#define APP_VBAT_LIMIT   1862 /* = 2.5 V */

battery voltage limit when unplugged (triggers warning)

◆ APP_WAKEUPINTERVALL

#define APP_WAKEUPINTERVALL   5

wakeup interval for application [seconds]

◆ MAC_CHANNELLIST

#define MAC_CHANNELLIST
Value:
{ \
11, 18, 24 \
}

◆ MAC_LONGADD

#define MAC_LONGADD
Value:
{ \
0x00, 0x00, 0x00, 0x00, 0xA0, 0x0D, 0x5C, 0xCA \
}

◆ MAC_PANID

#define MAC_PANID   0xCA5C

◆ MAC_SHORTADD

#define MAC_SHORTADD   0xCA00

◆ PT_MSDU_C_DATA

#define PT_MSDU_C_DATA   0x02

coordinator data

◆ PT_MSDU_D_DATA

#define PT_MSDU_D_DATA   0x03

device data

◆ PT_MSDU_D_WAKEUP

#define PT_MSDU_D_WAKEUP   0x01

device wakeup indication

Function Documentation

◆ TEMPSENSE_APP_Coordinator_AssociateResponse()

void TEMPSENSE_APP_Coordinator_AssociateResponse ( struct MLME_ASSOCIATE_indication_pset params,
struct ca821x_dev pDeviceRef 
)

TEMPSENSE App.

Coordinator Association Response

◆ TEMPSENSE_APP_Coordinator_CheckED()

void TEMPSENSE_APP_Coordinator_CheckED ( u8_t  ed_ts,
u8_t  ed_coord 
)

TEMPSENSE App.

Checks and displays ED from both Sides

Parameters
ed_ts- ED received at Temperature Sensor (Device)
ed_coord- ED received locally (Coordinator)

◆ TEMPSENSE_APP_Coordinator_CheckLQI()

void TEMPSENSE_APP_Coordinator_CheckLQI ( u8_t  lqi_ts,
u8_t  lqi_coord 
)

TEMPSENSE App.

Checks and displays LQI from both Sides

Parameters
lqi_ts- LQI received at Temperature Sensor (Device)
lqi_coord- LQI received locally (Coordinator)

◆ TEMPSENSE_APP_Coordinator_CheckTimeouts()

void TEMPSENSE_APP_Coordinator_CheckTimeouts ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Coordinator Timeout Check for all Devices

◆ TEMPSENSE_APP_Coordinator_CheckVbatt()

void TEMPSENSE_APP_Coordinator_CheckVbatt ( u16_t  vbat)

TEMPSENSE App.

Checks and displays Battery Voltage

Parameters
vbat- 12-bit Battery Voltage Reading from Device

◆ TEMPSENSE_APP_Coordinator_DisplayData()

void TEMPSENSE_APP_Coordinator_DisplayData ( u8_t  device,
u8_t  edcoord,
struct MCPS_DATA_indication_pset params,
struct ca821x_dev pDeviceRef 
)

TEMPSENSE App.

Coordinator check and display Data Packet

Parameters
device- device number
edcoord- ED received locally (Coordinator)
params- Buffer containing data indication with data to display
pDeviceRef- Pointer to initialised ca821x_device_ref struct

◆ TEMPSENSE_APP_Coordinator_Handler()

void TEMPSENSE_APP_Coordinator_Handler ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Handler for Coordinator.

◆ TEMPSENSE_APP_Coordinator_Initialise()

void TEMPSENSE_APP_Coordinator_Initialise ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Initialisation for Coordinator.

◆ TEMPSENSE_APP_Coordinator_ProcessDataCnf()

void TEMPSENSE_APP_Coordinator_ProcessDataCnf ( struct MCPS_DATA_confirm_pset params,
struct ca821x_dev pDeviceRef 
)

Coordinator Process incoming Data Confirmations.

◆ TEMPSENSE_APP_Coordinator_ProcessDataInd()

void TEMPSENSE_APP_Coordinator_ProcessDataInd ( struct MCPS_DATA_indication_pset params,
struct ca821x_dev pDeviceRef 
)

Coordinator Process incoming Data Indications.

◆ TEMPSENSE_APP_Coordinator_ProcessScanCnf()

void TEMPSENSE_APP_Coordinator_ProcessScanCnf ( struct MLME_SCAN_confirm_pset params,
struct ca821x_dev pDeviceRef 
)

Coordinator Process incoming Scan Confirm.

◆ TEMPSENSE_APP_Coordinator_ReportStatus()

void TEMPSENSE_APP_Coordinator_ReportStatus ( void  )

TEMPSENSE App.

Coordinator Report Network Status

◆ TEMPSENSE_APP_Coordinator_SoftReinit()

void TEMPSENSE_APP_Coordinator_SoftReinit ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Coordinator Soft Reset (no change in PIB)

◆ TEMPSENSE_APP_Coordinator_Start()

void TEMPSENSE_APP_Coordinator_Start ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Coordinator Start Procedure

Parameters
pDeviceRef- pointer to a CA-821x Device reference struct

◆ TEMPSENSE_APP_Device_CheckTimeout()

void TEMPSENSE_APP_Device_CheckTimeout ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Device Timeout Check

◆ TEMPSENSE_APP_Device_ExchangeData()

void TEMPSENSE_APP_Device_ExchangeData ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Start exchanging Data with Coordinator

◆ TEMPSENSE_APP_Device_GetLongAddress()

void TEMPSENSE_APP_Device_GetLongAddress ( void  )

TEMPSENSE Get Device LongAddress from Dataflash.

◆ TEMPSENSE_APP_Device_GoPowerDown()

void TEMPSENSE_APP_Device_GoPowerDown ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Device prepare and enter sleep mode (and wake-up)

◆ TEMPSENSE_APP_Device_Handler()

void TEMPSENSE_APP_Device_Handler ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Handler for Sensor Device.

◆ TEMPSENSE_APP_Device_Initialise()

void TEMPSENSE_APP_Device_Initialise ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Initialisation for Sensor Device.

◆ TEMPSENSE_APP_Device_ProcessAssociateCnf()

void TEMPSENSE_APP_Device_ProcessAssociateCnf ( struct MLME_ASSOCIATE_confirm_pset params,
struct ca821x_dev pDeviceRef 
)

Device Process incoming Data Indications.

◆ TEMPSENSE_APP_Device_ProcessDataCnf()

void TEMPSENSE_APP_Device_ProcessDataCnf ( struct MCPS_DATA_confirm_pset params,
struct ca821x_dev pDeviceRef 
)

Device Process incoming Data Confirms.

◆ TEMPSENSE_APP_Device_ProcessDataInd()

void TEMPSENSE_APP_Device_ProcessDataInd ( struct MCPS_DATA_indication_pset params,
struct ca821x_dev pDeviceRef 
)

Device Process incoming Data Indications.

◆ TEMPSENSE_APP_Device_ProcessScanCnf()

void TEMPSENSE_APP_Device_ProcessScanCnf ( struct MLME_SCAN_confirm_pset params,
struct ca821x_dev pDeviceRef 
)

Device Process incoming Scan Confirm.

◆ TEMPSENSE_APP_Device_RestoreStateFromFlash()

void TEMPSENSE_APP_Device_RestoreStateFromFlash ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Device restore state from flash

◆ TEMPSENSE_APP_Device_SaveStateToFlash()

void TEMPSENSE_APP_Device_SaveStateToFlash ( void  )

TEMPSENSE App.

Device save state to flash

◆ TEMPSENSE_APP_Device_Start()

void TEMPSENSE_APP_Device_Start ( struct ca821x_dev pDeviceRef)

TEMPSENSE App.

Device Association Procedure

◆ TEMPSENSE_APP_GetScanChannels()

u32_t TEMPSENSE_APP_GetScanChannels ( void  )

TEMPSENSE App.

Get ScanChannels from MAC_CHANNELLIST

Returns
ScanChannels Parameter for Scan Requests

◆ TEMPSENSE_APP_GetTempVal()

u8_t TEMPSENSE_APP_GetTempVal ( void  )

TEMPSENSE App.

Get Temperature Reading

Returns
Temperature, 8 bit signed (1s complement)

◆ TEMPSENSE_APP_GetVoltsVal()

u16_t TEMPSENSE_APP_GetVoltsVal ( void  )

TEMPSENSE App.

Get Battery Voltage Reading

Returns
8-Bit VBat, full range = 5.5V

◆ TEMPSENSE_APP_Handler()

void TEMPSENSE_APP_Handler ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Handler.

◆ TEMPSENSE_APP_Initialise()

void TEMPSENSE_APP_Initialise ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Initialisation of MAC etc.

◆ TEMPSENSE_APP_InitPIB()

void TEMPSENSE_APP_InitPIB ( struct ca821x_dev pDeviceRef)

TEMPSENSE Application Initialisation of MAC PIB.

◆ TEMPSENSE_APP_LED_Handler()

void TEMPSENSE_APP_LED_Handler ( void  )

module LEDs signalling

◆ TEMPSENSE_APP_PrintScanChannels()

void TEMPSENSE_APP_PrintScanChannels ( void  )

TEMPSENSE App.

Print MAC_CHANNELLIST

◆ TEMPSENSE_APP_PrintSeconds()

void TEMPSENSE_APP_PrintSeconds ( void  )

Prints AboluteTime in Seconds.

◆ TEMPSENSE_APP_SwitchMode()

void TEMPSENSE_APP_SwitchMode ( u8_t  mode)

TEMPSENSE Switch Mode.

◆ TEMPSENSE_APP_UpStreamDispatch()

int TEMPSENSE_APP_UpStreamDispatch ( struct SerialBuffer SerialRxBuffer,
struct ca821x_dev pDeviceRef 
)

TEMPSENSE Dispatch Branch (UpStream, Serial)

Variable Documentation

◆ APP_Channel

u8_t APP_Channel
extern

◆ APP_CONNECTED

u8_t APP_CONNECTED
extern

sensor module is connected to coordinator

◆ APP_INITIALISE

u8_t APP_INITIALISE
extern

flag for re-initialising application

◆ APP_LongAddress

u8_t APP_LongAddress[8]
extern

◆ APP_PANId

u16_t APP_PANId
extern

◆ APP_ShortAddress

u16_t APP_ShortAddress
extern

◆ APP_STATE

u8_t APP_STATE
extern

module state

◆ APP_STATE_new

u8_t APP_STATE_new
extern

module state set in interrupts