初步移植过来lora基础包协议格式,不能和网关通信未解决
| | |
| | | } |
| | | |
| | | void board_mode_pin_init(void) |
| | | { |
| | | { |
| | | //配置spi片选脚 |
| | | gpio_pin_set_dir(LORA_CS , GPIO_DIR_OUT, 0); |
| | | io_pull_set(LORA_CS, IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | // 判断是Airtag还是免布线模式 |
| | | io_pin_mux_set(MODE_CHANGE_PIN, IO_FUNC0); |
| | | gpio_pin_set_dir( MODE_CHANGE_PIN, GPIO_DIR_IN, 0); |
| | |
| | | enumwltagstate wltag_state=RANGE; |
| | | uint32_t wltag_statetimer,wltag_uwbtimer; |
| | | uint32_t uwbtasktimer=0,uwbtagsendtimer=0; |
| | | uint8_t report_ancnum; |
| | | uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | void IdleTask(void) |
| | | {UART_CheckReceive(); |
| | | //if(read_5v_input_pca()) |
| | |
| | | }else{ |
| | | flag_secondtask = 0; |
| | | } |
| | | lora_tx_flag=1; |
| | | // if(delaysleep_count>0) |
| | | // delaysleep_count--; |
| | | } |
| | |
| | | second_count = 0; |
| | | MinuteTask(); |
| | | } |
| | | lora_tx_flag=1; |
| | | |
| | | |
| | | //Lora_Tx_Poll(); |
| | | // //UWB状态检测 |
| | | //if(!power_low_flag)//低供电下不需要检测重连 |
| | |
| | | } |
| | | |
| | | uint8_t bat_percent; |
| | | uint8_t stationary_flag; |
| | | int main(void) |
| | | { |
| | | // Initialize MCU system |
| | |
| | | while (1) |
| | | { |
| | | uwb_app_poll();//我们的测距逻辑 |
| | | Lora_Tx_Poll(); |
| | | |
| | | |
| | | if(flag_secondtask) |
| | | { |
| | | flag_secondtask = 0; |
| | | SecondTask(); |
| | | //Lora_Tx_Poll(); |
| | | } |
| | | |
| | | Lora_Tx_Poll(); |
| | | IdleTask(); |
| | | } |
| | | } |
| | |
| | | //增加SPI初始化 |
| | | //SPI0/MOSI/MISO/CLK/CS |
| | | io_pin_mux_set(LORA_CS, IO_FUNC0); |
| | | gpio_pin_set_dir(LORA_CS , GPIO_DIR_OUT, 0); |
| | | io_pull_set(LORA_CS, IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | |
| | | io_pin_mux_set(LORA_MOSI, IO_FUNC2); |
| | | io_pin_mux_set(LORA_MISO, IO_FUNC2); |
| | | io_pin_mux_set(LORA_CLK, IO_FUNC2); |
| | |
| | | #define LORA_IRQ IO_PIN_7 |
| | | #define LORA_BUSY IO_PIN_2 |
| | | #define LORA_NRST IO_PIN_4 |
| | | #define SOS_PIN IO_PIN_4 //这个未定义 |
| | | /* =========================================================================================================================== */ |
| | | /* ================ End ================ */ |
| | | /* =========================================================================================================================== */ |