alan broad
/
carbon_v5_arm_studio
arm studio build
Diff: inc/commI2C.h
- Revision:
- 1:0d25d9ddbe9f
- Parent:
- 0:a91cd1b08360
- Child:
- 2:0af50f386eb2
diff -r a91cd1b08360 -r 0d25d9ddbe9f inc/commI2C.h --- a/inc/commI2C.h Mon Jun 18 17:31:35 2018 +0000 +++ b/inc/commI2C.h Sat Aug 04 19:25:02 2018 +0000 @@ -16,7 +16,7 @@ #define _COMMi2C_H_ #include "mbed.h" - +#include "global.h" @@ -24,14 +24,17 @@ #define I2C_MIN_WAIT_DELAY 200 //minimum time between rcv/xmit i2c data and pulsing wake #define I2C_ACK_PROC 0xff //first byte of i2c ack msg back to proc #define I2C_MAX_ACK_DATA 0x32 //max data bytes accepted from Rx downstream pkt + //cmds to xdot enum{ XDOT_CMD_XMIT_PKT = 1, //transmit data - XDOT_CMD_GET_EUI, //get xdot EUI - XDOT_CMD_SET_RADIO, //set's radio parameters + XDOT_CMD_GET_EUI, //get xdot EUI XDOT_CMD_SET_KEY_X, //set one of the security keys XDOT_CMD_GOTO_SLEEP, //go to sleep XDOT_CMD_GATEWAY_PING, //ping gateway for RSSI + XDOT_CMD_SET_NTWKSESS, //write/read network session to/from flash + XDOT_CMD_SET_RADIO, //set's radio parameters + XDOT_CMD_SET_NVM, //write params to xdot nvm memory XDOT_CMD_UNDEFINED, //last cmd, not used }; @@ -42,16 +45,16 @@ //structure: upstream pkt for xdot to transmit //txData bfr: is located in the struc immediately after dataLen parameter - // : this allows extending pkt_upstrm struc as new control parameters are needed + // : this allows extending pkt_upstrm struc as new control parameters are needed #define PKT_UPSTRM_RSVD (BUFFER_SIZE_I2C- (I2C_MAX_ACK_DATA + 7)) typedef struct { uint8_t cmd; //cmd received from proc uint8_t dataLen; //datalen found in pkt uint8_t txData[I2C_MAX_ACK_DATA]; //array for tx Data uint8_t joinAttemps; //max attempts to join network before quitting - uint8_t subBand; //frequency sub-band (ex: 1 for public, 4 for private) - uint8_t bPublicNetwork; //true if public network, false if private network ---- not used - uint8_t bSetAdr; //true to enabled ADR (adaptive data rate) ---- not used + uint8_t appPort; //set app port (rev 0307) + uint8_t bResetLinkCCounter; //true to reset link threshold counter (rev 0307) + uint8_t bSetAdr; //not used uint8_t rxvd[PKT_UPSTRM_RSVD]; //rserved filler bytes uint8_t chksum; //chksum of all previous, last byte in pkt }pkt_upstrm; @@ -83,6 +86,7 @@ uint8_t verLvlData[4]; //ver level }pkt_eui; + //cmds to set radio params enum{ XDOT_CMD_RADIO_SUB_BAND = 1, //set/read radio subband @@ -108,7 +112,8 @@ int8_t antennaGaindBi; //antenna gain uint8_t txPowerdBm; //transmit power uint8_t dataRate; //data rate - uint8_t appPort; //app port + uint8_t appPort; //app port -> not used + uint8_t linkChkCount; //link check count }pkt_setradioup; //downstream pkt struc @@ -126,9 +131,36 @@ int8_t antennaGaindBi; //antenna gain uint8_t txPowerdBm; //transmit power uint8_t dataRate; //data rate - uint8_t appPort; //app port + uint8_t appPort; //app port -> not used + uint8_t linkChkCount; //link check count }pkt_setradiodwn; +//nvm ptks +//structure: cmd structure to proc for setting nvm parameters +//upstream pkt struc +typedef struct { + uint8_t cmd; //cmd received from proc + uint8_t dataLen; //datalen found in pkt + nvm nvmData; +}pkt_setnvmup; +//dwnstream pkt struc +typedef struct { + uint8_t ack; //ack header response + uint8_t cmd; //cmd received from proc + uint8_t dataLen; //datalen found in pkt + nvm nvmData; +}pkt_setnvmdwn; + + + + +//structure: results returned to proc network session +typedef struct { + uint8_t ack; //ack header response + uint8_t cmd; //cmd received from proc + uint8_t dataLen; //datalen found in pkt + uint8_t bSetNetwrk; //1 if wrote network session, 0 if read +}pkt_ntwrk; //structure: results returned to proc of gateway ping typedef struct {