├── .gitignore ├── AI1276-071H_SDK.docx ├── AI1276-071H_SDK_ReleaseNote.txt ├── AI1276-401H_SDK.docx ├── AI1276-401H_SDK_ReleaseNote.txt ├── CHANNEL.xlsx ├── LICENSE.md ├── Libraries ├── Byte_Queue.c ├── Byte_Queue.h ├── DWord_Queue.c ├── DWord_Queue.h ├── Message_Queue.c ├── Message_Queue.h ├── Radio │ ├── lbtafa.h │ ├── platform.h │ ├── radio.h │ ├── sx1276-Fsk.h │ ├── sx1276-FskMisc.h │ ├── sx1276-LoRa.h │ ├── sx1276-LoRaMisc.h │ └── sx1276.h ├── STM32F0xx_CMSIS │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ ├── Device │ │ └── ST │ │ │ └── STM32F0xx │ │ │ ├── Include │ │ │ ├── stm32f0xx.h │ │ │ └── system_stm32f0xx.h │ │ │ └── Source │ │ │ └── Templates │ │ │ └── arm │ │ │ ├── startup_stm32f030.s │ │ │ ├── startup_stm32f030xc.s │ │ │ ├── startup_stm32f031.s │ │ │ ├── startup_stm32f042.s │ │ │ ├── startup_stm32f051.s │ │ │ ├── startup_stm32f070x6.s │ │ │ ├── startup_stm32f070xb.s │ │ │ ├── startup_stm32f072.s │ │ │ ├── startup_stm32f091.s │ │ │ ├── startup_stm32f0xx.s │ │ │ └── startup_stm32f0xx_ld.s │ ├── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm4_simd.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_sc000.h │ │ └── core_sc300.h │ ├── README.txt │ └── RTOS │ │ └── cmsis_os.h ├── STM32F0xx_StdPeriph_Driver │ ├── MCD-ST Liberty SW License Agreement V2.pdf │ ├── Release_Notes.html │ ├── inc │ │ ├── stm32f0xx_adc.h │ │ ├── stm32f0xx_can.h │ │ ├── stm32f0xx_cec.h │ │ ├── stm32f0xx_comp.h │ │ ├── stm32f0xx_crc.h │ │ ├── stm32f0xx_crs.h │ │ ├── stm32f0xx_dac.h │ │ ├── stm32f0xx_dbgmcu.h │ │ ├── stm32f0xx_dma.h │ │ ├── stm32f0xx_exti.h │ │ ├── stm32f0xx_flash.h │ │ ├── stm32f0xx_gpio.h │ │ ├── stm32f0xx_i2c.h │ │ ├── stm32f0xx_iwdg.h │ │ ├── stm32f0xx_misc.h │ │ ├── stm32f0xx_pwr.h │ │ ├── stm32f0xx_rcc.h │ │ ├── stm32f0xx_rtc.h │ │ ├── stm32f0xx_spi.h │ │ ├── stm32f0xx_syscfg.h │ │ ├── stm32f0xx_tim.h │ │ ├── stm32f0xx_usart.h │ │ └── stm32f0xx_wwdg.h │ └── src │ │ ├── stm32f0xx_adc.c │ │ ├── stm32f0xx_can.c │ │ ├── stm32f0xx_cec.c │ │ ├── stm32f0xx_comp.c │ │ ├── stm32f0xx_crc.c │ │ ├── stm32f0xx_crs.c │ │ ├── stm32f0xx_dac.c │ │ ├── stm32f0xx_dbgmcu.c │ │ ├── stm32f0xx_dma.c │ │ ├── stm32f0xx_exti.c │ │ ├── stm32f0xx_flash.c │ │ ├── stm32f0xx_gpio.c │ │ ├── stm32f0xx_i2c.c │ │ ├── stm32f0xx_iwdg.c │ │ ├── stm32f0xx_misc.c │ │ ├── stm32f0xx_pwr.c │ │ ├── stm32f0xx_rcc.c │ │ ├── stm32f0xx_rtc.c │ │ ├── stm32f0xx_spi.c │ │ ├── stm32f0xx_syscfg.c │ │ ├── stm32f0xx_tim.c │ │ ├── stm32f0xx_usart.c │ │ └── stm32f0xx_wwdg.c ├── STM32F401_USB │ ├── MCD-ST Liberty SW License Agreement V2.pdf │ ├── usb_bsp.h │ ├── usb_conf.h │ ├── usb_core.c │ ├── usb_core.h │ ├── usb_dcd.c │ ├── usb_dcd.h │ ├── usb_dcd_int.c │ ├── usb_dcd_int.h │ ├── usb_defines.h │ ├── usb_otg.c │ ├── usb_otg.h │ ├── usb_regs.h │ ├── usbd_cdc_core.c │ ├── usbd_cdc_core.h │ ├── usbd_conf.h │ ├── usbd_core.c │ ├── usbd_core.h │ ├── usbd_def.h │ ├── usbd_desc.c │ ├── usbd_desc.h │ ├── usbd_ioreq.c │ ├── usbd_ioreq.h │ ├── usbd_req.c │ ├── usbd_req.h │ ├── usbd_usr.c │ └── usbd_usr.h ├── STM32F4xx_CMSIS │ ├── CMSIS_END_USER_LICENCE_AGREEMENT.pdf │ ├── Device │ │ └── ST │ │ │ └── STM32F4xx │ │ │ ├── Include │ │ │ ├── stm32f4xx.h │ │ │ └── system_stm32f4xx.h │ │ │ └── Source │ │ │ └── Templates │ │ │ └── arm │ │ │ ├── startup_stm32f401xx.s │ │ │ ├── startup_stm32f40_41xxx.s │ │ │ ├── startup_stm32f40xx.s │ │ │ ├── startup_stm32f410xx.s │ │ │ ├── startup_stm32f411xe.s │ │ │ ├── startup_stm32f427_437xx.s │ │ │ ├── startup_stm32f427x.s │ │ │ ├── startup_stm32f429_439xx.s │ │ │ ├── startup_stm32f446xx.s │ │ │ └── startup_stm32f469_479xx.s │ ├── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h │ ├── README.txt │ └── RTOS │ │ └── cmsis_os.h ├── STM32F4xx_StdPeriph_Driver │ ├── MCD-ST Liberty SW License Agreement V2.pdf │ ├── Release_Notes.html │ ├── inc │ │ ├── misc.h │ │ ├── stm32f4xx_adc.h │ │ ├── stm32f4xx_can.h │ │ ├── stm32f4xx_cec.h │ │ ├── stm32f4xx_crc.h │ │ ├── stm32f4xx_cryp.h │ │ ├── stm32f4xx_dac.h │ │ ├── stm32f4xx_dbgmcu.h │ │ ├── stm32f4xx_dcmi.h │ │ ├── stm32f4xx_dma.h │ │ ├── stm32f4xx_dma2d.h │ │ ├── stm32f4xx_dsi.h │ │ ├── stm32f4xx_exti.h │ │ ├── stm32f4xx_flash.h │ │ ├── stm32f4xx_flash_ramfunc.h │ │ ├── stm32f4xx_fmc.h │ │ ├── stm32f4xx_fmpi2c.h │ │ ├── stm32f4xx_fsmc.h │ │ ├── stm32f4xx_gpio.h │ │ ├── stm32f4xx_hash.h │ │ ├── stm32f4xx_i2c.h │ │ ├── stm32f4xx_iwdg.h │ │ ├── stm32f4xx_lptim.h │ │ ├── stm32f4xx_ltdc.h │ │ ├── stm32f4xx_pwr.h │ │ ├── stm32f4xx_qspi.h │ │ ├── stm32f4xx_rcc.h │ │ ├── stm32f4xx_rng.h │ │ ├── stm32f4xx_rtc.h │ │ ├── stm32f4xx_sai.h │ │ ├── stm32f4xx_sdio.h │ │ ├── stm32f4xx_spdifrx.h │ │ ├── stm32f4xx_spi.h │ │ ├── stm32f4xx_syscfg.h │ │ ├── stm32f4xx_tim.h │ │ ├── stm32f4xx_usart.h │ │ └── stm32f4xx_wwdg.h │ └── src │ │ ├── misc.c │ │ ├── stm32f4xx_adc.c │ │ ├── stm32f4xx_can.c │ │ ├── stm32f4xx_cec.c │ │ ├── stm32f4xx_crc.c │ │ ├── stm32f4xx_cryp.c │ │ ├── stm32f4xx_cryp_aes.c │ │ ├── stm32f4xx_cryp_des.c │ │ ├── stm32f4xx_cryp_tdes.c │ │ ├── stm32f4xx_dac.c │ │ ├── stm32f4xx_dbgmcu.c │ │ ├── stm32f4xx_dcmi.c │ │ ├── stm32f4xx_dma.c │ │ ├── stm32f4xx_dma2d.c │ │ ├── stm32f4xx_dsi.c │ │ ├── stm32f4xx_exti.c │ │ ├── stm32f4xx_flash.c │ │ ├── stm32f4xx_flash_ramfunc.c │ │ ├── stm32f4xx_fmc.c │ │ ├── stm32f4xx_fmpi2c.c │ │ ├── stm32f4xx_fsmc.c │ │ ├── stm32f4xx_gpio.c │ │ ├── stm32f4xx_hash.c │ │ ├── stm32f4xx_hash_md5.c │ │ ├── stm32f4xx_hash_sha1.c │ │ ├── stm32f4xx_i2c.c │ │ ├── stm32f4xx_iwdg.c │ │ ├── stm32f4xx_lptim.c │ │ ├── stm32f4xx_ltdc.c │ │ ├── stm32f4xx_pwr.c │ │ ├── stm32f4xx_qspi.c │ │ ├── stm32f4xx_rcc.c │ │ ├── stm32f4xx_rng.c │ │ ├── stm32f4xx_rtc.c │ │ ├── stm32f4xx_sai.c │ │ ├── stm32f4xx_sdio.c │ │ ├── stm32f4xx_spdifrx.c │ │ ├── stm32f4xx_spi.c │ │ ├── stm32f4xx_syscfg.c │ │ ├── stm32f4xx_tim.c │ │ ├── stm32f4xx_usart.c │ │ └── stm32f4xx_wwdg.c ├── Word_Queue.c ├── Word_Queue.h └── libshell │ ├── doc │ ├── HOWTO │ └── README │ ├── shell.c │ └── shell.h ├── MDK ├── AI1276-071H.hex ├── AI1276-071H_w-SDK.uvopt ├── AI1276-071H_w-SDK.uvproj ├── AI1276-401H.hex ├── AI1276-401H_w-SDK.uvopt ├── AI1276-401H_w-SDK.uvproj ├── AI1278-071H.hex ├── AI1278-071H_w-SDK.uvopt ├── AI1278-071H_w-SDK.uvproj ├── AI1278-401H.hex ├── AI1278-401H_w-SDK.uvopt ├── AI1278-401H_w-SDK.uvproj └── AcSiP_Libries │ ├── AI1276-071H__Protocol.lib │ ├── AI1276-071H__Radio.lib │ ├── AI1276-401H__Protocol.lib │ ├── AI1276-401H__Radio.lib │ ├── AI1278-071H__Protocol.lib │ ├── AI1278-071H__Radio.lib │ ├── AI1278-401H__Protocol.lib │ └── AI1278-401H__Radio.lib ├── README.md ├── Readme ├── AI1276-401H.jpg ├── AI127x-071H_IAP__UART2.hex ├── AI127x-401H_IAP__UART2.hex ├── CLI__Command_List__Consol_Terminal.md ├── CLI__Command_List__Format.md ├── CLI__Command_List__Index.md ├── CLI__Command_List__Miscellaneous.md ├── CLI__Command_List__Payload.md ├── CLI__Command_List__Polling_Mode_Group.md ├── CLI__Command_List__PreDefined_MCS.md ├── CLI__Command_List__RF_Parameters.md ├── CLI__Command_List__RX_Signal.md ├── Main_Process_Flow.png ├── OnMaster_for_Normal_Process.png ├── OnSlave_for_Noraml__Process.png ├── Readme.md ├── UART_IAP │ ├── IAP__F401_01.PNG │ ├── IAP__F401_02.PNG │ ├── IAP__F401_03.PNG │ ├── IAP__F401_04.PNG │ └── Readme.md └── ai1276-401hpcab001.jpg ├── Test ├── FlashTestMain.c ├── FlashTestMain.h ├── TESTcli.c ├── TESTcli.h ├── TESTmain.c ├── TESTmain.h ├── UnionStructTestMain.c └── UnionStructTestMain.h └── USER ├── Console_Timer.c ├── Console_Timer.h ├── LinkListEvent.c ├── LinkListEvent.h ├── RandomHopStartChannel.c ├── RandomHopStartChannel.h ├── STM32F072RBx ├── Base_Driver__ADC1.c ├── Base_Driver__ADC1.h ├── Base_Driver__UART1.c ├── Base_Driver__UART1.h ├── Base_Driver__UART2.c ├── Base_Driver__UART2.h ├── save_record.c ├── save_record.h ├── stm32f0xx_conf.h ├── stm32f0xx_it.c ├── stm32f0xx_it.h ├── system_stm32f0xx.c ├── usart1.c └── usart1.h ├── STM32F401VCx ├── Base_Driver__ADC1.c ├── Base_Driver__ADC1.h ├── Base_Driver__UART1.c ├── Base_Driver__UART1.h ├── Base_Driver__UART2.c ├── Base_Driver__UART2.h ├── save_record.c ├── save_record.h ├── stm32f4xx_conf.h ├── stm32f4xx_it.c ├── stm32f4xx_it.h ├── system_stm32f4xx.c ├── tim2.c ├── tim2.h ├── tim3.c ├── tim3.h ├── tim9.c ├── tim9.h ├── usart1.c └── usart1.h ├── UART_Console.c ├── UART_Console.h ├── acsip_protocol.h ├── base64.c ├── base64.h ├── bluetooth.c ├── bluetooth.h ├── board.c ├── board.h ├── button.c ├── button.h ├── cli.c ├── cli.h ├── config.h ├── console_function.c ├── console_function.h ├── crc.c ├── crc.h ├── flash.c ├── flash.h ├── gpio.c ├── gpio.h ├── gps.c ├── gps.h ├── led.c ├── led.h ├── main.c ├── main.h ├── normalMaster.c ├── normalMaster.h ├── normalSlave.c ├── normalSlave.h ├── rtc.c ├── rtc.h ├── sleep.c ├── sleep.h ├── spi.c ├── spi.h ├── sx1276-Hal.c ├── sx1276-Hal.h ├── usb_bsp.c ├── usbd_cdc_vcp.c ├── usbd_cdc_vcp.h ├── uuid.c ├── uuid.h ├── xor_crypto.c └── xor_crypto.h /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE! Don't add files that are generated in specific 3 | # subdirectories here. Add them in the ".gitignore" file 4 | # in that subdirectory instead. 5 | # 6 | # Normal rules 7 | # 8 | .* 9 | *.o 10 | *.d 11 | *.crf 12 | 13 | # folder 14 | MDK/Obj_* 15 | 16 | # backup file 17 | *.bak 18 | 19 | !.gitignore 20 | 21 | *.orig 22 | 23 | # JLink file 24 | JLink*.txt 25 | JLink*.ini 26 | 27 | # Keil user file 28 | *.uvgui.* 29 | *.uvgui 30 | 31 | # Source insight 32 | *.IAB 33 | *.IAD 34 | *.IMB 35 | *.IMD 36 | *.PFI 37 | *.PO 38 | *.PR 39 | *.PRI 40 | *.PS 41 | *.WK3 42 | 43 | 44 | -------------------------------------------------------------------------------- /AI1276-071H_SDK.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/AI1276-071H_SDK.docx -------------------------------------------------------------------------------- /AI1276-071H_SDK_ReleaseNote.txt: -------------------------------------------------------------------------------- 1 | *********************************************************************** 2 | * * 3 | * * 4 | * AI1276-071H SDK * 5 | * * 6 | * * 7 | *********************************************************************** 8 | Introduction: 9 | 2016 AcSiP Technology Corporation. All rights reserved. 10 | This package is used for AI1276-071H developing and it contains files 11 | licensed under MCD-ST Liberty SW License Agreement V2. 12 | 13 | 14 | 15 | ==============================0.5.160630=============================== 16 | Firmware Version: 17 | 0.5.160630 18 | 19 | Release Date: 20 | 2016/07/12 21 | 22 | Upgrades: 23 | 1. Update CLI commands. 24 | 2. Update AcSiP LoRa protocol. 25 | 26 | Known Issue: 27 | N/A 28 | 29 | ==============================0.5.160520=============================== 30 | Firmware Version: 31 | 0.5.160520 32 | 33 | Release Date: 34 | 2016/06/27 35 | 36 | Upgrades: 37 | 1. First release of SDK package with LED Blink function sample. 38 | 39 | Known Issue: 40 | N/A -------------------------------------------------------------------------------- /AI1276-401H_SDK.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/AI1276-401H_SDK.docx -------------------------------------------------------------------------------- /AI1276-401H_SDK_ReleaseNote.txt: -------------------------------------------------------------------------------- 1 | *********************************************************************** 2 | * * 3 | * * 4 | * AI1276-401H SDK * 5 | * * 6 | * * 7 | *********************************************************************** 8 | Introduction: 9 | 2016 AcSiP Technology Corporation. All rights reserved. 10 | This package is used for AI1276-401H developing and it contains files 11 | licensed under MCD-ST Liberty SW License Agreement V2. 12 | 13 | 14 | 15 | ==============================0.5.160630=============================== 16 | Firmware Version: 17 | 0.5.160630 18 | 19 | Release Date: 20 | 2016/07/12 21 | 22 | Upgrades: 23 | 1. Update CLI commands. 24 | 2. Update AcSiP LoRa protocol. 25 | 26 | Known Issue: 27 | N/A 28 | 29 | ==============================0.5.160427=============================== 30 | Firmware Version: 31 | 0.5.160427 32 | 33 | Release Date: 34 | 2016/05/16 35 | 36 | Upgrades: 37 | 1. First release of SDK package with LED Blink function sample. 38 | 39 | Known Issue: 40 | N/A -------------------------------------------------------------------------------- /CHANNEL.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/CHANNEL.xlsx -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | Copyright(C) 2016 AcSiP Technology Corp. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted, provided that the following conditions are met: 5 | 6 | 1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 3. Neither the name of AcSiP Technology Corp. nor the names of other contributors to this software may be used to endorse or promote products derived from this software without specific written permission. 9 | 4. This software, including modifications and/or derivative works of this software, must execute solely and exclusively on module or component devices manufactured by or for AcSiP Technology Corp. 10 | 5. Redistribution and use of this software other than as permitted under this license is void and will automatically terminate your rights under this license. 11 | 12 | THIS SOFTWARE IS PROVIDED BY ACSIP TECHNOLOGY CORP. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL ACSIP TECHNOLOGY CORP OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 13 | 14 | 15 | -------------------------------------------------------------------------------- /Libraries/Byte_Queue.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Includes ------------------------------------------------------------------*/ 15 | #include 16 | #include "Byte_Queue.h" 17 | 18 | /* Private typedef -----------------------------------------------------------*/ 19 | /* Private define ------------------------------------------------------------*/ 20 | /* Private macro -------------------------------------------------------------*/ 21 | /* Private variables ---------------------------------------------------------*/ 22 | /* Private function prototypes -----------------------------------------------*/ 23 | /* Private functions ---------------------------------------------------------*/ 24 | 25 | bool Init_Byte_Queue( Byte_Queue_Struct *queue, uint16_t buf_sz ) 26 | { 27 | if( ! queue || ! buf_sz ) return( false ); 28 | if( queue->Buffer ) return( false ); 29 | 30 | queue->Buffer_Size = 0; 31 | queue->Buffer = malloc( buf_sz ); 32 | if( ! queue->Buffer ) return( false ); 33 | 34 | queue->Buffer_Size = buf_sz; 35 | return( true ); 36 | } 37 | 38 | void Clear_Byte_Queue( Byte_Queue_Struct *queue ) 39 | { 40 | queue->Buffer[ 0 ] = 0x00; 41 | queue->Head = queue->Tail = 0; 42 | } 43 | 44 | bool Is_Byte_Queue_Empty( Byte_Queue_Struct *queue ) 45 | { 46 | return( queue->Head == queue->Tail ); 47 | } 48 | 49 | bool Is_Byte_Queue_Full( Byte_Queue_Struct *queue ) 50 | { 51 | uint16_t t; 52 | 53 | t = queue->Head + 1; 54 | t %= queue->Buffer_Size; 55 | return( t == queue->Tail ); 56 | } 57 | 58 | bool Get_Byte_from_Queue( Byte_Queue_Struct *queue ) 59 | { 60 | if( queue->Tail == queue->Head ) return( false ); 61 | 62 | queue->Output = queue->Buffer[ queue->Tail ]; 63 | queue->Tail++; 64 | queue->Tail %= queue->Buffer_Size; 65 | 66 | return( true ); 67 | } 68 | 69 | bool Peek_Byte_from_Queue( Byte_Queue_Struct *queue ) 70 | { 71 | if( queue->Tail == queue->Head ) return( false ); 72 | 73 | queue->Output = queue->Buffer[ queue->Tail ]; 74 | return( true ); 75 | } 76 | 77 | bool Put_Byte_into_Queue( Byte_Queue_Struct *queue, uint8_t d ) 78 | { 79 | if( Is_Byte_Queue_Full( queue ) ) return( false ); 80 | 81 | queue->Buffer[ queue->Head ] = d; 82 | queue->Head++; 83 | queue->Head %= queue->Buffer_Size; 84 | 85 | return( true ); 86 | } 87 | 88 | uint16_t Get_Data_Size_of_Byte_Queue( Byte_Queue_Struct *queue ) 89 | { 90 | uint16_t t; 91 | 92 | if( queue->Head >= queue->Tail ) { 93 | t = queue->Head - queue->Tail; 94 | } else { 95 | t = queue->Buffer_Size - queue->Tail; 96 | t += queue->Head; 97 | } 98 | return( t ); 99 | } 100 | 101 | uint16_t Get_Available_Size_of_Byte_Queue( Byte_Queue_Struct *queue ) 102 | { 103 | uint16_t t; 104 | 105 | t = Get_Data_Size_of_Byte_Queue( queue ); 106 | return( queue->Buffer_Size - t - 1 ); 107 | } 108 | 109 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /Libraries/Byte_Queue.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef LIBRARIES_BYTE_QUEUE_H_ 15 | #define LIBRARIES_BYTE_QUEUE_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | 21 | /* Exported define -----------------------------------------------------------*/ 22 | /* Exported types ------------------------------------------------------------*/ 23 | typedef struct _Byte_Queue_Struct_ { 24 | uint8_t Output; 25 | uint8_t *Buffer; 26 | uint16_t Buffer_Size; 27 | uint16_t Head; // Head == Tail means there is no data 28 | uint16_t Tail; // Head+1 == Tail means the queue is full 29 | } Byte_Queue_Struct; 30 | 31 | /* Exported constants --------------------------------------------------------*/ 32 | /* Exported macro ------------------------------------------------------------*/ 33 | /* Exported variables --------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | bool Init_Byte_Queue( Byte_Queue_Struct *queue, uint16_t buf_sz ); 36 | void Clear_Byte_Queue( Byte_Queue_Struct *queue ); 37 | bool Is_Byte_Queue_Empty( Byte_Queue_Struct *queue ); 38 | bool Is_Byte_Queue_Full( Byte_Queue_Struct *queue ); 39 | bool Get_Byte_from_Queue( Byte_Queue_Struct *queue ); 40 | bool Peek_Byte_from_Queue( Byte_Queue_Struct *queue ); 41 | bool Put_Byte_into_Queue( Byte_Queue_Struct *queue, uint8_t d ); 42 | uint16_t Get_Data_Size_of_Byte_Queue( Byte_Queue_Struct *queue ); 43 | uint16_t Get_Available_Size_of_Byte_Queue( Byte_Queue_Struct *queue ); 44 | 45 | #endif // LIBRARIES_BYTE_QUEUE_H_ 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /Libraries/DWord_Queue.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Includes ------------------------------------------------------------------*/ 15 | #include 16 | #include "DWord_Queue.h" 17 | 18 | /* Private typedef -----------------------------------------------------------*/ 19 | /* Private define ------------------------------------------------------------*/ 20 | /* Private macro -------------------------------------------------------------*/ 21 | /* Private variables ---------------------------------------------------------*/ 22 | /* Private function prototypes -----------------------------------------------*/ 23 | /* Private functions ---------------------------------------------------------*/ 24 | 25 | bool Init_DWord_Queue( DWord_Queue_Struct *queue, uint16_t buf_items ) 26 | { 27 | if( ! queue || ! buf_items ) return( false ); 28 | if( queue->Buffer ) return( false ); 29 | 30 | queue->Buffer_Size = 0; 31 | queue->Buffer = malloc( buf_items * sizeof( uint32_t ) ); 32 | if( ! queue->Buffer ) return( false ); 33 | 34 | queue->Buffer_Size = buf_items; 35 | return( true ); 36 | } 37 | 38 | void Clear_DWord_Queue( DWord_Queue_Struct *queue ) 39 | { 40 | queue->Buffer[ 0 ] = 0x00; 41 | queue->Head = queue->Tail; 42 | } 43 | 44 | bool Is_DWord_Queue_Empty( DWord_Queue_Struct *queue ) 45 | { 46 | return( queue->Head == queue->Tail ); 47 | } 48 | 49 | bool Is_DWord_Queue_Full( DWord_Queue_Struct *queue ) 50 | { 51 | uint16_t t; 52 | 53 | t = queue->Head + 1; 54 | t %= queue->Buffer_Size; 55 | return( t == queue->Tail ); 56 | } 57 | 58 | bool Get_DWord_from_Queue( DWord_Queue_Struct *queue ) 59 | { 60 | if( queue->Tail == queue->Head ) return( false ); 61 | 62 | queue->Output = queue->Buffer[ queue->Tail ]; 63 | queue->Tail++; 64 | queue->Tail %= queue->Buffer_Size; 65 | 66 | return( true ); 67 | } 68 | 69 | bool Peek_DWord_from_Queue( DWord_Queue_Struct *queue ) 70 | { 71 | if( queue->Tail == queue->Head ) return( false ); 72 | 73 | queue->Output = queue->Buffer[ queue->Tail ]; 74 | return( true ); 75 | } 76 | 77 | bool Put_DWord_into_Queue( DWord_Queue_Struct *queue, uint32_t d ) 78 | { 79 | if( Is_DWord_Queue_Full( queue ) ) return( false ); 80 | 81 | queue->Buffer[ queue->Head ] = d; 82 | queue->Head++; 83 | queue->Head %= queue->Buffer_Size; 84 | 85 | return( true ); 86 | } 87 | 88 | uint16_t Get_Data_Size_of_DWord_Queue( DWord_Queue_Struct *queue ) 89 | { 90 | uint16_t t; 91 | 92 | if( queue->Head >= queue->Tail ) { 93 | t = queue->Head - queue->Tail; 94 | } else { 95 | t = queue->Buffer_Size - queue->Tail; 96 | t += queue->Head; 97 | } 98 | return( t ); 99 | } 100 | 101 | uint16_t Get_Available_Size_of_DWord_Queue( DWord_Queue_Struct *queue ) 102 | { 103 | uint16_t t; 104 | 105 | t = Get_Data_Size_of_DWord_Queue( queue ); 106 | return( queue->Buffer_Size - t - 1 ); 107 | } 108 | 109 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /Libraries/DWord_Queue.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef LIBRARIES_DWORD_QUEUE_H_ 15 | #define LIBRARIES_DWORD_QUEUE_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | 21 | /* Exported define -----------------------------------------------------------*/ 22 | /* Exported types ------------------------------------------------------------*/ 23 | typedef struct _DWord_Queue_Struct_ { 24 | uint32_t Output; 25 | uint32_t *Buffer; 26 | uint16_t Buffer_Size; 27 | uint16_t Head; // Head == Tail means there is no data 28 | uint16_t Tail; // Head+1 == Tail means the queue is full 29 | } DWord_Queue_Struct; 30 | 31 | /* Exported constants --------------------------------------------------------*/ 32 | /* Exported macro ------------------------------------------------------------*/ 33 | /* Exported variables --------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | bool Init_DWord_Queue( DWord_Queue_Struct *queue, uint16_t buf_items ); 36 | void Clear_DWord_Queue( DWord_Queue_Struct *queue ); 37 | bool Is_DWord_Queue_Empty( DWord_Queue_Struct *queue ); 38 | bool Is_DWord_Queue_Full( DWord_Queue_Struct *queue ); 39 | bool Get_DWord_from_Queue( DWord_Queue_Struct *queue ); 40 | bool Peek_DWord_from_Queue( DWord_Queue_Struct *queue ); 41 | bool Put_DWord_into_Queue( DWord_Queue_Struct *queue, uint32_t d ); 42 | uint16_t Get_Data_Size_of_DWord_Queue( DWord_Queue_Struct *queue ); 43 | uint16_t Get_Available_Size_of_DWord_Queue( DWord_Queue_Struct *queue ); 44 | 45 | #endif // LIBRARIES_DWORD_QUEUE_H_ 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /Libraries/Message_Queue.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Includes ------------------------------------------------------------------*/ 15 | #include 16 | #include "Message_Queue.h" 17 | 18 | 19 | /* Private typedef -----------------------------------------------------------*/ 20 | /* Private define ------------------------------------------------------------*/ 21 | /* Private macro -------------------------------------------------------------*/ 22 | /* Private variables ---------------------------------------------------------*/ 23 | /* Private function prototypes -----------------------------------------------*/ 24 | /* Private functions ---------------------------------------------------------*/ 25 | bool Init_Message_Queue( Message_Queue_Struct *queue, uint16_t buf_size, uint16_t item_size ) 26 | { 27 | if( ! queue || ! buf_size || ! item_size ) return( false ); 28 | 29 | if( ! Init_Byte_Queue( &( queue->Message_Queue ), buf_size ) ) return( false ); 30 | if( ! Init_Word_Queue( &( queue->Item_Queue ), item_size ) ) return( false ); 31 | return( true ); 32 | } 33 | 34 | void Clear_Message_Queue( Message_Queue_Struct *queue ) 35 | { 36 | Clear_Byte_Queue( &( queue->Message_Queue ) ); 37 | Clear_Word_Queue( &( queue->Item_Queue ) ); 38 | } 39 | 40 | bool Is_Message_Queue_Empty( Message_Queue_Struct *queue ) 41 | { 42 | return( Is_Word_Queue_Empty( &( queue->Item_Queue ) ) ); 43 | } 44 | 45 | bool Put_Message_into_Queue( Message_Queue_Struct *queue, const uint8_t *msg, uint16_t length ) 46 | { 47 | uint16_t i, rsz; 48 | 49 | // Check item space 50 | if( Is_Word_Queue_Full( &( queue->Item_Queue ) ) ) return( false ); 51 | 52 | // Check buffer space 53 | rsz = Get_Available_Size_of_Byte_Queue( &( queue->Message_Queue ) ); 54 | if( rsz < length ) return( false ); 55 | 56 | // Insert message 57 | for( i = 0; i < length; i++ ) { 58 | Put_Byte_into_Queue( &( queue->Message_Queue ), msg[ i ] ); 59 | } 60 | 61 | // Insert message length as item 62 | Put_Word_into_Queue( &( queue->Item_Queue ), length ); 63 | return( true ); 64 | } 65 | 66 | 67 | bool Get_Message_from_Queue( uint8_t *buffer, uint16_t buf_sz, uint16_t *ret_length, Message_Queue_Struct *queue ) 68 | { 69 | uint16_t i, dsz; 70 | 71 | // Get message length 72 | if( ! Peek_Word_from_Queue( &( queue->Item_Queue ) ) ) return( false ); 73 | 74 | // Check buffer size 75 | dsz = queue->Item_Queue.Output; 76 | if( dsz > buf_sz ) { 77 | if( ret_length ) *ret_length = dsz; 78 | return( false ); 79 | } 80 | 81 | // Get message 82 | for( i = 0; i < dsz; i++ ) { 83 | Get_Byte_from_Queue( &( queue->Message_Queue ) ); 84 | buffer[ i ] = queue->Message_Queue.Output; 85 | } 86 | if( ret_length ) *ret_length = i; 87 | 88 | // Remove item from queue 89 | Get_Word_from_Queue( &( queue->Item_Queue ) ); 90 | 91 | return( true ); 92 | } 93 | 94 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 95 | 96 | -------------------------------------------------------------------------------- /Libraries/Message_Queue.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef LIBRARIES_MESSAGE_QUEUE_H_ 15 | #define LIBRARIES_MESSAGE_QUEUE_H_ 16 | //--------------------------------------------------------------------------- 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | #include 21 | 22 | #include "Byte_Queue.h" 23 | #include "Word_Queue.h" 24 | 25 | /* Exported define -----------------------------------------------------------*/ 26 | /* Exported types ------------------------------------------------------------*/ 27 | typedef struct _Message_Queue_Struct_ { 28 | Byte_Queue_Struct Message_Queue; 29 | Word_Queue_Struct Item_Queue; 30 | } Message_Queue_Struct; 31 | 32 | /* Exported constants --------------------------------------------------------*/ 33 | /* Exported macro ------------------------------------------------------------*/ 34 | /* Exported variables --------------------------------------------------------*/ 35 | /* Exported functions ------------------------------------------------------- */ 36 | bool Init_Message_Queue( Message_Queue_Struct *queue, uint16_t buf_size, uint16_t item_size ); 37 | void Clear_Message_Queue( Message_Queue_Struct *queue ); 38 | bool Is_Message_Queue_Empty( Message_Queue_Struct *queue ); 39 | bool Put_Message_into_Queue( Message_Queue_Struct *queue, const uint8_t *msg, uint16_t length ); 40 | bool Get_Message_from_Queue( uint8_t *buffer, uint16_t buf_sz, uint16_t *ret_length, Message_Queue_Struct *queue ); 41 | 42 | //--------------------------------------------------------------------------- 43 | #endif // LIBRARIES_MESSAGE_QUEUE_H_ 44 | 45 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /Libraries/Radio/lbtafa.h: -------------------------------------------------------------------------------- 1 | 2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2017(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_LBTAFA_H_ 16 | #define USER_LBTAFA_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | 20 | /* Exported define -----------------------------------------------------------*/ 21 | #define LBT__MAXIMUM_AFA_CHANNELS 7 22 | 23 | 24 | /* 25 | #define LBTandAFA_Channels_CE Lora_RFFrequency 26 | #define LBTandAFA_Channels_JP Lora_RFFrequency 27 | 28 | // #define LBTandAFA_Channels LBTandAFA_Channels_CE 29 | #define LBTandAFA_Channels LBTandAFA_Channels_JP 30 | 31 | #define DefaultToDoLBT (true) 32 | #define CE_ToDoLBT (false) 33 | #define CE_ToDoAFA (false) 34 | #define JP_ToDoLBT (true) 35 | 36 | #if ( CE_ToDoLBT == true ) && ( JP_ToDoLBT == false ) 37 | #define CE_LBT_Function (true) 38 | #define JP_LBT_Function (false) 39 | 40 | #elif ( CE_ToDoLBT == false ) && ( JP_ToDoLBT == true ) 41 | #define CE_LBT_Function (false) 42 | #define JP_LBT_Function (true) 43 | #else 44 | #define CE_LBT_Function (false) 45 | #define JP_LBT_Function (false) 46 | #endif 47 | 48 | #if ( CE_LBT_Function == true ) && ( CE_ToDoAFA == true ) 49 | #define CE_AFA_Function (true) 50 | #else 51 | #define CE_AFA_Function (false) 52 | #endif 53 | 54 | #define DefaultPreambleLength (128) 55 | #define CADandAFA_TX_PreambleLength DefaultPreambleLength 56 | #define CADandAFA_RX_PreambleLength DefaultPreambleLength 57 | */ 58 | 59 | 60 | /* Exported types ------------------------------------------------------------*/ 61 | typedef enum Enum__Option_LBT { 62 | LBT__Option__None = 0, 63 | LBT__Option__Japan, 64 | LBT__Option__Europe_w_AFA, 65 | 66 | LBT__Option__Enums 67 | } tEnum__Option_LBT; 68 | 69 | 70 | /* Exported constants --------------------------------------------------------*/ 71 | /* Exported macro ------------------------------------------------------------*/ 72 | 73 | /* Exported variables ------------------------------------------------------------*/ 74 | extern tEnum__Option_LBT LBT__Option_Mode; 75 | 76 | /* Exported functions --------------------------------------------------------*/ 77 | void LBTandAFA_RandomWaittingTimeSetting(void); 78 | void LBTandAFA_ToDoCADandAFASetting(void); 79 | bool LBTandAFA_IsRunningLBT(void); 80 | void LBTandAFA_TxPreambleSetting(void); 81 | void LBTandAFA_RxPreambleSetting(void); 82 | void LBTandAFA_ParameterDeInit(void); 83 | bool LBTandAFA_TX(void); 84 | //void LBTandAFA_ClearTxParameter(void); 85 | bool LBTandAFA_RX(void); 86 | void LBTandAFA_ClearRxParameter(void); 87 | bool SX1276LoRaIsChannelFree(int16_t); 88 | bool SX1276LoRaIsChannelRealFreeAndCanTX(void); 89 | 90 | 91 | void LBT__Initialize( tEnum__Option_LBT mode ); 92 | void LBT__Configure_AFA_Channels( const int32_t *ch_freq_Hz, uint16_t channels ); 93 | 94 | bool LBT__Wait_RF_Channel_Clear( uint16_t timeout_ms ); 95 | void LBT__Configure_Receving( void ); 96 | 97 | 98 | #endif // USER_LBTAFA_H_ 99 | 100 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 101 | -------------------------------------------------------------------------------- /Libraries/Radio/platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND 3 | * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER. 4 | * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR 5 | * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT 6 | * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION 7 | * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 8 | * 9 | * Copyright (C) SEMTECH S.A. 10 | */ 11 | /*! 12 | * \file platform.h 13 | * \brief 14 | * 15 | * \version 1.0 16 | * \date Nov 21 2012 17 | * \author Miguel Luis 18 | */ 19 | #ifndef __PLATFORM_H__ 20 | #define __PLATFORM_H__ 21 | 22 | #ifndef __GNUC__ 23 | #define inline 24 | #endif 25 | 26 | /*! 27 | * Platform definition 28 | */ 29 | #define Bleeper 3 30 | #define SX1243ska 2 31 | #define SX12xxEiger 1 32 | #define SX12000DVK 0 33 | 34 | /*! 35 | * Platform choice. Please uncoment the PLATFORM define and choose your platform 36 | * or add/change the PLATFORM definition on the compiler Defines option 37 | */ 38 | //#define PLATFORM SX12xxEiger 39 | 40 | #if( PLATFORM == Bleeper ) 41 | 42 | #include "board.h" 43 | 44 | /*! 45 | * Radio choice. Please uncomment the wanted radio and comment the others 46 | * or add/change wanted radio definition on the compiler Defines option 47 | */ 48 | #define USE_SX1276_RADIO 49 | 50 | /*! 51 | * Module choice. There are three existing module with the SX1276. 52 | * Please set the connected module to the value 1 and set the others to 0 53 | */ 54 | #ifdef USE_SX1276_RADIO 55 | #define MODULE_SX1276RF1IAS 0 56 | #define MODULE_SX1276RF1JAS 1 57 | #define MODULE_SX1276RF1KAS 0 58 | #endif 59 | 60 | #define USE_UART 0 61 | 62 | #else 63 | #error "Missing define: Platform (ie. SX12xxEiger)" 64 | #endif 65 | 66 | #endif // __PLATFORM_H__ 67 | -------------------------------------------------------------------------------- /Libraries/Radio/radio.h: -------------------------------------------------------------------------------- 1 |  2 | 3 | //--------------------------------------------------------------------------- 4 | /* 5 | //========================================== 6 | // Author : JC 7 | // Copyright 2016(C) AcSiP Technology Inc. 8 | // 版權所有:群登科技股份有限公司 9 | // http://www.acsip.com.tw 10 | //========================================== 11 | */ 12 | //--------------------------------------------------------------------------- 13 | 14 | 15 | /*! 16 | * \file radio.h 17 | * \brief Generic radio driver ( radio abstraction ) 18 | * 19 | * \version 2.0.B2 20 | * \date Nov 21 2012 21 | * \author Miguel Luis 22 | * 23 | * Last modified by Gregory Cristian on Apr 25 2013 24 | */ 25 | #ifndef __RADIO_H__ 26 | #define __RADIO_H__ 27 | 28 | #ifdef STM32F072 29 | #include "stm32f0xx.h" 30 | #endif 31 | 32 | #ifdef STM32F401xx 33 | #include "stm32f4xx.h" 34 | #endif 35 | 36 | /*! 37 | * SX1272 and SX1276 General parameters definition 38 | */ 39 | #define LORA (1) // [0: OFF, 1: ON] 40 | 41 | #ifdef USE_LORA_SX1276 42 | #define Target_Lora_Device "SX1276" 43 | //#define Lora_Freq915 ((uint32_t)915000000) 44 | //#define Lora_Freq868 ((uint32_t)868000000) 45 | //#define MIN_RF_Freq ((uint32_t)137000000) 46 | //#define MAX_RF_Freq ((uint32_t)1020000000) 47 | #define Lora_Freq915 (915000000) 48 | #define Lora_Freq868 (868000000) 49 | #define Lora_Freq780 (780000000) 50 | #define MIN_RF_Freq (137000000) 51 | #define MAX_RF_Freq (1020000000) 52 | #define RUN_RF_Freq (Lora_Freq915) 53 | #elif USE_LORA_SX1278 54 | #define Target_Lora_Device "SX1278" 55 | //#define Lora_Freq470 ((uint32_t)470000000) 56 | //#define Lora_Freq433 ((uint32_t)433000000) 57 | //#define MIN_RF_Freq ((uint32_t)137000000) 58 | //#define MAX_RF_Freq ((uint32_t)525000000) 59 | #define Lora_Freq470 (470000000) 60 | #define MIN_RF_Freq (137000000) 61 | #define MAX_RF_Freq (525000000) 62 | #define RUN_RF_Freq (Lora_Freq470) 63 | #endif 64 | 65 | #define Lora_RFFrequency (RUN_RF_Freq) 66 | //#define Lora_RFFrequency (905000000) 67 | 68 | //#define LoraReceptionFailureTimes (5) // Unit:Times 69 | #define LoraReceptionFailureTimes (3) // Unit:Times 70 | 71 | #define Lora_RFHoppingPeriod (5) 72 | 73 | #define MAX_LoraOutputPower (20) 74 | #define MIN_LoraOutputPower (5) 75 | #define MAX_LoraPayloadLength (255) 76 | #define MIN_LoraPayloadLength (1) 77 | #define LoraBufferLength (256) 78 | #define Lora_TxSuccess (0x10) 79 | #define Lora_TxFailed (0x11) 80 | 81 | #define LoraPV_DefaultTxLength (9) 82 | #define LoraPV_DefaultTxString ("AcsipWin") 83 | 84 | /*! 85 | * RF process function return codes 86 | */ 87 | typedef enum 88 | { 89 | RF_IDLE, 90 | RF_BUSY, 91 | RF_RX_DONE, 92 | RF_RX_TIMEOUT, 93 | RF_TX_DONE, 94 | RF_TX_TIMEOUT, 95 | RF_LEN_ERROR, 96 | RF_CHANNEL_EMPTY, 97 | RF_CHANNEL_ACTIVITY_DETECTED, 98 | } tRFProcessReturnCodes; 99 | 100 | /*! 101 | * Radio driver structure defining the different function pointers 102 | */ 103 | typedef struct sRadioDriver 104 | { 105 | void ( *Init )( void ); 106 | void ( *Reset )( void ); 107 | void ( *StartRx )( void ); 108 | void ( *GetRxPacket )( void *buffer, uint16_t *size ); 109 | void ( *SetTxPacket )( const void *buffer, uint16_t size ); 110 | // 20170123 add by JC 111 | void ( *StartCAD )( void ); 112 | // 20170123 add finish by JC 113 | uint32_t ( *Process )( void ); 114 | } tRadioDriver; 115 | 116 | /*! 117 | * \brief Initializes the RadioDriver structure with specific radio 118 | * functions. 119 | * 120 | * \retval radioDriver Pointer to the radio driver variable 121 | */ 122 | tRadioDriver* RadioDriverInit( void ); 123 | 124 | #endif // __RADIO_H__ 125 | -------------------------------------------------------------------------------- /Libraries/STM32F0xx_CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F0xx_CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /Libraries/STM32F0xx_CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f0xx.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 05-December-2014 7 | * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f0xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F0XX_H 40 | #define __SYSTEM_STM32F0XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F0xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F0xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @addtogroup STM32F0xx_System_Exported_Constants 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @addtogroup STM32F0xx_System_Exported_Macros 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @addtogroup STM32F0xx_System_Exported_Functions 82 | * @{ 83 | */ 84 | 85 | extern void SystemInit(void); 86 | extern void SystemCoreClockUpdate(void); 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /*__SYSTEM_STM32F0XX_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /Libraries/STM32F0xx_CMSIS/Include/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2013 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 17. January 2013 5 | * $Revision: V1.4.1 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len16 = { 50 | 16, twiddleCoef_16, armBitRevIndexTable16, ARMBITREVINDEXTABLE__16_TABLE_LENGTH 51 | }; 52 | 53 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len32 = { 54 | 32, twiddleCoef_32, armBitRevIndexTable32, ARMBITREVINDEXTABLE__32_TABLE_LENGTH 55 | }; 56 | 57 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len64 = { 58 | 64, twiddleCoef_64, armBitRevIndexTable64, ARMBITREVINDEXTABLE__64_TABLE_LENGTH 59 | }; 60 | 61 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len128 = { 62 | 128, twiddleCoef_128, armBitRevIndexTable128, ARMBITREVINDEXTABLE_128_TABLE_LENGTH 63 | }; 64 | 65 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len256 = { 66 | 256, twiddleCoef_256, armBitRevIndexTable256, ARMBITREVINDEXTABLE_256_TABLE_LENGTH 67 | }; 68 | 69 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len512 = { 70 | 512, twiddleCoef_512, armBitRevIndexTable512, ARMBITREVINDEXTABLE_512_TABLE_LENGTH 71 | }; 72 | 73 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024 = { 74 | 1024, twiddleCoef_1024, armBitRevIndexTable1024, ARMBITREVINDEXTABLE1024_TABLE_LENGTH 75 | }; 76 | 77 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048 = { 78 | 2048, twiddleCoef_2048, armBitRevIndexTable2048, ARMBITREVINDEXTABLE2048_TABLE_LENGTH 79 | }; 80 | 81 | const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096 = { 82 | 4096, twiddleCoef_4096, armBitRevIndexTable4096, ARMBITREVINDEXTABLE4096_TABLE_LENGTH 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /Libraries/STM32F0xx_CMSIS/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2013 ARM Limited. All rights reserved. 3 | * 4 | * Date: 18 March 2013 5 | * Revision: V3.20 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | SVD - CMSIS SVD Schema files and Conversion Utility. 38 | -------------------------------------------------------------------------------- /Libraries/STM32F0xx_StdPeriph_Driver/MCD-ST Liberty SW License Agreement V2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F0xx_StdPeriph_Driver/MCD-ST Liberty SW License Agreement V2.pdf -------------------------------------------------------------------------------- /Libraries/STM32F0xx_StdPeriph_Driver/Release_Notes.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F0xx_StdPeriph_Driver/Release_Notes.html -------------------------------------------------------------------------------- /Libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 05-December-2014 7 | * @brief This file contains all the functions prototypes for the WWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2014 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F0XX_WWDG_H 31 | #define __STM32F0XX_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f0xx.h" 39 | 40 | /** @addtogroup STM32F0xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | /* Exported types ------------------------------------------------------------*/ 48 | /* Exported constants --------------------------------------------------------*/ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /* Exported macro ------------------------------------------------------------*/ 78 | /* Exported functions ------------------------------------------------------- */ 79 | /* Function used to set the WWDG configuration to the default reset state ****/ 80 | void WWDG_DeInit(void); 81 | 82 | /* Prescaler, Refresh window and Counter configuration functions **************/ 83 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 84 | void WWDG_SetWindowValue(uint8_t WindowValue); 85 | void WWDG_EnableIT(void); 86 | void WWDG_SetCounter(uint8_t Counter); 87 | 88 | /* WWDG activation functions **************************************************/ 89 | void WWDG_Enable(uint8_t Counter); 90 | 91 | /* Interrupts and flags management functions **********************************/ 92 | FlagStatus WWDG_GetFlagStatus(void); 93 | void WWDG_ClearFlag(void); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif /* __STM32F0XX_WWDG_H */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/MCD-ST Liberty SW License Agreement V2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F401_USB/MCD-ST Liberty SW License Agreement V2.pdf -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usb_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_BSP__H__ 30 | #define __USB_BSP__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | #include "usb_conf.h" 35 | 36 | /** @addtogroup USB_OTG_DRIVER 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_BSP 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USB_BSP_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USB_BSP_Exported_Types 55 | * @{ 56 | */ 57 | /** 58 | * @} 59 | */ 60 | 61 | 62 | /** @defgroup USB_BSP_Exported_Macros 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USB_BSP_Exported_Variables 70 | * @{ 71 | */ 72 | 73 | extern USB_OTG_CORE_HANDLE USB_OTG_dev; 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 80 | * @{ 81 | */ 82 | //void BSP_Init(void); 83 | 84 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 85 | void USB_OTG_BSP_uDelay (const uint32_t usec); 86 | void USB_OTG_BSP_mDelay (const uint32_t msec); 87 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 88 | #ifdef USE_HOST_MODE 89 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 90 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 91 | #endif 92 | /** 93 | * @} 94 | */ 95 | 96 | #endif //__USB_BSP__H__ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | 107 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usb_dcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USB_DCD_INT_H__ 30 | #define USB_DCD_INT_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_dcd.h" 34 | 35 | 36 | 37 | /** @addtogroup USB_OTG_DRIVER 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USB_DCD_INT 42 | * @brief This file is the 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USB_DCD_INT_Exported_Defines 48 | * @{ 49 | */ 50 | 51 | typedef struct _USBD_DCD_INT 52 | { 53 | uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 54 | uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 55 | uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev); 56 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 57 | uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev); 58 | uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev); 59 | uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); 60 | uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); 61 | uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); 62 | 63 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 64 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 65 | 66 | }USBD_DCD_INT_cb_TypeDef; 67 | 68 | extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; 69 | /** 70 | * @} 71 | */ 72 | 73 | 74 | /** @defgroup USB_DCD_INT_Exported_Types 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USB_DCD_INT_Exported_Macros 82 | * @{ 83 | */ 84 | 85 | #define CLEAR_IN_EP_INTR(epnum,intr) \ 86 | diepint.d32=0; \ 87 | diepint.b.intr = 1; \ 88 | USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32); 89 | 90 | #define CLEAR_OUT_EP_INTR(epnum,intr) \ 91 | doepint.d32=0; \ 92 | doepint.b.intr = 1; \ 93 | USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup USB_DCD_INT_Exported_Variables 100 | * @{ 101 | */ 102 | /** 103 | * @} 104 | */ 105 | 106 | /** @defgroup USB_DCD_INT_Exported_FunctionsPrototype 107 | * @{ 108 | */ 109 | 110 | uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | 117 | #endif // USB_DCD_INT_H__ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 127 | 128 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usb_otg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief OTG Core Header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_OTG__ 30 | #define __USB_OTG__ 31 | 32 | 33 | /** @addtogroup USB_OTG_DRIVER 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USB_OTG 38 | * @brief This file is the 39 | * @{ 40 | */ 41 | 42 | 43 | /** @defgroup USB_OTG_Exported_Defines 44 | * @{ 45 | */ 46 | 47 | 48 | void USB_OTG_InitiateSRP(void); 49 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode); 50 | void USB_OTG_Switchback (USB_OTG_CORE_DEVICE *pdev); 51 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_DEVICE *pdev); 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | /** @defgroup USB_OTG_Exported_Types 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USB_OTG_Exported_Macros 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USB_OTG_Exported_Variables 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USB_OTG_Exported_FunctionsPrototype 81 | * @{ 82 | */ 83 | /** 84 | * @} 85 | */ 86 | 87 | 88 | #endif //__USB_OTG__ 89 | 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | 100 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 11-September-2013 7 | * @brief USB Device configuration file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CONF__H__ 30 | #define __USBD_CONF__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | //#include "stm32f401_discovery.h" 34 | 35 | /** @defgroup USB_CONF_Exported_Defines 36 | * @{ 37 | */ 38 | 39 | 40 | #define USBD_CFG_MAX_NUM 1 41 | #define USBD_ITF_MAX_NUM 1 42 | 43 | #define USB_MAX_STR_DESC_SIZ 64 44 | 45 | 46 | 47 | #define USBD_DYNAMIC_DESCRIPTOR_CHANGE_ENABLED 48 | 49 | /** @defgroup USB_String_Descriptors 50 | * @{ 51 | */ 52 | 53 | 54 | /** @defgroup USB_HID_Class_Layer_Parameter 55 | * @{ 56 | */ 57 | //#define HID_IN_EP 0x81 58 | //#define HID_OUT_EP 0x01 59 | 60 | //#define HID_IN_PACKET 4 61 | //#define HID_OUT_PACKET 4 62 | 63 | /** 64 | * @} 65 | */ 66 | /** @defgroup USB_CONF_Exported_Types 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | 74 | /** @defgroup USB_CONF_Exported_Macros 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USB_CONF_Exported_Variables 82 | * @{ 83 | */ 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USB_CONF_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | /** 92 | * @} 93 | */ 94 | 95 | 96 | #endif //__USBD_CONF__H__ 97 | 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | 100 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbd_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CORE_H 30 | #define __USBD_CORE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_dcd.h" 34 | #include "usbd_def.h" 35 | #include "usbd_conf.h" 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_CORE 42 | * @brief This file is the Header file for usbd_core.c file 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USBD_CORE_Exported_Defines 48 | * @{ 49 | */ 50 | 51 | typedef enum { 52 | USBD_OK = 0, 53 | USBD_BUSY, 54 | USBD_FAIL, 55 | }USBD_Status; 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | 72 | /** @defgroup USBD_CORE_Exported_Macros 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_CORE_Exported_Variables 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev, 92 | USB_OTG_CORE_ID_TypeDef coreID, 93 | USBD_DEVICE *pDevice, 94 | USBD_Class_cb_TypeDef *class_cb, 95 | USBD_Usr_cb_TypeDef *usr_cb); 96 | 97 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); 98 | 99 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 100 | 101 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | #endif /* __USBD_CORE_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_ioreq.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USBD_IOREQ_H_ 31 | #define __USBD_IOREQ_H_ 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | #include "usbd_core.h" 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_IOREQ 42 | * @brief header file for the usbd_ioreq.c file 43 | * @{ 44 | */ 45 | 46 | /** @defgroup USBD_IOREQ_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USBD_IOREQ_Exported_Types 55 | * @{ 56 | */ 57 | 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | 65 | /** @defgroup USBD_IOREQ_Exported_Macros 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_IOREQ_Exported_Variables 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 82 | * @{ 83 | */ 84 | 85 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, 86 | uint8_t *buf, 87 | uint16_t len); 88 | 89 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, 90 | uint8_t *pbuf, 91 | uint16_t len); 92 | 93 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev, 94 | uint8_t *pbuf, 95 | uint16_t len); 96 | 97 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev, 98 | uint8_t *pbuf, 99 | uint16_t len); 100 | 101 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev); 102 | 103 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev); 104 | 105 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , 106 | uint8_t epnum); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | #endif /* __USBD_IOREQ_H_ */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usbd_req.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief header file for the usbd_req.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USB_REQUEST_H_ 31 | #define __USB_REQUEST_H_ 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | #include "usbd_core.h" 36 | #include "usbd_conf.h" 37 | 38 | 39 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBD_REQ 44 | * @brief header file for the usbd_ioreq.c file 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBD_REQ_Exported_Defines 49 | * @{ 50 | */ 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USBD_REQ_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | 65 | /** @defgroup USBD_REQ_Exported_Macros 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup USBD_REQ_Exported_Variables 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 80 | * @{ 81 | */ 82 | 83 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 84 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 85 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 86 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev, 87 | USB_SETUP_REQ *req); 88 | 89 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev, 90 | USB_SETUP_REQ *req); 91 | 92 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* __USB_REQUEST_H_ */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | 108 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 109 | -------------------------------------------------------------------------------- /Libraries/STM32F401_USB/usbd_usr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief Header file for usbd_usr.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_USR_H__ 30 | #define __USBD_USR_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbd_core.h" 34 | 35 | 36 | /** @addtogroup USBD_USER 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBD_USR 45 | * @brief This file is the Header file for usbd_usr.c 46 | * @{ 47 | */ 48 | 49 | 50 | /** @defgroup USBD_USR_Exported_Types 51 | * @{ 52 | */ 53 | 54 | extern USBD_Usr_cb_TypeDef USR_cb; 55 | extern USBD_Usr_cb_TypeDef USR_FS_cb; 56 | extern USBD_Usr_cb_TypeDef USR_HS_cb; 57 | 58 | 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | 66 | /** @defgroup USBD_USR_Exported_Defines 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USBD_USR_Exported_Macros 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBD_USR_Exported_Variables 82 | * @{ 83 | */ 84 | 85 | void USBD_USR_Init(void); 86 | void USBD_USR_DeviceReset (uint8_t speed); 87 | void USBD_USR_DeviceConfigured (void); 88 | void USBD_USR_DeviceSuspended(void); 89 | void USBD_USR_DeviceResumed(void); 90 | 91 | void USBD_USR_DeviceConnected(void); 92 | void USBD_USR_DeviceDisconnected(void); 93 | 94 | void USBD_USR_FS_Init(void); 95 | void USBD_USR_FS_DeviceReset (uint8_t speed); 96 | void USBD_USR_FS_DeviceConfigured (void); 97 | void USBD_USR_FS_DeviceSuspended(void); 98 | void USBD_USR_FS_DeviceResumed(void); 99 | 100 | void USBD_USR_FS_DeviceConnected(void); 101 | void USBD_USR_FS_DeviceDisconnected(void); 102 | 103 | void USBD_USR_HS_Init(void); 104 | void USBD_USR_HS_DeviceReset (uint8_t speed); 105 | void USBD_USR_HS_DeviceConfigured (void); 106 | void USBD_USR_HS_DeviceSuspended(void); 107 | void USBD_USR_HS_DeviceResumed(void); 108 | 109 | void USBD_USR_HS_DeviceConnected(void); 110 | void USBD_USR_HS_DeviceDisconnected(void); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** @defgroup USBD_USR_Exported_FunctionsPrototype 117 | * @{ 118 | */ 119 | /** 120 | * @} 121 | */ 122 | 123 | #endif /*__USBD_USR_H__*/ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F4xx_CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf -------------------------------------------------------------------------------- /Libraries/STM32F4xx_CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F4xx_CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /Libraries/STM32F4xx_CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.6.1 6 | * @date 21-October-2015 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_CMSIS/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2014 ARM Limited. All rights reserved. 3 | * 4 | * Date: 17 February 2014 5 | * Revision: V4.00 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS_END_USER_LICENCE_AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | Driver - CMSIS Peripheral Driver Interface. 38 | 39 | Pack - CMSIS Software Packs. 40 | Mechanism to install software, device support, APIs, and example projects. 41 | 42 | SVD - CMSIS SVD Schema files and Conversion Utility. 43 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_StdPeriph_Driver/MCD-ST Liberty SW License Agreement V2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F4xx_StdPeriph_Driver/MCD-ST Liberty SW License Agreement V2.pdf -------------------------------------------------------------------------------- /Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.6.1 6 | * @date 21-October-2015 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2015 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_CRC_H 31 | #define __STM32F4xx_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup CRC_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | 62 | void CRC_ResetDR(void); 63 | uint32_t CRC_CalcCRC(uint32_t Data); 64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 65 | uint32_t CRC_GetCRC(void); 66 | void CRC_SetIDRegister(uint8_t IDValue); 67 | uint8_t CRC_GetIDRegister(void); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* __STM32F4xx_CRC_H */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @version V1.6.1 6 | * @date 21-October-2015 7 | * @brief Header file of FLASH RAMFUNC driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H 31 | #define __STM32F4xx_FLASH_RAMFUNC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup FLASH RAMFUNC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Private define ------------------------------------------------------------*/ 50 | /** 51 | * @brief __RAM_FUNC definition 52 | */ 53 | #if defined ( __CC_ARM ) 54 | /* ARM Compiler 55 | ------------ 56 | RAM functions are defined using the toolchain options. 57 | Functions that are executed in RAM should reside in a separate source module. 58 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 59 | area of a module to a memory space in physical RAM. 60 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 61 | dialog. 62 | */ 63 | #define __RAM_FUNC void 64 | 65 | #elif defined ( __ICCARM__ ) 66 | /* ICCARM Compiler 67 | --------------- 68 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 69 | */ 70 | #define __RAM_FUNC __ramfunc void 71 | 72 | #elif defined ( __GNUC__ ) 73 | /* GNU Compiler 74 | ------------ 75 | RAM functions are defined using a specific toolchain attribute 76 | "__attribute__((section(".RamFunc")))". 77 | */ 78 | #define __RAM_FUNC void __attribute__((section(".RamFunc"))) 79 | 80 | #endif 81 | /* Exported constants --------------------------------------------------------*/ 82 | /* Exported macro ------------------------------------------------------------*/ 83 | /* Exported functions --------------------------------------------------------*/ 84 | __RAM_FUNC FLASH_FlashInterfaceCmd(FunctionalState NewState); 85 | __RAM_FUNC FLASH_FlashSleepModeCmd(FunctionalState NewState); 86 | 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | 104 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.6.1 6 | * @date 21-October-2015 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2015 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_WWDG_H 31 | #define __STM32F4xx_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup WWDG_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** @defgroup WWDG_Prescaler 56 | * @{ 57 | */ 58 | 59 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 60 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 61 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 62 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 63 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 64 | ((PRESCALER) == WWDG_Prescaler_2) || \ 65 | ((PRESCALER) == WWDG_Prescaler_4) || \ 66 | ((PRESCALER) == WWDG_Prescaler_8)) 67 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 68 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /* Exported macro ------------------------------------------------------------*/ 79 | /* Exported functions --------------------------------------------------------*/ 80 | 81 | /* Function used to set the WWDG configuration to the default reset state ****/ 82 | void WWDG_DeInit(void); 83 | 84 | /* Prescaler, Refresh window and Counter configuration functions **************/ 85 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 86 | void WWDG_SetWindowValue(uint8_t WindowValue); 87 | void WWDG_EnableIT(void); 88 | void WWDG_SetCounter(uint8_t Counter); 89 | 90 | /* WWDG activation function ***************************************************/ 91 | void WWDG_Enable(uint8_t Counter); 92 | 93 | /* Interrupts and flags management functions **********************************/ 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F4xx_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 112 | -------------------------------------------------------------------------------- /Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_qspi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_qspi.c -------------------------------------------------------------------------------- /Libraries/Word_Queue.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Includes ------------------------------------------------------------------*/ 15 | #include 16 | #include "Word_Queue.h" 17 | 18 | /* Private typedef -----------------------------------------------------------*/ 19 | /* Private define ------------------------------------------------------------*/ 20 | /* Private macro -------------------------------------------------------------*/ 21 | /* Private variables ---------------------------------------------------------*/ 22 | /* Private function prototypes -----------------------------------------------*/ 23 | /* Private functions ---------------------------------------------------------*/ 24 | 25 | bool Init_Word_Queue( Word_Queue_Struct *queue, uint16_t buf_items ) 26 | { 27 | if( ! queue || ! buf_items ) return( false ); 28 | if( queue->Buffer ) return( false ); 29 | 30 | queue->Buffer_Size = 0; 31 | queue->Buffer = malloc( buf_items * sizeof( uint16_t ) ); 32 | if( ! queue->Buffer ) return( false ); 33 | 34 | queue->Buffer_Size = buf_items; 35 | return( true ); 36 | } 37 | 38 | void Clear_Word_Queue( Word_Queue_Struct *queue ) 39 | { 40 | queue->Buffer[ 0 ] = 0x00; 41 | queue->Head = queue->Tail; 42 | } 43 | 44 | bool Is_Word_Queue_Empty( Word_Queue_Struct *queue ) 45 | { 46 | return( queue->Head == queue->Tail ); 47 | } 48 | 49 | bool Is_Word_Queue_Full( Word_Queue_Struct *queue ) 50 | { 51 | uint16_t t; 52 | 53 | t = queue->Head + 1; 54 | t %= queue->Buffer_Size; 55 | return( t == queue->Tail ); 56 | } 57 | 58 | bool Get_Word_from_Queue( Word_Queue_Struct *queue ) 59 | { 60 | if( queue->Tail == queue->Head ) return( false ); 61 | 62 | queue->Output = queue->Buffer[ queue->Tail ]; 63 | queue->Tail++; 64 | queue->Tail %= queue->Buffer_Size; 65 | 66 | return( true ); 67 | } 68 | 69 | bool Peek_Word_from_Queue( Word_Queue_Struct *queue ) 70 | { 71 | if( queue->Tail == queue->Head ) return( false ); 72 | 73 | queue->Output = queue->Buffer[ queue->Tail ]; 74 | return( true ); 75 | } 76 | 77 | bool Put_Word_into_Queue( Word_Queue_Struct *queue, uint16_t d ) 78 | { 79 | if( Is_Word_Queue_Full( queue ) ) return( false ); 80 | 81 | queue->Buffer[ queue->Head ] = d; 82 | queue->Head++; 83 | queue->Head %= queue->Buffer_Size; 84 | 85 | return( true ); 86 | } 87 | 88 | uint16_t Get_Data_Size_of_Word_Queue( Word_Queue_Struct *queue ) 89 | { 90 | uint16_t t; 91 | 92 | if( queue->Head >= queue->Tail ) { 93 | t = queue->Head - queue->Tail; 94 | } else { 95 | t = queue->Buffer_Size - queue->Tail; 96 | t += queue->Head; 97 | } 98 | return( t ); 99 | } 100 | 101 | uint16_t Get_Available_Size_of_Word_Queue( Word_Queue_Struct *queue ) 102 | { 103 | uint16_t t; 104 | 105 | t = Get_Data_Size_of_Word_Queue( queue ); 106 | return( queue->Buffer_Size - t - 1 ); 107 | } 108 | 109 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /Libraries/Word_Queue.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef LIBRARIES_WORD_QUEUE_H_ 15 | #define LIBRARIES_WORD_QUEUE_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | 21 | /* Exported define -----------------------------------------------------------*/ 22 | /* Exported types ------------------------------------------------------------*/ 23 | typedef struct _Word_Queue_Struct_ { 24 | uint16_t Output; 25 | uint16_t *Buffer; 26 | uint16_t Buffer_Size; 27 | uint16_t Head; // Head == Tail means there is no data 28 | uint16_t Tail; // Head+1 == Tail means the queue is full 29 | } Word_Queue_Struct; 30 | 31 | /* Exported constants --------------------------------------------------------*/ 32 | /* Exported macro ------------------------------------------------------------*/ 33 | /* Exported variables --------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | bool Init_Word_Queue( Word_Queue_Struct *queue, uint16_t buf_items ); 36 | void Clear_Word_Queue( Word_Queue_Struct *queue ); 37 | bool Is_Word_Queue_Empty( Word_Queue_Struct *queue ); 38 | bool Is_Word_Queue_Full( Word_Queue_Struct *queue ); 39 | bool Get_Word_from_Queue( Word_Queue_Struct *queue ); 40 | bool Peek_Word_from_Queue( Word_Queue_Struct *queue ); 41 | bool Put_Word_into_Queue( Word_Queue_Struct *queue, uint16_t d ); 42 | uint16_t Get_Data_Size_of_Word_Queue( Word_Queue_Struct *queue ); 43 | uint16_t Get_Available_Size_of_Word_Queue( Word_Queue_Struct *queue ); 44 | 45 | #endif // LIBRARIES_WORD_QUEUE_H_ 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /Libraries/libshell/doc/README: -------------------------------------------------------------------------------- 1 | libemb/libshell 2 | (c) 2011-2012 Stefan Wendler 3 | sw@kaltpost.de 4 | http://gpio.kaltpost.de/ 5 | 6 | 7 | Shell building C-library for ARM-Cortex-M3 based STM32 MCUs and MSP430G2553 MCUs 8 | ================================================================================ 9 | 10 | 11 | Introduction 12 | ------------ 13 | 14 | "libshell" is part of "libemb". It provides the environment needed to build interactive (remote-) shells. It helps with defining commands and callback handlers as well as with the command and argument parsing. The library is not HW dependend and it has no dependencies to other "libemb" libraries. 15 | 16 | For detailed building instructions see the top-level README of "libemb" 17 | 18 | 19 | Usage 20 | ----- 21 | 22 | For usage examples etc. visit the project homepage at: http://gpio.kaltpost.de/ 23 | 24 | -------------------------------------------------------------------------------- /Libraries/libshell/shell.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libemb project. 3 | * 4 | * Copyright (C) 2011 Stefan Wendler 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "shell.h" 21 | 22 | int shell_str_len( const char *str ) 23 | { 24 | int i = 0; 25 | 26 | while( str[i++] ) { 27 | } 28 | return i - 1; 29 | } 30 | 31 | int shell_str_cmp( const char *str1, const char *str2, int len1, int len2 ) 32 | { 33 | int i; 34 | 35 | if( len1 > len2 ) return 1; 36 | 37 | for( i = 0 ; i < len1 ; i++ ) { 38 | if( str1[i] != str2[i] ) return 2; 39 | } 40 | 41 | // make sure we matched a whole command, and not only a containing substring ... 42 | if( len2 > len1 && str2[i] != ' ' ) return 2; 43 | 44 | return 0; 45 | } 46 | 47 | int shell_parse_int( const char *str ) 48 | { 49 | int val = 0; 50 | int i = 0; 51 | char c; 52 | 53 | while( (c = str[i++]) != 0 ) { 54 | if(c < '0' || c > '9') break; 55 | val = val * 10 + (c - '0'); 56 | } 57 | 58 | return val; 59 | } 60 | 61 | int shell_arg_parser( const char *cmd_line, int len, shell_cmd_args *args ) 62 | { 63 | int i; 64 | int j; 65 | int spos = 0; 66 | int argc = 0; 67 | 68 | for( i = 0; i < len; i++ ) { 69 | // to many arguments 70 | if(argc > SHELL_MAX_ARGS) return 1; 71 | 72 | if( cmd_line[i] == ' ' || i == len - 1 ) { 73 | // catch last argument ... 74 | if( i == len - 1 ) i++; 75 | 76 | // ignore first since it is the cmd itself 77 | if( spos == 0 ) { 78 | spos = i; 79 | } else { 80 | // argument value to long 81 | if(i - spos > SHELL_MAX_ARG_LEN) return 2; 82 | 83 | for( j = 0; j < i - spos - 1; j++ ) { 84 | args->args[argc].val[j] = cmd_line[spos + 1 + j]; 85 | } 86 | args->args[argc++].val[j] = 0; 87 | spos = i; 88 | } 89 | } 90 | } 91 | 92 | args->count = argc; 93 | return 0; 94 | } 95 | 96 | 97 | int shell_process_cmds( const shell_cmd *cmd, unsigned char cmds, const char *cmd_line ) 98 | { 99 | int i; 100 | int ret; 101 | int cmd_len; 102 | int cmd_line_len; 103 | shell_cmd_args args; 104 | 105 | for( i = 0; i < cmds; i++ ) { 106 | cmd_line_len = shell_str_len( cmd_line ); 107 | cmd_len = shell_str_len( cmd[i].cmd ); 108 | 109 | if( shell_str_cmp( cmd[i].cmd, cmd_line, cmd_len, cmd_line_len ) == 0 ) { 110 | ret = shell_arg_parser( cmd_line, cmd_line_len, &args ); 111 | 112 | if( ret == 1 ) return SHELL_PROCESS_ERR_ARGS_MAX; 113 | if( ret == 2 ) return SHELL_PROCESS_ERR_ARGS_LEN; 114 | 115 | return ( cmd[i].func( & args ) ); 116 | } 117 | } 118 | return SHELL_PROCESS_ERR_CMD_UNKN; 119 | } 120 | -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1276-071H__Protocol.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1276-071H__Protocol.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1276-071H__Radio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1276-071H__Radio.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1276-401H__Protocol.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1276-401H__Protocol.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1276-401H__Radio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1276-401H__Radio.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1278-071H__Protocol.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1278-071H__Protocol.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1278-071H__Radio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1278-071H__Radio.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1278-401H__Protocol.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1278-401H__Protocol.lib -------------------------------------------------------------------------------- /MDK/AcSiP_Libries/AI1278-401H__Radio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/MDK/AcSiP_Libries/AI1278-401H__Radio.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AI127x_SDK 2 | Software development kit with Private LoRa protocol for AI127x module 3 | ![Module Picture](https://github.com/AcSiP/AI127x_SDK/blob/master/Readme/AI1276-401H.jpg) 4 | 5 | 6 | ## SDK Download ## 7 | Use this repository: https://github.com/AcSiP/AI127x_SDK.git 8 | 9 | 10 | ## Default Console ## 11 | + Console port: USART2 12 | + Baud Rate: 38400 13 | + Data bits: 8 14 | + Parity Check: None 15 | + Stop bits: 1 16 | 17 | 18 | ## Software Development Guide ## 19 | [Product Breif](http://www.acsip.com.tw/index.php?action=download&perm=d&id=29) 20 | 21 | + Main Process 22 | ![Main Process Flow](https://github.com/AcSiP/AI127x_SDK/blob/master/Readme/Main_Process_Flow.png) 23 | 24 | + Noramal Master Process 25 | ![Noramal Process on MASTER](https://github.com/AcSiP/AI127x_SDK/blob/master/Readme/OnMaster_for_Normal_Process.png) 26 | 27 | + Noramal Slave Process 28 | ![Noramal Process on SLAVE](https://github.com/AcSiP/AI127x_SDK/blob/master/Readme/OnSlave_for_Noraml__Process.png) 29 | 30 | 31 | ## Software Tools / Utilities ## 32 | [Keil](https://www.keil.com/demo/eval/arm.htm) 33 | 34 | [MDK for STM32L0 and STM32F0 Installation & Activation](http://www2.keil.com/stmicroelectronics-stm32/mdk) 35 | Product Serial Number (PSN) = U1E21-CM9GY-L3G4L 36 | 37 | [Tera Term](https://osdn.net/projects/ttssh2/) 38 | 39 | [ST-LINK/V2](https://my.st.com/content/my_st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/st-link-v2.html) 40 | 41 | [DfuSe -- USB device firmware upgrade](https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-stm32080.html) 42 | 43 | 44 | ## Reference ## 45 | + SX127x driver from Semtech 46 | http://www.semtech.com/apps/filedown/down.php?file=sx12xxDrivers-V2.1.0.zip 47 | 48 | + LoRaWAN software expansion for STM32Cube 49 | http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/i-cube-lrwan.html 50 | 51 | -------------------------------------------------------------------------------- /Readme/AI1276-401H.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/AI1276-401H.jpg -------------------------------------------------------------------------------- /Readme/CLI__Command_List__Consol_Terminal.md: -------------------------------------------------------------------------------- 1 |

4. Terminal Echo Control

2 | 3 |
4 | 5 | - UartEchoOn 6 | 7 | 8 | 9 | 10 |
Parameter(s) N/A
Description Echo UART received data. It is useful for manual control by console.
Example UartEchoOn
11 |
12 | 13 | 14 | - UartEchoOff 15 | 16 | 17 | 18 | 21 | 22 | 23 |
Parameter(s) N/A
Description Turn off UART echo.
19 | This is default setting to avoid mix messages while console output. 20 |
Example UartEchoOff
24 | 25 |
26 |
27 | 28 | [Back to Index](CLI__Command_List__Index.md) 29 | -------------------------------------------------------------------------------- /Readme/CLI__Command_List__Format.md: -------------------------------------------------------------------------------- 1 |

1. Command / Respose Format

2 | 3 | - Command 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
Command (ASCII String) Parameter (ASCII String) End Of Line
N Bytes 0 ~ N Bytes 0x0D (CR)
Ex.
LoraPower 17
UartEchoOn
12 |
13 | 14 | - Response for Command syntax error or Execute result 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Response (ASCII String) End Of Line
Ex.
UNKNOW (CR)(LF)
OK (CR)(LF)
ERROR (CR)(LF)
22 |
23 | 24 | - Response for Query Result 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
Response Item 1(space) Response Item 2 ……. (space) Response Item N (ASCII String) End Of Line
Ex.
TxPacketTimeout=2183 (CR)(LF)
RFFrequency=915000000 BW=6 SF=12 ErrorCoding=1 (CR)(LF)
34 |
35 | 36 |
37 |
38 | 39 | [Back to Index](CLI__Command_List__Index.md) 40 | -------------------------------------------------------------------------------- /Readme/CLI__Command_List__Index.md: -------------------------------------------------------------------------------- 1 | # Command List 2 | This page lists and describes available commands.

3 | 4 | 5 | 1. [Command / Respose Format](CLI__Command_List__Format.md) 6 | 2. [Predefined Modulation](CLI__Command_List__PreDefined_MCS.md) 7 | 3. [Miscellaneous](CLI__Command_List__Miscellaneous.md) 8 | 4. [Terminal Echo Control](CLI__Command_List__Consol_Terminal.md) 9 | 5. [RF Parameters](CLI__Command_List__RF_Parameters.md) 10 | 6. [Payload Control](CLI__Command_List__Payload.md) 11 | 7. [Received Signal Quality](CLI__Command_List__RX_Signal.md) 12 | 8. [Polling Mode Group Management](CLI__Command_List__Polling_Mode_Group.md) 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Readme/CLI__Command_List__Payload.md: -------------------------------------------------------------------------------- 1 |

6. Payload Control

2 | 3 |
4 | 5 | 6 | - LoraPayloadLength 7 | 8 | 9 | 10 | 14 | 15 | 16 |
Parameter(s) Payload length for transmission in byte.
Description 11 | Configure LoRa packet payload length in byte.
12 | It must be within 1 to 255. 13 |
Example LoraPayloadLength 40
17 |
18 | 19 | - LoraGetPayloadLength 20 | 21 | 22 | 23 | 24 | 30 | 31 |
Parameter(s) N/A
Description Report the payload length of LoRa last transmit / received packet in byte.
Example 25 | Command:
26 |     LoraGetPayloadLength
27 | Response:
28 |     PayloadLength=59 29 |
32 |
33 | 34 | 35 | - LoraMaxPayloadLength 36 | 37 | 38 | 39 | 43 | 44 | 45 |
Parameter(s) Maximum payload length for receive in byte.
Description 40 | Configure maximum receive payload length in byte for LoRa packet.
41 | It must be within 1 to 255. 42 |
Example LoraMaxPayloadLength 255
46 |
47 | 48 | - LoraGetRxPacketTimeout 49 | 50 | 51 | 52 | 56 | 57 | 58 | 64 | 65 |
Parameter(s) N/A
Description 53 | Report current timeout interval for receive in mS.
54 | It would be re-calculated and affected by maximum payload length. 55 |
Example 59 | Command:
60 |     LoraGetRxPacketTimeout
61 | Response:
62 |     RxPacketTimeout=2183 63 |
66 |
67 | 68 | 69 | 70 | - LoraGetPara 71 | 72 | 73 | 74 | 77 | 78 | 79 | 85 | 86 |
Parameter(s) N/A
Description 75 | Report complete RF and Payload parameters. 76 |
Example 80 | Command:
81 |     LoraGetPara
82 | Response:
83 |     RFFrequency=915000000 BW=7 SF=10 ErrorCoding=1 RFPower=20 FreqHopOn=false HeaderStatus=Explicit CRC=ON PreambleLength=12 PayloadLength=255 MaxPayloadLength=255 TxPacketTimeout=3221 RxPacketTimeout=3221 84 |
87 | 88 |
89 |
90 | 91 | [Back to Index](CLI__Command_List__Index.md) 92 | -------------------------------------------------------------------------------- /Readme/CLI__Command_List__PreDefined_MCS.md: -------------------------------------------------------------------------------- 1 |

2. Predefined Modulation

2 | There are several pre-defined sensitivity mode 3 | 4 |

5 | 6 | - LoraSF7BW250RS120 7 | - LoraSF7BW125RS123 8 | 9 | - LoraSF8BW500RS120 10 | - LoraSF8BW250RS123 11 | - LoraSF8BW125RS126 12 | 13 | - LoraSF9BW500RS123 14 | - LoraSF9BW250RS126 15 | - LoraSF9BW125RS129 16 | 17 | - LoraSF10BW500RS126 18 | - LoraSF10BW250RS129 19 | - LoraSF10BW125RS132 20 | 21 | - LoraSF11BW250RS132 22 | - LoraSF11BW125RS135 23 | 24 | - LoraSF12BW250RS134 25 | - LoraSF12BW125RS137 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 68 | 69 | 70 |
Parameter(s) 32 | HopOn => Enable frequency hopping
33 | HopOff => Disable frequency hopping (default)
34 |
Description 38 | Use pre-defined modulation / sensitivity mode.
39 | Error Coding Rate = 1.25
40 | Payload Header = ON (Explicit)
41 | Payload CRC = true
42 | Output Power = 20 dBm
43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
Sensitivity Spreading Factor Bandwidth(kHz)
-120 7 250
-123 7 250
-120 8 500
-123 8 250
-126 8 125
-123 9 500
-126 9 250
-129 9 125
-126 10 500
-129 10 250
-132 10 125
-132 11 250
-135 11 125
-134 12 250
-137 12 125
66 | 67 |
Example LoraSF10BW125RS132 HopOn
71 |
72 | 73 |
74 |
75 | 76 | [Back to Index](CLI__Command_List__Index.md) 77 | -------------------------------------------------------------------------------- /Readme/CLI__Command_List__RX_Signal.md: -------------------------------------------------------------------------------- 1 |

7. Received Signal Quality

2 | 3 |
4 | 5 | 6 | - LoraGetRxGain 7 | 8 | 9 | 10 | 11 | 17 | 18 |
Parameter(s) N/A
Description Report the latest received LoRa packet gain in dBm.
Example 12 | Command:
13 |     LoraGetRxGain
14 | Response:
15 |     RxGain=1 16 |
19 |
20 | 21 | 22 | - LoraGetSNR 23 | 24 | 25 | 26 | 27 | 33 | 34 |
Parameter(s) N/A
Description Report the latest received LoRa packet SNR value in dB.
Example 28 | Command:
29 |     LoraGetSNR
30 | Response:
31 |     SNR=0 32 |
35 |
36 | 37 | 38 | 39 | - LoraGetRSSI 40 | 41 | 42 | 43 | 44 | 50 | 51 |
Parameter(s) N/A
Description Report the latest received LoRa packet RSSI value in dBm.
Example 45 | Command:
46 |     LoraGetRSSI
47 | Response:
48 |     RSSI=45 49 |
52 | 53 |
54 |
55 | 56 | [Back to Index](CLI__Command_List__Index.md) 57 | -------------------------------------------------------------------------------- /Readme/Main_Process_Flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/Main_Process_Flow.png -------------------------------------------------------------------------------- /Readme/OnMaster_for_Normal_Process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/OnMaster_for_Normal_Process.png -------------------------------------------------------------------------------- /Readme/OnSlave_for_Noraml__Process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/OnSlave_for_Noraml__Process.png -------------------------------------------------------------------------------- /Readme/Readme.md: -------------------------------------------------------------------------------- 1 | - [CLI Command List](CLI__Command_List__Index.md) 2 | 3 | 4 | - [Firmware Update with Boot Loader(IAP)](UART_IAP/Readme.md) 5 |
6 | -------------------------------------------------------------------------------- /Readme/UART_IAP/IAP__F401_01.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/UART_IAP/IAP__F401_01.PNG -------------------------------------------------------------------------------- /Readme/UART_IAP/IAP__F401_02.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/UART_IAP/IAP__F401_02.PNG -------------------------------------------------------------------------------- /Readme/UART_IAP/IAP__F401_03.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/UART_IAP/IAP__F401_03.PNG -------------------------------------------------------------------------------- /Readme/UART_IAP/IAP__F401_04.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/UART_IAP/IAP__F401_04.PNG -------------------------------------------------------------------------------- /Readme/UART_IAP/Readme.md: -------------------------------------------------------------------------------- 1 | # UART IAP 2 | This page describe how to update application firmware by UART2.

3 | 4 | 0. Use TeraTerm to open the console.
5 | 6 | 1. Reset target device to lunch the boot loader.
7 | 8 | 2. Input 'P' to lunch the boot loader main menu.
9 | ![Bootloader Menu](IAP__F401_01.PNG) 10 | 11 | 3. Input '1', Let boot loader wait for receiving binary file for upgrade.
12 | 13 | 4. Use TeraTerm to send the firmware file with YModem.
14 | ![Bootloader download menu](IAP__F401_02.PNG) 15 | 16 | 5. Wait for file transmission complete.
17 | If it fails, Back to step 1 and retry again.
18 | ![download progress](IAP__F401_03.PNG) 19 | 20 | 6. Wait for firmware update complete.
21 | ![update completed](IAP__F401_04.PNG) 22 | 23 | 7. Reset target device. Let new firmware working......
24 | 25 |
26 |
27 |
28 | Refer to:
29 | [AN4567](https://my.st.com/resource/en/application_note/dm00161366.pdf "https://my.st.com/resource/en/application_note/dm00161366.pdf") 30 | -------------------------------------------------------------------------------- /Readme/ai1276-401hpcab001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Readme/ai1276-401hpcab001.jpg -------------------------------------------------------------------------------- /Test/FlashTestMain.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Test/FlashTestMain.c -------------------------------------------------------------------------------- /Test/FlashTestMain.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef __FlashTestMain_H 15 | #define __FlashTestMain_H 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "config.h" 23 | #include "cli.h" 24 | #include "sx1276-LoRaMisc.h" 25 | #include "sx1276-LoRa.h" 26 | #include "sx1276.h" 27 | #include "platform.h" 28 | #include "radio.h" 29 | #include "board.h" 30 | #include "base64.h" 31 | #include "acsip_protocol.h" 32 | #include "normalSlave.h" 33 | #include "normalMaster.h" 34 | #include "LinkListEvent.h" 35 | #include "gps.h" 36 | #include "flash.h" 37 | 38 | #ifdef STM32F072 39 | #include "stm32f0xx.h" 40 | #include "usart2.h" 41 | #include "tim14.h" 42 | #endif 43 | 44 | #ifdef STM32F401xx 45 | #include "stm32f4xx.h" 46 | #include "usart2.h" 47 | #include "tim4.h" 48 | #endif 49 | 50 | 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | typedef enum { 54 | SystemInPingPognTest, 55 | SystemInNormal, 56 | SystemInProductVerification, 57 | SystemInIdle, 58 | }tAllSystemOperationMode; 59 | 60 | /* Exported constants --------------------------------------------------------*/ 61 | /* Exported macro ------------------------------------------------------------*/ 62 | #define enableGlobalInterrupts() __set_PRIMASK(0); 63 | #define disableGlobalInterrupts() __set_PRIMASK(1); 64 | 65 | /* Exported functions ------------------------------------------------------- */ 66 | 67 | #endif /* __FlashTestMain_H */ 68 | 69 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /Test/TESTcli.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/ARM-Lora/TESTcli.h 4 | * @author JC 5 | * @version V1.0.0 6 | * @date 10-Mar-2016 7 | * @brief Command Line Interface program body 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * 12 | * 13 | ****************************************************************************** 14 | */ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __TESTcli_H 18 | #define __TESTcli_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #ifdef STM32F072 22 | #include "stm32f0xx.h" 23 | #endif 24 | 25 | #ifdef STM32F401xx 26 | #include "stm32f4xx.h" 27 | #endif 28 | 29 | #include "shell.h" 30 | 31 | /* Exported types ------------------------------------------------------------*/ 32 | /* Exported constants --------------------------------------------------------*/ 33 | /* Exported macro ------------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | int CLI_process(char *); 36 | int CLI_ShellCmd_testPrint1(shell_cmd_args *); 37 | int CLI_ShellCmd_testPrint2(shell_cmd_args *); 38 | 39 | 40 | 41 | #endif /* __TESTcli_H */ 42 | 43 | 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | 47 | 48 | -------------------------------------------------------------------------------- /Test/TESTmain.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Test/TESTmain.c -------------------------------------------------------------------------------- /Test/TESTmain.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/TESTmain.h 4 | * @author 5 | * @version 6 | * @date 7 | * @brief Header for TESTmain.c module 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * 12 | ****************************************************************************** 13 | */ 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef __TESTMAIN_H 17 | #define __TESTMAIN_H 18 | 19 | /* Includes ------------------------------------------------------------------*/ 20 | #include 21 | #include 22 | #include 23 | #include "config.h" 24 | #include "TESTcli.h" 25 | #include "sx1276-LoRaMisc.h" 26 | #include "sx1276-LoRa.h" 27 | #include "sx1276.h" 28 | #include "platform.h" 29 | #include "radio.h" 30 | #include "board.h" 31 | #include "base64.h" 32 | 33 | //#include "gpio.h" //for test 34 | 35 | #ifdef STM32F072 36 | #include "stm32f0xx.h" 37 | #include "usart1.h" 38 | #include "tim14.h" 39 | #endif 40 | 41 | #ifdef STM32F401xx 42 | #include "stm32f4xx.h" 43 | #include "usart2.h" 44 | #include "tim4.h" 45 | #endif 46 | 47 | 48 | 49 | /* Exported types ------------------------------------------------------------*/ 50 | typedef enum { 51 | SystemInPingPognTest, 52 | SystemInNormal, 53 | SystemInProductVerification, 54 | SystemInIdle, 55 | }tAllSystemOperationMode; 56 | 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #define enableGlobalInterrupts() __set_PRIMASK(0); 60 | #define disableGlobalInterrupts() __set_PRIMASK(1); 61 | 62 | /* Exported functions ------------------------------------------------------- */ 63 | 64 | #endif /* __TESTMAIN_H */ 65 | 66 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 67 | -------------------------------------------------------------------------------- /Test/UnionStructTestMain.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AcSiP/AI127x_SDK/2bfe38ba2229e6c3431eeb1df62c7631d1c4c143/Test/UnionStructTestMain.c -------------------------------------------------------------------------------- /Test/UnionStructTestMain.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/UnionStructTestMain.h 4 | * @author 5 | * @version 6 | * @date 7 | * @brief Header for UnionStructTestMain.c module 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * 12 | * 13 | ****************************************************************************** 14 | */ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __UnionStructTestMain_H 18 | #define __UnionStructTestMain_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "config.h" 26 | #include "cli.h" 27 | #include "sx1276-LoRaMisc.h" 28 | #include "sx1276-LoRa.h" 29 | #include "sx1276.h" 30 | #include "platform.h" 31 | #include "radio.h" 32 | #include "board.h" 33 | #include "base64.h" 34 | #include "acsip_protocol.h" 35 | #include "normalSlave.h" 36 | #include "normalMaster.h" 37 | #include "LinkListEvent.h" 38 | #include "gps.h" 39 | 40 | #ifdef STM32F072 41 | #include "stm32f0xx.h" 42 | #include "usart2.h" 43 | #include "tim14.h" 44 | #endif 45 | 46 | #ifdef STM32F401xx 47 | #include "stm32f4xx.h" 48 | #include "usart2.h" 49 | #include "tim4.h" 50 | #endif 51 | 52 | 53 | 54 | /* Exported types ------------------------------------------------------------*/ 55 | typedef enum { 56 | SystemInPingPognTest, 57 | SystemInNormal, 58 | SystemInProductVerification, 59 | SystemInIdle, 60 | } tAllSystemOperationMode; 61 | 62 | /* Exported constants --------------------------------------------------------*/ 63 | /* Exported macro ------------------------------------------------------------*/ 64 | #define enableGlobalInterrupts() __set_PRIMASK(0); 65 | #define disableGlobalInterrupts() __set_PRIMASK(1); 66 | 67 | /* Exported functions ------------------------------------------------------- */ 68 | 69 | #endif /* __UnionStructTestMain_H */ 70 | 71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 72 | -------------------------------------------------------------------------------- /USER/Console_Timer.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/tim4.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 10-Mar-2016 19 | * @brief Header for tim4.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_CONSOLE_TIMER_H_ 30 | #define USER_CONSOLE_TIMER_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported define -----------------------------------------------------------*/ 37 | /* Exported variables --------------------------------------------------------*/ 38 | extern __IO FunctionalState Console_Timer_Status; 39 | 40 | /* Exported functions ------------------------------------------------------- */ 41 | void CmdTIMER_TimerConfig( void ); 42 | void CmdTIMER_TimerRunOrStop(FunctionalState); 43 | void CmdTIMER_ClearDelayCounter(void); 44 | void CmdTIMER_IRQHandler(void); 45 | 46 | #endif // USER_CONSOLE_TIMER_H_ 47 | 48 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 49 | -------------------------------------------------------------------------------- /USER/LinkListEvent.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_LINKLISTEVENT_H_ 16 | #define USER_LINKLISTEVENT_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | #ifdef STM32F072 21 | #include "stm32f0xx.h" 22 | #endif 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | #include "acsip_protocol.h" 27 | 28 | /* Exported types ------------------------------------------------------------*/ 29 | #define MAX_LoraEventCount 5 // 5 * 3 = 15, 15 * 8 = 120, 每一優先權最多5個事件,一個 SLAVE Node 有三種優先權 30 | // 三種優先權共最多15個事件,最多有 7 個 SLAVE Node,加上共同排程,固有 8 個 31 | // Event Priority 32 | #define LoraEventPriority0 0 // 優先權0級別(最高優先權級別)(規劃只有三種優先權級別,0~2,最高優先權為0,最低為2) 33 | #define LoraEventPriority1 1 // 優先權1級別(中等優先權級別) 34 | #define LoraEventPriority2 2 // 優先權2級別(最低優先權級別) 35 | #define LoraEventPriorities 3 // 優先權級別數 36 | 37 | 38 | typedef struct linklist { 39 | uint8_t NodeNumber; 40 | uint8_t NodeEvent; 41 | uint8_t NodeAddr[3]; 42 | uint8_t * NodeData; 43 | uint8_t NodeDataSize; 44 | struct linklist * Next; 45 | struct linklist * Previous; 46 | } tLoraNodeEvent; 47 | 48 | typedef struct LoraRunEvent { 49 | uint8_t RunNodeNumber; 50 | uint8_t RunNodeEvent; 51 | uint8_t RunNodeAddr[3]; 52 | uint8_t RunNodeData[MaxMsgDataSize]; 53 | uint8_t RunNodeDataSize; 54 | } tLoraRunningEvent; 55 | 56 | /* Exported constants --------------------------------------------------------*/ 57 | /* Exported macro ------------------------------------------------------------*/ 58 | /* Exported variables --------------------------------------------------------*/ 59 | extern uint8_t Event_Count[LoraEventPriorities]; 60 | 61 | /* Exported functions ------------------------------------------------------- */ 62 | void LoraLinkListEvent_Initialization(void); 63 | bool LoraLinkListEvent_CreateEvent( uint8_t Priority, uint8_t Num, uint8_t Event, const uint8_t *Addr, const uint8_t *Data, uint8_t *DataSize ); 64 | void LoraLinkListEvent_DestroyHeadEvent(uint8_t); 65 | 66 | uint8_t LoraLinkListEvent_ComputeEvent(tLoraNodeEvent *EventHead, uint8_t *EventCount); 67 | bool LoraLinkListEvent_BuildLoraEvent( uint8_t Priority, uint8_t Num, uint8_t Event, const uint8_t *Addr, const uint8_t *Data, uint8_t *DataSize ); 68 | bool LoraLinkListEvent_DispatcherLoraEvent(void); 69 | void LoraLinkListEvent_LoraEventDelete( uint8_t Priority, const uint8_t *Addr ); 70 | void LoraLinkListEvent_LoraEventReconfirm(uint8_t *Addr); 71 | void LoraLinkListEvent_LoraEventClearAll(void); 72 | bool LoraLinkListEvent_CreateNodeEvent( uint8_t Priority, uint8_t Num, uint8_t Event, const uint8_t *Data, uint8_t *DataSize ); 73 | void LoraLinkListEvent_DestroyNodeHeadEvent(uint8_t, uint8_t); 74 | void LoraLinkListEvent_LoraNodeEventDelete(uint8_t); 75 | 76 | #endif // USER_LINKLISTEVENT_H_ 77 | 78 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 79 | -------------------------------------------------------------------------------- /USER/RandomHopStartChannel.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_RANDOMHOPSTARTCHANNEL_H_ 16 | #define USER_RANDOMHOPSTARTCHANNEL_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | 21 | 22 | /* Exported define -----------------------------------------------------------*/ 23 | /* Exported types ------------------------------------------------------------*/ 24 | /* Exported constants --------------------------------------------------------*/ 25 | /* Exported macro ------------------------------------------------------------*/ 26 | /* Exported variables --------------------------------------------------------*/ 27 | 28 | 29 | /* Exported functions ------------------------------------------------------- */ 30 | void RandomHopStartChannel_SetHoppingStartChannelFreq(uint8_t); 31 | void RandomHopStartChannel_SlaveDefaultHoppingChannel(void); 32 | 33 | void Clear_FHSS_Channel_List( void ); 34 | void Load_Default_FHSS_Channel_List( void ); 35 | void List_FHSS_Channel_List( void ); 36 | bool Append_FHSS_Channel_into_List( uint32_t freq_Hz ); 37 | 38 | #endif // USER_RANDOMHOPSTARTCHANNEL_H_ 39 | 40 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 41 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/Base_Driver__ADC1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2017(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F072RBX_BASE_DRIVER__ADC1_H_ 17 | #define USER_STM32F072RBX_BASE_DRIVER__ADC1_H_ 18 | 19 | #ifdef USE_HARDWARE__ADC1 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define ADC_IDX___ADC0 (0x0001) // PA0 29 | #define ADC_IDX___ADC1 (0x0002) // PA1 30 | #define ADC_IDX___ADC4 (0x0004) // PA4 31 | #define ADC_IDX___ADC5 (0x0008) // PA5 32 | #define ADC_IDX___ADC6 (0x0010) // PA6 33 | #define ADC_IDX___ADC7 (0x0020) // PA7 34 | #define ADC_IDX___ADC8 (0x0040) // PB0 35 | #define ADC_IDX___Vref (0x0080) // Vref 36 | #define ADC_IDX___VBat (0x0100) // VBattery 37 | #define ADC_IDX___VTemp (0x0200) // Temperature Sensor 38 | 39 | // While VBat && VTemp configured together, VBat > VTemp 40 | 41 | 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* Exported variables --------------------------------------------------------*/ 46 | extern uint16_t ADC1_Converted_Value[16]; 47 | 48 | 49 | /* Exported functions ------------------------------------------------------- */ 50 | uint8_t ADC1__Count_Items( uint16_t ch_sel ); 51 | int8_t ADC1__Get_Item_Index( uint16_t ch_sel ); 52 | void ADC1__Dump_Values( void ); 53 | 54 | void ADC1__DeInit( void ); 55 | void ADC1__Configure_w_DMA( uint16_t ch_sel ); 56 | uint16_t ADC1__Get_Converted_Value( uint16_t ch_sel ); 57 | 58 | #endif // USE_HARDWARE__ADC1 59 | 60 | #endif // USER_STM32F072RBX_BASE_DRIVER__ADC1_H_ 61 | 62 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/Base_Driver__UART1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F072RBX_BASE_DRIVER__UART1_H_ 17 | #define USER_STM32F072RBX_BASE_DRIVER__UART1_H_ 18 | 19 | #ifdef USE_HARDWARE__USART1 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "Byte_Queue.h" 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | typedef void (*Fn_UART1__RX_Callback)( uint8_t data ); 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define UART1__TX_Buffer_Size 256 29 | 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported variables --------------------------------------------------------*/ 33 | extern Byte_Queue_Struct UART1__TX_Queue; 34 | 35 | 36 | /* Exported functions ------------------------------------------------------- */ 37 | void UART1__Init( Fn_UART1__RX_Callback cb, Byte_Queue_Struct *RX_Queue ); 38 | void UART1__Open( uint32_t BaudRate ); 39 | void UART1__Close( void ); 40 | void UART1__UartWrite( const uint8_t * Str, uint32_t Length ); 41 | 42 | #endif // USE_HARDWARE__USART1 43 | 44 | #endif // USER_STM32F072RBX_BASE_DRIVER__UART1_H_ 45 | 46 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/Base_Driver__UART2.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 17 | #define USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 18 | 19 | #ifdef USE_HARDWARE__USART2 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "Byte_Queue.h" 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | typedef void (*Fn_UART2__RX_Callback)( uint8_t data ); 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define UART2__TX_Buffer_Size 256 29 | 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported variables --------------------------------------------------------*/ 33 | extern Byte_Queue_Struct UART2__TX_Queue; 34 | 35 | 36 | /* Exported functions ------------------------------------------------------- */ 37 | void UART2__Init( Fn_UART2__RX_Callback cb, Byte_Queue_Struct *RX_Queue ); 38 | void UART2__Open( uint32_t BaudRate ); 39 | void UART2__Close( void ); 40 | void UART2__UartWrite( const uint8_t * Str, uint32_t Length ); 41 | 42 | #endif // USE_HARDWARE__USART2 43 | 44 | #endif // USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 45 | 46 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/save_record.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/save_record.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 29-Apr-2016 19 | * @brief Header for save_record.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F072RBX_SAVE_RECORD_H_ 30 | #define USER_STM32F072RBX_SAVE_RECORD_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "main.h" 34 | #ifdef STM32F072 35 | #include "stm32f0xx.h" 36 | #endif 37 | 38 | #ifdef STM32F401xx 39 | #include "stm32f4xx.h" 40 | #endif 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Private define ------------------------------------------------------------*/ 44 | #define MyWorkParaAddr (ADDR_FLASH_PAGE_8) 45 | #define LoraGateWayParaAddr (ADDR_FLASH_PAGE_8 + 0x400) 46 | #define LoraGateWayParaInterval (ADDR_FLASH_PAGE_8 + 0x500) 47 | #define LoraNodeParaPage1Addr (ADDR_FLASH_PAGE_9) 48 | #define LoraNodeParaPage2Addr (ADDR_FLASH_PAGE_10) 49 | #define LoraNodeTraceTableAddr (ADDR_FLASH_PAGE_11) 50 | #define LoraNodeTraceDataPageSize (FLASH_PAGE_SIZE) 51 | #define LoraNodeTraceDataStarPage (ADDR_FLASH_PAGE_12) 52 | #define LoraNodeTraceDataEndPage (ADDR_FLASH_PAGE_23) 53 | #define LoraNodeTraceDataStarAddr (ADDR_FLASH_PAGE_12) 54 | #define LoraNodeTraceDataEndAddr (LoraNodeTraceDataEndPage + FLASH_PAGE_SIZE - 1) 55 | 56 | /* Exported types ------------------------------------------------------------*/ 57 | typedef union { 58 | tLoRaSettings MyPara; 59 | uint8_t Value[292]; // 32 + 65 * 4 = 292 60 | }SaveRecordMyPara_t; 61 | 62 | typedef struct sSaveRecordLoraDeviceNode { 63 | uint8_t NodeAddress[3]; 64 | uint8_t Aliases[AliasesSize]; 65 | uint16_t Interval; 66 | }tLoraNodePara; 67 | 68 | typedef union { 69 | tLoraNodePara NodePara; 70 | uint8_t Value[38]; 71 | }SaveRecordNodePara_t; 72 | 73 | typedef struct sSaveRecordLoraDeviceNodeData { 74 | tDeviceNodeSensor NodeSensorData; 75 | uint8_t Identifier[3]; 76 | }tLoraNodeSensor; 77 | 78 | typedef union { 79 | tLoraNodeSensor TraceData; 80 | uint8_t Value[32]; 81 | } SaveRecordNodeTraceData_t; 82 | 83 | /* Exported constants --------------------------------------------------------*/ 84 | /* Exported macro ------------------------------------------------------------*/ 85 | /* Exported functions ------------------------------------------------------- */ 86 | void SaveRecord_WriteInLoraMode(void); 87 | void SaveRecord_WriteInMyselfParaAndLoraGateWayPara(void); 88 | void SaveRecord_ReadOutMyselfPara(void); 89 | void SaveRecord_ReadOutLoraGateWayPara(void); 90 | void SaveRecord_WriteInLoraNodePara(void); 91 | void SaveRecord_ReadOutLoraNodePara(void); 92 | void SaveRecord_TraceDataSpaceInitialization(void); 93 | void SaveRecord_WriteInTraceData(void); 94 | void SaveRecord_ReadOutTraceData(void); 95 | bool SaveRecord_isTraceDataSpaceFull(void); 96 | void SaveRecord_ClearTraceDataSpace(void); 97 | void SaveRecord_ClearAllSaveRecordSpace(void); 98 | 99 | #endif // USER_STM32F072RBX_SAVE_RECORD_H_ 100 | 101 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 102 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/stm32f0xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F0xx_StdPeriph_Templates/stm32f0xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 05-December-2014 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F0XX_CONF_H 30 | #define __STM32F0XX_CONF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Comment the line below to disable peripheral header file inclusion */ 34 | #include "stm32f0xx_adc.h" 35 | #include "stm32f0xx_can.h" 36 | #include "stm32f0xx_cec.h" 37 | #include "stm32f0xx_crc.h" 38 | #include "stm32f0xx_crs.h" 39 | #include "stm32f0xx_comp.h" 40 | #include "stm32f0xx_dac.h" 41 | #include "stm32f0xx_dbgmcu.h" 42 | #include "stm32f0xx_dma.h" 43 | #include "stm32f0xx_exti.h" 44 | #include "stm32f0xx_flash.h" 45 | #include "stm32f0xx_gpio.h" 46 | #include "stm32f0xx_syscfg.h" 47 | #include "stm32f0xx_i2c.h" 48 | #include "stm32f0xx_iwdg.h" 49 | #include "stm32f0xx_pwr.h" 50 | #include "stm32f0xx_rcc.h" 51 | #include "stm32f0xx_rtc.h" 52 | #include "stm32f0xx_spi.h" 53 | #include "stm32f0xx_tim.h" 54 | #include "stm32f0xx_usart.h" 55 | #include "stm32f0xx_wwdg.h" 56 | #include "stm32f0xx_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /** 68 | * @brief The assert_param macro is used for function's parameters check. 69 | * @param expr: If expr is false, it calls assert_failed function which reports 70 | * the name of the source file and the source line number of the call 71 | * that failed. If expr is true, it returns no value. 72 | * @retval None 73 | */ 74 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 75 | /* Exported functions ------------------------------------------------------- */ 76 | void assert_failed(uint8_t* file, uint32_t line); 77 | #else 78 | #define assert_param(expr) ((void)0) 79 | #endif /* USE_FULL_ASSERT */ 80 | 81 | #endif /* __STM32F0XX_CONF_H */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/stm32f0xx_it.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/STM32F0xx_StdPeriph_Templates/stm32f0xx_it.h 16 | * @author MCD Application Team 17 | * @version V1.5.0 18 | * @date 05-December-2014 19 | * @brief This file contains the headers of the interrupt handlers. 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | *

© COPYRIGHT 2014 STMicroelectronics

24 | * 25 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 26 | * You may not use this file except in compliance with the License. 27 | * You may obtain a copy of the License at: 28 | * 29 | * http://www.st.com/software_license_agreement_liberty_v2 30 | * 31 | * Unless required by applicable law or agreed to in writing, software 32 | * distributed under the License is distributed on an "AS IS" BASIS, 33 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | * See the License for the specific language governing permissions and 35 | * limitations under the License. 36 | * 37 | ****************************************************************************** 38 | */ 39 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ 41 | #ifndef USER_STM32F072RBX_STM32F0XX_IT_H_ 42 | #define USER_STM32F072RBX_STM32F0XX_IT_H_ 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /* Includes ------------------------------------------------------------------*/ 49 | #include "main.h" 50 | 51 | /* Exported types ------------------------------------------------------------*/ 52 | /* Exported constants --------------------------------------------------------*/ 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions ------------------------------------------------------- */ 55 | void NMI_Handler(void); 56 | void HardFault_Handler(void); 57 | void SVC_Handler(void); 58 | void PendSV_Handler(void); 59 | void SysTick_Handler(void); 60 | 61 | /*void PPP_IRQHandler(void);*/ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif // USER_STM32F072RBX_STM32F0XX_IT_H_ 68 | 69 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /USER/STM32F072RBx/usart1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/usart1.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 18-Apr-2016 19 | * @brief Header for usart1.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F072RBX_USART1_H_ 30 | #define USER_STM32F072RBX_USART1_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #ifdef STM32F072 34 | #include "stm32f0xx.h" 35 | #endif 36 | 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Private define ------------------------------------------------------------*/ 40 | #define USART1_RX_BufLength (100) 41 | 42 | /* Exported constants --------------------------------------------------------*/ 43 | /* Exported macro ------------------------------------------------------------*/ 44 | /* Exported functions ------------------------------------------------------- */ 45 | void USART1_PinInitialization(void); 46 | void USART1_UartConfig(uint32_t); 47 | void USART1_UartEnableOrDisable(FunctionalState); 48 | void USART1_UartInit(uint32_t); 49 | void USART1_UartWrite(uint8_t *, uint32_t); 50 | void USART1_IRQHandler(void); 51 | void USART1_EnvironmentVariableSet(void); 52 | void USART1_VariableSwap(void); 53 | 54 | #endif // USER_STM32F072RBX_USART1_H_ 55 | 56 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/Base_Driver__ADC1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2017(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F401VCX_BASE_DRIVER__ADC1_H_ 17 | #define USER_STM32F401VCX_BASE_DRIVER__ADC1_H_ 18 | 19 | #ifdef USE_HARDWARE__ADC1 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define ADC_IDX___ADC0 (0x0001) // PA0 29 | #define ADC_IDX___ADC1 (0x0002) // PA1 30 | #define ADC_IDX___ADC4 (0x0004) // PA4 31 | #define ADC_IDX___ADC5 (0x0008) // PA5 32 | #define ADC_IDX___ADC6 (0x0010) // PA6 33 | #define ADC_IDX___ADC7 (0x0020) // PA7 34 | #define ADC_IDX___ADC8 (0x0040) // PB0 35 | #define ADC_IDX___Vref (0x0080) // Vref 36 | #define ADC_IDX___VBat (0x0100) // VBattery 37 | #define ADC_IDX___VTemp (0x0200) // Temperature Sensor 38 | 39 | // While VBat && VTemp configured together, VBat > VTemp 40 | 41 | 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* Exported variables --------------------------------------------------------*/ 46 | extern uint16_t ADC1_Converted_Value[16]; 47 | 48 | 49 | /* Exported functions ------------------------------------------------------- */ 50 | uint8_t ADC1__Count_Items( uint16_t ch_sel ); 51 | int8_t ADC1__Get_Item_Index( uint16_t ch_sel ); 52 | void ADC1__Dump_Values( void ); 53 | 54 | void ADC1__DeInit( void ); 55 | void ADC1__Configure_w_DMA( uint16_t ch_sel ); 56 | uint16_t ADC1__Get_Converted_Value( uint16_t ch_sel ); 57 | 58 | #endif // USE_HARDWARE__ADC1 59 | 60 | #endif // USER_STM32F401VCX_BASE_DRIVER__ADC1_H_ 61 | 62 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/Base_Driver__UART1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F401VCX_BASE_DRIVER__UART1_H_ 17 | #define USER_STM32F401VCX_BASE_DRIVER__UART1_H_ 18 | 19 | #ifdef USE_HARDWARE__USART1 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "Byte_Queue.h" 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | typedef void (*Fn_UART1__RX_Callback)( uint8_t data ); 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define UART1__TX_Buffer_Size 256 29 | 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported variables --------------------------------------------------------*/ 33 | extern Byte_Queue_Struct UART1__TX_Queue; 34 | 35 | 36 | /* Exported functions ------------------------------------------------------- */ 37 | void UART1__Init( Fn_UART1__RX_Callback cb, Byte_Queue_Struct *RX_Queue ); 38 | void UART1__Open( uint32_t BaudRate ); 39 | void UART1__Close( void ); 40 | void UART1__UartWrite( const uint8_t * Str, uint32_t Length ); 41 | 42 | #endif // USE_HARDWARE__USART1 43 | 44 | #endif // USER_STM32F401VCX_BASE_DRIVER__UART1_H_ 45 | 46 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/Base_Driver__UART2.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 17 | #define USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 18 | 19 | #ifdef USE_HARDWARE__USART2 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "Byte_Queue.h" 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | typedef void (*Fn_UART2__RX_Callback)( uint8_t data ); 26 | 27 | /* Exported define -----------------------------------------------------------*/ 28 | #define UART2__TX_Buffer_Size 256 29 | 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported variables --------------------------------------------------------*/ 33 | extern Byte_Queue_Struct UART2__TX_Queue; 34 | 35 | 36 | /* Exported functions ------------------------------------------------------- */ 37 | void UART2__Init( Fn_UART2__RX_Callback cb, Byte_Queue_Struct *RX_Queue ); 38 | void UART2__Open( uint32_t BaudRate ); 39 | void UART2__Close( void ); 40 | void UART2__UartWrite( const uint8_t * Str, uint32_t Length ); 41 | 42 | #endif // USE_HARDWARE__USART2 43 | 44 | #endif // USER_STM32F401VCX_BASE_DRIVER__UART2_H_ 45 | 46 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/save_record.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/save_record.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 29-Apr-2016 19 | * @brief Header for save_record.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F401VCX_SAVE_RECORD_H_ 30 | #define USER_STM32F401VCX_SAVE_RECORD_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "main.h" 34 | #ifdef STM32F072 35 | #include "stm32f0xx.h" 36 | #endif 37 | 38 | #ifdef STM32F401xx 39 | #include "stm32f4xx.h" 40 | #endif 41 | 42 | /* Private define ------------------------------------------------------------*/ 43 | #define WorkParaSectorSize ((uint32_t)0x00004000) // 16K 44 | #define WorkParaSector (ADDR_FLASH_SECTOR_1) 45 | #define MyWorkParaAddr (ADDR_FLASH_SECTOR_1) 46 | #define LoraGateWayParaAddr (ADDR_FLASH_SECTOR_1 + 0x800) 47 | #define LoraGateWayParaInterval (ADDR_FLASH_SECTOR_1 + 0x900) 48 | #define LoraNodeParaAddr (ADDR_FLASH_SECTOR_1 + 0x1000) 49 | #define LoraNodeTraceDataSectorSize ((uint32_t)0x00004000) // 16K 50 | #define LoraNodeTraceDataSector (ADDR_FLASH_SECTOR_2) 51 | #define LoraNodeTraceDataStarAddr (ADDR_FLASH_SECTOR_2) 52 | #define LoraNodeTraceDataEndAddr (ADDR_FLASH_SECTOR_2 + LoraNodeTraceDataSectorSize - 1) 53 | 54 | /* Exported types ------------------------------------------------------------*/ 55 | typedef union { 56 | tLoRaSettings MyPara; 57 | uint8_t Value[292]; // 32 + 65 * 4 = 292 58 | } SaveRecordMyPara_t; 59 | 60 | typedef struct sSaveRecordLoraDeviceNode { 61 | uint8_t NodeAddress[3]; 62 | uint8_t Aliases[AliasesSize]; 63 | uint16_t Interval; 64 | } tLoraNodePara; 65 | 66 | typedef union { 67 | tLoraNodePara NodePara; 68 | uint8_t Value[38]; 69 | } SaveRecordNodePara_t; 70 | 71 | typedef struct sSaveRecordLoraDeviceNodeData { 72 | tDeviceNodeSensor NodeSensorData; 73 | uint8_t Identifier[3]; 74 | } tLoraNodeSensor; 75 | 76 | typedef union { 77 | tLoraNodeSensor TraceData; 78 | uint8_t Value[32]; 79 | } SaveRecordNodeTraceData_t; 80 | 81 | /* Private define ------------------------------------------------------------*/ 82 | /* Exported constants --------------------------------------------------------*/ 83 | /* Exported macro ------------------------------------------------------------*/ 84 | /* Exported functions ------------------------------------------------------- */ 85 | void SaveRecord_WriteInLoraMode(void); 86 | void SaveRecord_WriteInMyselfParaAndLoraGateWayParaAndLoraNodePara(void); 87 | void SaveRecord_ReadOutMyselfPara(void); 88 | void SaveRecord_ReadOutLoraGateWayPara(void); 89 | void SaveRecord_ReadOutLoraNodePara(void); 90 | void SaveRecord_TraceDataSpaceInitialization(void); 91 | void SaveRecord_WriteInTraceData(void); 92 | void SaveRecord_ReadOutTraceData(void); 93 | bool SaveRecord_isTraceDataSpaceFull(void); 94 | void SaveRecord_ClearTraceDataSpace(void); 95 | void SaveRecord_ClearAllSaveRecordSpace(void); 96 | 97 | #endif // USER_STM32F401VCX_SAVE_RECORD_H_ 98 | 99 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /** 15 | ****************************************************************************** 16 | * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.h 17 | * @author MCD Application Team 18 | * @version V1.6.1 19 | * @date 21-October-2015 20 | * @brief This file contains the headers of the interrupt handlers. 21 | ****************************************************************************** 22 | * @attention 23 | * 24 | *

© COPYRIGHT 2015 STMicroelectronics

25 | * 26 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 27 | * You may not use this file except in compliance with the License. 28 | * You may obtain a copy of the License at: 29 | * 30 | * http://www.st.com/software_license_agreement_liberty_v2 31 | * 32 | * Unless required by applicable law or agreed to in writing, software 33 | * distributed under the License is distributed on an "AS IS" BASIS, 34 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | * See the License for the specific language governing permissions and 36 | * limitations under the License. 37 | * 38 | ****************************************************************************** 39 | */ 40 | 41 | /* Define to prevent recursive inclusion -------------------------------------*/ 42 | #ifndef USER_STM32F401VCX_STM32F4XX_IT_H_ 43 | #define USER_STM32F401VCX_STM32F4XX_IT_H_ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32f4xx.h" 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | /* Exported constants --------------------------------------------------------*/ 54 | /* Exported macro ------------------------------------------------------------*/ 55 | /* Exported functions ------------------------------------------------------- */ 56 | 57 | void NMI_Handler(void); 58 | void HardFault_Handler(void); 59 | void MemManage_Handler(void); 60 | void BusFault_Handler(void); 61 | void UsageFault_Handler(void); 62 | void SVC_Handler(void); 63 | void DebugMon_Handler(void); 64 | void PendSV_Handler(void); 65 | void SysTick_Handler(void); 66 | 67 | #ifdef STM32F401xx 68 | #ifdef USBD_VCP_Console 69 | void OTG_FS_WKUP_IRQHandler( void ); 70 | void OTG_FS_IRQHandler( void ); 71 | #endif 72 | #endif 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // USER_STM32F401VCX_STM32F4XX_IT_H_ 79 | 80 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 81 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/tim2.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/tim2.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 14-Apr-2016 19 | * @brief Header for tim2.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F401VCX_TIM2_H_ 30 | #define USER_STM32F401VCX_TIM2_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f4xx.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | #endif // USER_STM32F401VCX_TIM2_H_ 41 | 42 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 43 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/tim3.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/tim3.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 14-Apr-2016 19 | * @brief Header for tim3.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F401VCX_TIM3_H_ 30 | #define USER_STM32F401VCX_TIM3_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f4xx.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | #endif // USER_STM32F401VCX_TIM3_H_ 41 | 42 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 43 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/tim9.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/tim9.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 24-May-2016 19 | * @brief Header for tim9.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_STM32F401VCX_TIM9_H_ 30 | #define USER_STM32F401VCX_TIM9_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f4xx.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | void TIM9_TimerConfig(void); 40 | void TIM9_TimerRunOrStop(FunctionalState); 41 | void TIM9_ClearDelayCounter(void); 42 | void TIM1_BRK_TIM9_IRQHandler (void); 43 | 44 | #endif // USER_STM32F401VCX_TIM9_H_ 45 | 46 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /USER/STM32F401VCx/usart1.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /** 15 | ****************************************************************************** 16 | * @file Project/ARM-Lora/usart1.h 17 | * @author JC 18 | * @version V1.0.0 19 | * @date 12-Apr-2016 20 | * @brief Header for usart1.c module 21 | ****************************************************************************** 22 | * @attention 23 | * 24 | * 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef USER_STM32F401VCX_USART1_H_ 31 | #define USER_STM32F401VCX_USART1_H_ 32 | 33 | #ifdef Board__A22_Tracker 34 | 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "stm32f4xx.h" 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Private define ------------------------------------------------------------*/ 41 | #define USART1_RX_BufLength (100) 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* Exported functions ------------------------------------------------------- */ 46 | void USART1_PinInitialization(void); 47 | void USART1_UartConfig(uint32_t); 48 | void USART1_UartEnableOrDisable(FunctionalState); 49 | void USART1_UartInit(uint32_t); 50 | void USART1_UartWrite(uint8_t *, uint32_t); 51 | void USART1_IRQHandler(void); 52 | void USART1_EnvironmentVariableSet(void); 53 | void USART1_VariableSwap(void); 54 | 55 | #endif // Board__A22_Tracker 56 | 57 | #endif // USER_STM32F401VCX_USART1_H_ 58 | 59 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 60 | -------------------------------------------------------------------------------- /USER/UART_Console.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_UART_CONSOLE_H_ 16 | #define USER_UART_CONSOLE_H_ 17 | 18 | #if defined( Console__Use_UART1 ) || defined( Console__Use_UART2 ) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include 22 | #include "Message_Queue.h" 23 | 24 | /* Exported types ------------------------------------------------------------*/ 25 | /* Exported define -----------------------------------------------------------*/ 26 | #define CmdUART_String_Buffer_Length 256 27 | #define CmdUART_String_Item_Size 8 28 | 29 | 30 | /* Exported variables --------------------------------------------------------*/ 31 | extern bool Console_EchoOn; 32 | 33 | /* Exported constants --------------------------------------------------------*/ 34 | /* Exported macro ------------------------------------------------------------*/ 35 | /* Exported functions ------------------------------------------------------- */ 36 | bool CmdUART__Init( void ); 37 | void CmdUART__Open( uint32_t BaudRate ); 38 | void CmdUART__Close( void ); 39 | void CmdUART__UartWrite( const uint8_t * Str, uint32_t Length ); 40 | void CmdUART__UartWrite_String( const char *str ); 41 | bool CmdUART__UartGet_String( uint8_t *buffer, uint16_t buf_sz, uint16_t *ret_length ); 42 | bool CmdUART__is_TX_Queue_Empty( void ); 43 | void CmdUART__Clear_Buffer( void ); 44 | 45 | #endif // defined( Console__Use_UART1 ) || defined( Console__Use_UART2 ) 46 | 47 | #endif // USER_UART_CONSOLE_H_ 48 | 49 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 50 | -------------------------------------------------------------------------------- /USER/base64.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_BASE64_H_ 15 | #define USER_BASE64_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | 21 | #ifdef STM32F072 22 | #include "stm32f0xx.h" 23 | #endif 24 | 25 | #ifdef STM32F401xx 26 | #include "stm32f4xx.h" 27 | #endif 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Private define ------------------------------------------------------------*/ 31 | #define ERR_BASE64_BUFFER_TOO_SMALL (-0x002A) 32 | #define ERR_BASE64_INVALID_CHARACTER (-0x002C) 33 | 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | int32_t Base64_encode( uint8_t *, size_t, size_t *, const uint8_t *, size_t); 38 | int32_t Base64_decode( uint8_t *, size_t, size_t *, const uint8_t *, size_t); 39 | int32_t Base64_self_test( int8_t ); 40 | 41 | 42 | 43 | #endif // USER_BASE64_H_ 44 | 45 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /USER/bluetooth.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_BLUETOOTH_H_ 15 | #define USER_BLUETOOTH_H_ 16 | 17 | #ifdef Board__A22_Tracker 18 | 19 | /* Includes ------------------------------------------------------------------*/ 20 | #ifdef STM32F072 21 | #include "stm32f0xx.h" 22 | #endif 23 | 24 | #ifdef STM32F401xx 25 | #include "stm32f4xx.h" 26 | #endif 27 | 28 | /* Exported types ------------------------------------------------------------*/ 29 | /* Private define ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported functions ------------------------------------------------------- */ 33 | void BlueTooth_PinInitialization(void); 34 | void BlueTooth_DA14580Reset(void); 35 | void BlueTooth_DA14580Enable(void); 36 | void BlueTooth_DA14580Disable(void); 37 | void BlueTooth_DA14580Run(uint32_t); 38 | void BlueTooth_DA14580Stop(void); 39 | 40 | #endif // Board__A22_Tracker 41 | 42 | #endif // USER_BLUETOOTH_H_ 43 | 44 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 45 | -------------------------------------------------------------------------------- /USER/board.h: -------------------------------------------------------------------------------- 1 | 2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* 14 | * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND 15 | * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER. 16 | * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR 17 | * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT 18 | * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION 19 | * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 20 | * 21 | * Copyright (C) SEMTECH S.A. 22 | */ 23 | /*! 24 | * \file board.h 25 | * \brief 26 | * 27 | * \version 1.0 28 | * \date Nov 21 2012 29 | * \author Miguel Luis 30 | */ 31 | #ifndef USER_BOARD_H_ 32 | #define USER_BOARD_H_ 33 | 34 | #include 35 | #include 36 | 37 | #ifdef STM32F072 38 | #include "stm32f0xx.h" 39 | #endif 40 | 41 | #ifdef STM32F401xx 42 | #include "stm32f4xx.h" 43 | #endif 44 | 45 | #define SUCCESS 1 46 | #define FAIL 0 47 | 48 | #define USE_USB 0 49 | 50 | #define FW_VERSION "2.0.B2" 51 | #define SK_NAME "Bleeper" 52 | 53 | /*! 54 | * Functions return codes definition 55 | */ 56 | typedef enum { 57 | SX_OK, 58 | SX_ERROR, 59 | SX_BUSY, 60 | SX_EMPTY, 61 | SX_DONE, 62 | SX_TIMEOUT, 63 | SX_UNSUPPORTED, 64 | SX_WAIT, 65 | SX_CLOSE, 66 | SX_YES, 67 | SX_NO 68 | } tReturnCodes; 69 | 70 | extern volatile uint32_t TickCounter; 71 | 72 | /** 73 | * @brief Small printf for GCC/RAISONANCE 74 | */ 75 | #ifdef __GNUC__ 76 | /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf 77 | set to 'Yes') calls __io_putchar() */ 78 | #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) 79 | 80 | #endif /* __GNUC__ */ 81 | 82 | /*! 83 | * Initializes board peripherals 84 | */ 85 | void BoardInit( void ); 86 | void Board_DeInit( void ); 87 | 88 | /*! 89 | * Delay code execution for "delay" ms 90 | */ 91 | void Delay ( uint32_t delay ); 92 | 93 | /*! 94 | * Delay code execution for "delay" s 95 | */ 96 | void LongDelay ( uint8_t delay ); 97 | 98 | /*! 99 | * \brief Computes a random number between min and max 100 | * 101 | * \param [IN] min range minimum value 102 | * \param [IN] max range maximum value 103 | * \retval random random value in range min..max 104 | */ 105 | uint32_t randr( uint32_t min, uint32_t max ); 106 | 107 | #endif // USER_BOARD_H_ 108 | 109 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /USER/button.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_BUTTON_H_ 15 | #define USER_BUTTON_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #ifdef STM32F072 19 | #include "stm32f0xx.h" 20 | #endif 21 | 22 | #ifdef STM32F401xx 23 | #include "stm32f4xx.h" 24 | #endif 25 | 26 | /* Exported types ------------------------------------------------------------*/ 27 | /* Private define ------------------------------------------------------------*/ 28 | /* Exported constants --------------------------------------------------------*/ 29 | /* Exported macro ------------------------------------------------------------*/ 30 | /* Exported functions ------------------------------------------------------- */ 31 | void Button_ButtonInitialization(void); 32 | void Button_Delay(void); 33 | void Button_PowerButtonAction(void); 34 | #ifdef STM32F401xx 35 | void EXTI0_IRQHandler(void); 36 | void EXTI1_IRQHandler(void); 37 | void EXTI4_IRQHandler(void); 38 | #elif STM32F072 39 | void EXTI0_1_IRQHandler(void); 40 | void EXTI4_15_IRQHandler(void); 41 | #endif 42 | 43 | #endif // USER_BUTTON_H_ 44 | 45 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /USER/config.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_CONFIG_H_ 16 | #define USER_CONFIG_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #ifdef STM32F072 20 | #include "stm32f0xx.h" 21 | #endif 22 | 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | 27 | #include "console_function.h" 28 | 29 | 30 | 31 | /* Exported define -----------------------------------------------------------*/ 32 | #define FirmwareVersion ("1.7.2017.0419") 33 | #define ComPortBaudRate (38400) 34 | #define GPSnoLocated_RunningTime (60) // Unit:s 35 | #define DEF_Allowed_LoRa_Rx_Failure_Times_Times (5) // Unit: polling round 36 | #define CONSOLE_TIMER__CCR1_DelayForCMD (3) // second 37 | 38 | 39 | #ifdef STM32F401xx 40 | // #define USBD_VCP_Console (1) 41 | #undef USBD_VCP_Console 42 | #endif 43 | 44 | #define unkownCMD ("\r\nUNKNOW\r\n") 45 | #define okCMD ("\r\nOK\r\n") 46 | #define errorCMD ("\r\nERROR\r\n") 47 | 48 | // #define Board__A22_Tracker (1) 49 | #undef Board__A22_Tracker 50 | 51 | #define Console__Use_UART2 52 | #undef Console__Use_UART1 53 | 54 | 55 | #define USE_HARDWARE__USART1 56 | #define USE_HARDWARE__USART2 57 | #define USE_HARDWARE__ADC1 58 | 59 | 60 | /* Exported types ------------------------------------------------------------*/ 61 | /* Exported constants --------------------------------------------------------*/ 62 | #define MAX_HOPPING_CHANNELS 64 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | /* Exported functions ------------------------------------------------------- */ 66 | 67 | #endif // USER_CONFIG_H_ 68 | 69 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /USER/console_function.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file Project/ARM-Lora/console_function.h 16 | * @author JC 17 | * @version V1.0.0 18 | * @date 24-May-2016 19 | * @brief Header for console_function.c module 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | * 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef USER_CONSOLE_FUNCTION_H_ 30 | #define USER_CONSOLE_FUNCTION_H_ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Private define ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void Console_Write( const uint8_t *Str, uint32_t Length ); 39 | 40 | void Console_Output_String( const char *msg ); 41 | void Console_Dump_Binary( const uint8_t *buf, uint16_t length ); 42 | 43 | void Console_Output_LoraMode( uint8_t mode ); 44 | 45 | #endif // USER_CONSOLE_FUNCTION_H_ 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /USER/crc.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_CRC_H_ 15 | #define USER_CRC_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #ifdef STM32F072 19 | #include "stm32f0xx.h" 20 | #endif 21 | 22 | #ifdef STM32F401xx 23 | #include "stm32f4xx.h" 24 | #endif 25 | 26 | /* Exported types ------------------------------------------------------------*/ 27 | /* Exported constants --------------------------------------------------------*/ 28 | /* Exported macro ------------------------------------------------------------*/ 29 | /* Exported functions ------------------------------------------------------- */ 30 | void CRC16(__IO uint8_t *, uint16_t, uint16_t *); 31 | 32 | #endif // USER_CRC_H_ 33 | 34 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 35 | -------------------------------------------------------------------------------- /USER/gpio.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_GPIO_H_ 15 | #define USER_GPIO_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #ifdef STM32F072 19 | #include "stm32f0xx.h" 20 | #endif 21 | 22 | #ifdef STM32F401xx 23 | #include "stm32f4xx.h" 24 | #endif 25 | 26 | /* Exported types ------------------------------------------------------------*/ 27 | /* Exported constants --------------------------------------------------------*/ 28 | /* Exported macro ------------------------------------------------------------*/ 29 | /* Exported functions ------------------------------------------------------- */ 30 | void GPIO_PinInitialization(void); 31 | void GPIO_UM402toNormalMode(void); 32 | void GPIO_UM402toWakeupMode(void); 33 | void GPIO_UM402toLowPowerMode(void); 34 | void GPIO_UM402toConfigMode(void); 35 | void EXTI4_15_IRQHandler(void); 36 | 37 | #endif // USER_GPIO_H_ 38 | 39 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 40 | -------------------------------------------------------------------------------- /USER/gps.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_GPS_H_ 16 | #define USER_GPS_H_ 17 | 18 | #ifdef Board__A22_Tracker 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #ifdef STM32F072 22 | #include "stm32f0xx.h" 23 | #endif 24 | 25 | #ifdef STM32F401xx 26 | #include "stm32f4xx.h" 27 | #endif 28 | #include "acsip_protocol.h" 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Private define ------------------------------------------------------------*/ 32 | /* Exported constants --------------------------------------------------------*/ 33 | /* Exported macro ------------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | void GPS_PinInitialization(void); 36 | void GPS_MT3333Reset(void); 37 | void GPS_MT3333Enable(void); 38 | void GPS_MT3333Disable(void); 39 | void GPS_MT3333Run(void); 40 | void GPS_MT3333Stop(void); 41 | void GPS_ReadIn(tDeviceNodeSensor *); 42 | 43 | #endif // Board__A22_Tracker 44 | 45 | #endif // USER_GPS_H_ 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /USER/led.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_LED_H_ 16 | #define USER_LED_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #ifdef STM32F072 20 | #include "stm32f0xx.h" 21 | #endif 22 | 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | 27 | /* Exported types ------------------------------------------------------------*/ 28 | /* Private define ------------------------------------------------------------*/ 29 | /* Exported constants --------------------------------------------------------*/ 30 | /* Exported macro ------------------------------------------------------------*/ 31 | /* Exported functions ------------------------------------------------------- */ 32 | void Led_PinInitialization(void); 33 | void Led_BootFlashLed(void); 34 | void Led_GreenLedLightOn(void); 35 | void Led_GreenLedLightOff(void); 36 | void Led_BlueLedLightOn(void); 37 | void Led_BlueLedLightOff(void); 38 | 39 | #endif // USER_LED_H_ 40 | 41 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 42 | -------------------------------------------------------------------------------- /USER/main.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_MAIN_H_ 15 | #define USER_MAIN_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "config.h" 23 | #include "cli.h" 24 | #include "sx1276-LoRaMisc.h" 25 | #include "sx1276-LoRa.h" 26 | #include "sx1276.h" 27 | #include "sx1276-Hal.h" 28 | #include "platform.h" 29 | #include "radio.h" 30 | #include "board.h" 31 | #include "base64.h" 32 | #include "acsip_protocol.h" 33 | #include "normalSlave.h" 34 | #include "normalMaster.h" 35 | #include "LinkListEvent.h" 36 | #include "gps.h" 37 | #include "save_record.h" 38 | #include "bluetooth.h" 39 | #include "led.h" 40 | #include "button.h" 41 | #include "rtc.h" 42 | #include "RandomHopStartChannel.h" 43 | #include "sleep.h" 44 | 45 | #include "UART_Console.h" 46 | #include "Console_Timer.h" 47 | 48 | #ifdef STM32F072 49 | #include "stm32f0xx.h" 50 | #endif 51 | 52 | #ifdef STM32F401xx 53 | #include "stm32f4xx.h" 54 | 55 | #include "usb_bsp.h" 56 | #include "usbd_cdc_core.h" 57 | #include "usbd_cdc_vcp.h" 58 | #include "usbd_usr.h" 59 | #include "usbd_desc.h" 60 | #include "console_function.h" 61 | #include "tim9.h" 62 | #endif 63 | 64 | 65 | /* Exported types ------------------------------------------------------------*/ 66 | typedef enum { 67 | SystemInPingPognTest, 68 | SystemInNormal, 69 | SystemInProductVerification, 70 | SystemInIdle, 71 | } tAllSystemOperationMode; 72 | 73 | /* Exported constants --------------------------------------------------------*/ 74 | /* Exported macro ------------------------------------------------------------*/ 75 | #define enableGlobalInterrupts() __set_PRIMASK(0); 76 | #define disableGlobalInterrupts() __set_PRIMASK(1); 77 | 78 | /* Exported functions ------------------------------------------------------- */ 79 | void LoraPara_LoadAndConfiguration(void); 80 | 81 | #endif // USER_MAIN_H_ 82 | 83 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /USER/normalMaster.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_NORMALMASTER_H_ 16 | #define USER_NORMALMASTER_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | #ifdef STM32F072 21 | #include "stm32f0xx.h" 22 | #endif 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | #include "acsip_protocol.h" 27 | #include "LinkListEvent.h" 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | // General parameters definition 31 | // SX1276 LoRa General parameters definition 32 | 33 | /* Exported constants --------------------------------------------------------*/ 34 | /* Exported macro ------------------------------------------------------------*/ 35 | /* Exported functions ------------------------------------------------------- */ 36 | uint8_t NormalMaster(__IO tLoraRunningEvent *); 37 | 38 | 39 | 40 | #endif // USER_NORMALMASTER_H_ 41 | 42 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 43 | -------------------------------------------------------------------------------- /USER/normalSlave.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_NORMALSLAVE_H_ 16 | #define USER_NORMALSLAVE_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | #ifdef STM32F072 21 | #include "stm32f0xx.h" 22 | #endif 23 | 24 | #ifdef STM32F401xx 25 | #include "stm32f4xx.h" 26 | #endif 27 | 28 | /* Exported types ------------------------------------------------------------*/ 29 | // General parameters definition 30 | // SX1276 LoRa General parameters definition 31 | 32 | /* Exported constants --------------------------------------------------------*/ 33 | /* Exported macro ------------------------------------------------------------*/ 34 | /* Exported functions ------------------------------------------------------- */ 35 | uint8_t NormalSlave(void); 36 | 37 | #endif // USER_NORMALSLAVE_H_ 38 | 39 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 40 | -------------------------------------------------------------------------------- /USER/rtc.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_RTC_H_ 16 | #define USER_RTC_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #ifdef STM32F072 20 | #include "stm32f0xx.h" 21 | #endif 22 | #ifdef STM32F401xx 23 | #include "stm32f4xx.h" 24 | #endif 25 | 26 | /* Exported define -----------------------------------------------------------*/ 27 | // #define SecondOfOneTimes (5) 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported functions ------------------------------------------------------- */ 33 | void RTC_IRQ_Config( void ); 34 | 35 | void RTC_TimerConfig(void); 36 | void RTC_AlarmConfig(void); // Triggered every 1 second 37 | void RTC_AlarmConfig_Timeout( uint32_t timeout_sec ); 38 | void RTC_AlarmRun(void); 39 | void RTC_AlarmStop(void); 40 | 41 | #ifdef STM32F401xx 42 | void RTC_Alarm_IRQHandler(void); 43 | #elif STM32F072 44 | void RTC_IRQHandler(void); 45 | #endif 46 | 47 | #endif // USER_RTC_H_ 48 | 49 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 50 | -------------------------------------------------------------------------------- /USER/sleep.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_SLEEP_H_ 16 | #define USER_SLEEP_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include 20 | #ifdef STM32F072 21 | #include "stm32f0xx.h" 22 | #endif 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | 27 | #include "LinkListEvent.h" 28 | 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | typedef struct sDeviceNodeSleepAndRandomHop { 32 | // for sleep 33 | bool isNowSleeping; 34 | uint16_t WakeUpTimePoint; 35 | 36 | // for Lora disconnect 37 | uint16_t DefineLoraRxFailureTimes; 38 | bool isLoraDisconnecting; 39 | uint16_t LoraRxFailureTimes; 40 | 41 | // for random hopping start channel 42 | uint8_t LoraHoppingStartChannel; 43 | 44 | // for Lora Event 45 | tLoraNodeEvent * Event_Head[ LoraEventPriorities ]; 46 | uint8_t Event_Count[ LoraEventPriorities ]; 47 | } tDeviceNodeSleepAndRandomHop; 48 | 49 | /* Exported constants --------------------------------------------------------*/ 50 | /* Exported macro ------------------------------------------------------------*/ 51 | /* Exported functions ------------------------------------------------------- */ 52 | void SLEEP_SYSCLKConfigFromSTOPMode(void); 53 | void SLEEP_SlaveSleepVariableSet(void); 54 | void SLEEP_SlaveSleep_STOP_Mode(uint16_t *); 55 | void SLEEP_SlaveSleep_Deep_STOP_Mode( uint16_t *SleepTime_sec ); 56 | void SLEEP_SlaveSleep_STANDBY_Mode( uint16_t *SleepTime_sec ); 57 | void SLEEP_SlaveSleepAandRandomHopChannelProcedure(uint16_t *); 58 | void SLEEP_MasterSleepProcedure(void); 59 | 60 | #endif // USER_SLEEP_H_ 61 | 62 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /USER/spi.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* 14 | * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND 15 | * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER. 16 | * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR 17 | * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT 18 | * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION 19 | * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 20 | * 21 | * Copyright (C) SEMTECH S.A. 22 | */ 23 | /*! 24 | * \file spi.h 25 | * \brief SPI hardware driver 26 | * 27 | * \version 1.0 28 | * \date Feb 12 2010 29 | * \author Miguel Luis 30 | */ 31 | /* Define to prevent recursive inclusion -------------------------------------*/ 32 | 33 | #ifndef USER_SPI_H_ 34 | #define USER_SPI_H_ 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | 38 | #ifdef STM32F072 39 | #include "stm32f0xx.h" 40 | #endif 41 | 42 | #ifdef STM32F401xx 43 | #include "stm32f4xx.h" 44 | #endif 45 | 46 | #if ( STM32F4XX ) 47 | #include "stm32f4xx_spi.h" 48 | #elif defined( STM32F2XX ) 49 | #include "stm32f2xx_spi.h" 50 | #elif defined( STM32F1XX ) 51 | #include "stm32f10x_spi.h" 52 | #elif defined( STM32F072 ) 53 | #include "stm32f0xx_spi.h" 54 | #elif defined( STM32F401xx ) 55 | #include "stm32f4xx_spi.h" 56 | #endif 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Exported macro ------------------------------------------------------------*/ 61 | /* Exported functions ------------------------------------------------------- */ 62 | 63 | void SpiInit( void ); 64 | void SPI_De_Init( void ); 65 | uint8_t SpiInOut( uint8_t outData ); 66 | 67 | #endif // USER_SPI_H_ 68 | 69 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /USER/usbd_cdc_vcp.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : Fox 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /** 14 | ****************************************************************************** 15 | * @file usbd_cdc_vcp.h 16 | * @author MCD Application Team 17 | * @version V1.2.0 18 | * @date 09-November-2015 19 | * @brief Header for usbd_cdc_vcp.c file. 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | *

© COPYRIGHT 2015 STMicroelectronics

24 | * 25 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 26 | * You may not use this file except in compliance with the License. 27 | * You may obtain a copy of the License at: 28 | * 29 | * http://www.st.com/software_license_agreement_liberty_v2 30 | * 31 | * Unless required by applicable law or agreed to in writing, software 32 | * distributed under the License is distributed on an "AS IS" BASIS, 33 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | * See the License for the specific language governing permissions and 35 | * limitations under the License. 36 | * 37 | ****************************************************************************** 38 | */ 39 | 40 | 41 | /* Define to prevent recursive inclusion -------------------------------------*/ 42 | #ifndef USER_USBD_CDC_VCP_H_ 43 | #define USER_USBD_CDC_VCP_H_ 44 | 45 | /* Includes ------------------------------------------------------------------*/ 46 | #include 47 | 48 | #include "usbd_cdc_core.h" 49 | #include "usbd_conf.h" 50 | 51 | 52 | /* Exported typef ------------------------------------------------------------*/ 53 | /* The following structures groups all needed parameters to be configured for the 54 | ComPort. These parameters can modified on the fly by the host through CDC class 55 | command class requests. */ 56 | typedef struct { 57 | uint32_t bitrate; 58 | uint8_t format; 59 | uint8_t paritytype; 60 | uint8_t datatype; 61 | } LINE_CODING; 62 | 63 | /* Exported constants --------------------------------------------------------*/ 64 | 65 | #define DEFAULT_CONFIG 0 66 | #define OTHER_CONFIG 1 67 | 68 | #define VCP_RX_BufLength 256 69 | 70 | 71 | /* Exported macro ------------------------------------------------------------*/ 72 | /* Exported functions ------------------------------------------------------- */ 73 | void VCP_EnvironmentVariableSet( void ); 74 | uint16_t VCP_DataTx ( uint8_t* Buf, uint32_t Len ); 75 | 76 | /* Exported variables ------------------------------------------------------------*/ 77 | extern CDC_IF_Prop_TypeDef VCP_fops; 78 | 79 | 80 | extern uint16_t VCP_count; 81 | extern uint16_t VCP_RX_Length; 82 | extern uint8_t VCP_RX_Buf1[VCP_RX_BufLength]; 83 | extern uint8_t VCP_RX_Buf2[VCP_RX_BufLength]; 84 | extern bool isVCP_RX_Buf1Full; 85 | extern bool isVCP_RX_Buf2Full; 86 | extern bool *isVCP_RX_BOOL; 87 | extern bool USBD_VCP_EchoOn; 88 | 89 | 90 | #endif // USER_USBD_CDC_VCP_H_ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *********/ 93 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /USER/uuid.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Includes ------------------------------------------------------------------*/ 14 | #include 15 | #ifdef STM32F072 16 | #include "stm32f0xx.h" 17 | #endif 18 | 19 | #ifdef STM32F401xx 20 | #include "stm32f4xx.h" 21 | #endif 22 | 23 | #include "flash.h" 24 | #include "uuid.h" 25 | 26 | /* Private typedef -----------------------------------------------------------*/ 27 | /* Private define ------------------------------------------------------------*/ 28 | /* Private macro -------------------------------------------------------------*/ 29 | /* Private function prototypes -----------------------------------------------*/ 30 | /* Private variables ---------------------------------------------------------*/ 31 | 32 | /*************************************************************************************************** 33 | * Function Name: UUID_Read 34 | * 35 | * Description: 36 | * Input : 37 | * Output: 38 | * Return: 39 | * Example : 40 | **************************************************************************************************/ 41 | void UUID_Read(uint32_t *UUID) 42 | { 43 | FLASH_ReadWord(UUID__FLASH_ADDR, UUID, 3); 44 | } 45 | 46 | /*************************************************************************************************** 47 | * Function Name: UUID_ReadLeast3Bytes 48 | * 49 | * Description: 50 | * Input : 51 | * Output: 52 | * Return: 53 | * Example : 54 | **************************************************************************************************/ 55 | void UUID_ReadLeast3Bytes(uint8_t *Data) 56 | { 57 | FLASH_ReadByte(UUID__FLASH_ADDR, Data, 3); 58 | } 59 | 60 | uint32_t MCU__Read_Device_ID( void ) 61 | { 62 | uint32_t id = 0; 63 | 64 | FLASH_ReadWord( MCU_DevID__FLASH_ADDR, & id, 1 ); 65 | return( id ); 66 | } 67 | 68 | 69 | uint16_t MCU__Merge_Option( uint32_t n ) 70 | { 71 | uint32_t t; 72 | 73 | t = n; 74 | t >>= 8; 75 | t &= 0xFF00; 76 | n &= 0x00FF; 77 | t |= n; 78 | return( t ); 79 | } 80 | 81 | uint32_t MCU__Read_Device_RDP( void ) 82 | { 83 | uint32_t rdp = 0; 84 | uint32_t wrp = 0; 85 | 86 | FLASH_ReadWord( MCU_RDP__FLASH_ADDR, & rdp, 1 ); 87 | #ifdef STM32F072 88 | wrp = rdp; 89 | rdp = MCU__Merge_Option( wrp ); 90 | #endif 91 | 92 | 93 | #ifdef STM32F401xx 94 | FLASH_ReadWord( MCU_WRP__FLASH_ADDR, & wrp, 1 ); 95 | if( wrp & 0x8000 ) { 96 | rdp |= 0x0001; 97 | } else { 98 | rdp &= 0xFFFE; 99 | } 100 | #endif 101 | 102 | return( rdp ); 103 | } 104 | 105 | uint32_t MCU__Read_Device_WRP( void ) 106 | { 107 | uint32_t wrp[2] = { 0 }; 108 | 109 | #ifdef STM32F401xx 110 | FLASH_ReadWord( MCU_WRP__FLASH_ADDR, wrp, 1 ); 111 | // wrp[0] &= 0x7FFF; 112 | return( wrp[0] ); 113 | #endif 114 | 115 | #ifdef STM32F072 116 | uint32_t r, t; 117 | 118 | FLASH_ReadWord( MCU_WRP__FLASH_ADDR, wrp, 2 ); 119 | t = MCU__Merge_Option( wrp[0] ); 120 | r = MCU__Merge_Option( wrp[1] ); 121 | r <<= 16; 122 | r |= t; 123 | return( r ); 124 | #endif 125 | } 126 | 127 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /USER/uuid.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ 15 | #ifndef USER_UUID_H_ 16 | #define USER_UUID_H_ 17 | 18 | /* Includes ------------------------------------------------------------------*/ 19 | #ifdef STM32F072 20 | #include "stm32f0xx.h" 21 | #endif 22 | 23 | #ifdef STM32F401xx 24 | #include "stm32f4xx.h" 25 | #endif 26 | 27 | /* Private define ------------------------------------------------------------*/ 28 | #ifdef STM32F072 29 | #define UUID__FLASH_ADDR ( (uint32_t) 0x1FFFF7AC ) 30 | #define MCU_DevID__FLASH_ADDR ( (uint32_t) 0x40015800 ) 31 | #define MCU_RDP__FLASH_ADDR ( (uint32_t) 0x1FFFF800 ) 32 | #define MCU_WRP__FLASH_ADDR ( (uint32_t) 0x1FFFF808 ) 33 | #endif 34 | #ifdef STM32F401xx 35 | #define UUID__FLASH_ADDR ( (uint32_t) 0x1FFF7A10 ) 36 | #define MCU_DevID__FLASH_ADDR ( (uint32_t) 0xE0042000 ) 37 | #define MCU_RDP__FLASH_ADDR ( (uint32_t) 0x1FFFC000 ) 38 | #define MCU_WRP__FLASH_ADDR ( (uint32_t) 0x1FFFC008 ) 39 | #endif 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /* Exported constants --------------------------------------------------------*/ 43 | /* Exported macro ------------------------------------------------------------*/ 44 | /* Exported functions ------------------------------------------------------- */ 45 | void UUID_Read(uint32_t *); 46 | void UUID_ReadLeast3Bytes(uint8_t *); 47 | 48 | uint32_t MCU__Read_Device_ID( void ); 49 | uint32_t MCU__Read_Device_RDP( void ); 50 | uint32_t MCU__Read_Device_WRP( void ); 51 | 52 | #endif // USER_UUID_H_ 53 | 54 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /USER/xor_crypto.c: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Includes ------------------------------------------------------------------*/ 14 | #include 15 | #include "xor_crypto.h" 16 | 17 | #ifdef STM32F072 18 | #include "stm32f0xx.h" 19 | #endif 20 | 21 | #ifdef STM32F401xx 22 | #include "stm32f4xx.h" 23 | #endif 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | /* Private macro -------------------------------------------------------------*/ 28 | /* Private variables ---------------------------------------------------------*/ 29 | /* Private function prototypes -----------------------------------------------*/ 30 | 31 | /*************************************************************************************************** 32 | * Function Name: XOR_Encryption 33 | * 34 | * Description: 35 | * Input : 36 | * Output: 37 | * Return: 38 | * Example : 39 | **************************************************************************************************/ 40 | void XOR_Encryption(uint8_t key, __IO uint8_t *data, uint16_t Length) 41 | { 42 | uint16_t count; 43 | 44 | for(count = 0 ; count < Length ; count++) data[count] ^= key; 45 | } 46 | 47 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /USER/xor_crypto.h: -------------------------------------------------------------------------------- 1 |  2 | //--------------------------------------------------------------------------- 3 | /* 4 | //========================================== 5 | // Author : JC 6 | // Copyright 2016(C) AcSiP Technology Inc. 7 | // 版權所有:群登科技股份有限公司 8 | // http://www.acsip.com.tw 9 | //========================================== 10 | */ 11 | //--------------------------------------------------------------------------- 12 | 13 | /* Define to prevent recursive inclusion -------------------------------------*/ 14 | #ifndef USER_XOR_CRYPTO_H_ 15 | #define USER_XOR_CRYPTO_H_ 16 | 17 | /* Includes ------------------------------------------------------------------*/ 18 | #ifdef STM32F072 19 | #include "stm32f0xx.h" 20 | #endif 21 | 22 | #ifdef STM32F401xx 23 | #include "stm32f4xx.h" 24 | #endif 25 | 26 | /* Exported types ------------------------------------------------------------*/ 27 | /* Exported constants --------------------------------------------------------*/ 28 | /* Exported macro ------------------------------------------------------------*/ 29 | /* Exported functions ------------------------------------------------------- */ 30 | void XOR_Encryption(uint8_t, __IO uint8_t *, uint16_t); 31 | 32 | #endif // USER_XOR_CRYPTO_H_ 33 | 34 | /************************ Copyright 2016(C) AcSiP Technology Inc. *****END OF FILE****/ 35 | --------------------------------------------------------------------------------