#ifndef __LORAWAN_H #define __LORAWAN_H #include "stm32f10x.h" typedef enum { MODE_INT, MODE_CMD, //mode pin high MODE_TRANSPARENT, } LoraNode_Mode_T; /* typedef enum { NET_ABP, NET_OTAA, } LoraNode_NetMode_T; */ typedef enum { MODE_WAKEUP, MODE_SLEEP, } LoraNode_SleepMode_T; /* typedef struct { uint8_t DevEUI[8]; uint8_t AppEUI[8]; uint8_t DevADDR[4]; uint8_t AppKEY[16]; uint8_t AppSKEY[16]; uint8_t NwkSKEY[16]; uint8_t Join; LoraNode_Mode_T MODE; uint8_t ONline; uint8_t BUSY; uint8_t NET_Mode; uint8_t Confirm; } Node_Info; typedef struct { uint8_t Up_Result; uint8_t Up_CH; uint8_t Up_RATE; uint8_t Up_DB; uint32_t Up_Link; uint16_t Up_Cache; uint16_t Resend; } Send_Info; */ /* Lorawan Node pin configuration */ #define LORANODE_WAKE_PIN GPIO_Pin_4 #define LORANODE_WAKE_GPIO_PORT GPIOC #define LORANODE_MODE_PIN GPIO_Pin_7 #define LORANODE_MODE_GPIO_PORT GPIOC #define LORANODE_NRST_PIN GPIO_Pin_7 #define LORANODE_NRST_GPIO_PORT GPIOA /* INPUT */ #define LORANODE_STAT_PIN GPIO_Pin_8 #define LORANODE_STAT_GPIO_PORT GPIOC #define LORANODE_BUSY_PIN GPIO_Pin_0 #define LORANODE_BUSY_GPIO_PORT GPIOB /* stop the wfi sleep */ #define LORANODE_GPIO_PORT LORANODE_BUSY_GPIO_PORT //LORANODE_STAT_GPIO_PORT #define LORANODE_WAKE_HIGH() GPIO_WriteBit(LORANODE_WAKE_GPIO_PORT, LORANODE_WAKE_PIN, Bit_SET) #define LORANODE_WAKE_LOW() GPIO_WriteBit(LORANODE_WAKE_GPIO_PORT, LORANODE_WAKE_PIN, Bit_RESET) #define LORANODE_MODE_HIGH() GPIO_WriteBit(LORANODE_MODE_GPIO_PORT, LORANODE_MODE_PIN, Bit_SET) #define LORANODE_MODE_LOW() GPIO_WriteBit(LORANODE_MODE_GPIO_PORT, LORANODE_MODE_PIN, Bit_RESET) #define LORANODE_NRST_HIGH() GPIO_WriteBit(LORANODE_NRST_GPIO_PORT, LORANODE_NRST_PIN, Bit_SET) #define LORANODE_NRST_LOW() GPIO_WriteBit(LORANODE_NRST_GPIO_PORT, LORANODE_NRST_PIN, Bit_RESET) #define LORANODE_STAT_STATUS GPIO_ReadInputDataBit(LORANODE_STAT_GPIO_PORT, LORANODE_STAT_PIN) #define LORANODE_BUSY_STATUS GPIO_ReadInputDataBit(LORANODE_BUSY_GPIO_PORT, LORANODE_BUSY_PIN) #define LORANODE_MODE_STATUS GPIO_ReadOutputDataBit(LORANODE_MODE_GPIO_PORT, LORANODE_MODE_PIN) uint8_t StrToHex(uint8_t temp); void LoraNode_GPIO_Init(void); void LoraNode_Init_Mode(LoraNode_Mode_T mode); void LoraNode_Wake_Sleep(LoraNode_SleepMode_T mode); static void LoraNode_Reset(void); void LoraNode_OTAA_Config(void); void transparent_send_data(uint8_t *DataBuf, uint32_t xmitLen); //在透传模式下发送数据 void lorawan_Sleep(void); #endif