mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 05:58:13 +08:00
修改了Web后台的部分界面,增加了HAmqtt中的总电量传感器,后台新增mqtt上报频率设置
This commit is contained in:
71
mico-os/board/NUCLEO_F412ZG/NUCLEO_F412ZG.mk
Normal file
71
mico-os/board/NUCLEO_F412ZG/NUCLEO_F412ZG.mk
Normal file
@@ -0,0 +1,71 @@
|
||||
###############################################################################
|
||||
#
|
||||
# The MIT License
|
||||
# Copyright (c) 2016 MXCHIP Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is furnished
|
||||
# to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
# IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
###############################################################################
|
||||
|
||||
NAME := Board_NUCLEO_F412ZG
|
||||
|
||||
WLAN_CHIP := 43362
|
||||
WLAN_CHIP_REVISION := A2
|
||||
WLAN_CHIP_FAMILY := 43362
|
||||
WLAN_CHIP_FIRMWARE_VER := 5.90.230.15
|
||||
|
||||
MODULE := 1062
|
||||
HOST_MCU_FAMILY := STM32F4xx
|
||||
HOST_MCU_VARIANT := STM32F412
|
||||
HOST_MCU_PART_NUMBER := STM32F412ZGT6
|
||||
|
||||
JTAG := stlink-v2-1
|
||||
|
||||
ifndef BUS
|
||||
BUS := SPI
|
||||
endif
|
||||
|
||||
# Extra build target in mico_standard_targets.mk, include bootloader, and copy output file to eclipse debug file (copy_output_for_eclipse)
|
||||
EXTRA_TARGET_MAKEFILES += $(MAKEFILES_PATH)/mico_standard_targets.mk
|
||||
|
||||
# Global includes
|
||||
GLOBAL_INCLUDES := .
|
||||
|
||||
# Global defines
|
||||
# HSE_VALUE = STM32 crystal frequency = 26MHz (needed to make UART work correctly)
|
||||
|
||||
|
||||
GLOBAL_DEFINES += $$(if $$(NO_CRLF_STDIO_REPLACEMENT),,CRLF_STDIO_REPLACEMENT)
|
||||
GLOBAL_LDFLAGS += -L $(MICO_OS_PATH)/board/NUCLEO_F412ZG
|
||||
|
||||
# Components
|
||||
$(NAME)_COMPONENTS += drivers/spi_flash
|
||||
$(NAME)_COMPONENTS += drivers/MiCOKit_STmems
|
||||
|
||||
# Source files
|
||||
$(NAME)_SOURCES := platform.c
|
||||
|
||||
SHARED_WIFI_SPI_BUS := YES
|
||||
|
||||
ifndef NO_WIFI_FIRMWARE
|
||||
WIFI_FIRMWARE := $(MICO_OS_PATH)/resources/wifi_firmware/$(WLAN_CHIP)/$(WLAN_CHIP)$(WLAN_CHIP_REVISION)$(WLAN_CHIP_BIN_TYPE)-$(WLAN_CHIP_FIRMWARE_VER).bin
|
||||
endif
|
||||
|
||||
WIFI_FIRMWARE_SECTOR_START := 2 #0x2000
|
||||
FILESYSTEM_IMAGE_SECTOR_START := 256 #0x100000
|
||||
|
||||
|
||||
39
mico-os/board/NUCLEO_F412ZG/bootloaderLinkerForIAR.icf
Normal file
39
mico-os/board/NUCLEO_F412ZG/bootloaderLinkerForIAR.icf
Normal file
@@ -0,0 +1,39 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20040000;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x100;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
define symbol RAM_intvec_start = 0x20000000;
|
||||
|
||||
initialize by copy { readonly, readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
"RAM_intvec_start":
|
||||
place at address mem:RAM_intvec_start { section .intvec_RAM };
|
||||
|
||||
"ROM_region":
|
||||
place in ROM_region { readonly };
|
||||
|
||||
"RAM_region":
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block HEAP };
|
||||
BIN
mico-os/board/NUCLEO_F412ZG/flash_prog.elf
Normal file
BIN
mico-os/board/NUCLEO_F412ZG/flash_prog.elf
Normal file
Binary file not shown.
45
mico-os/board/NUCLEO_F412ZG/gen_standard_images.mk
Normal file
45
mico-os/board/NUCLEO_F412ZG/gen_standard_images.mk
Normal file
@@ -0,0 +1,45 @@
|
||||
###############################################################################
|
||||
#
|
||||
# The MIT License
|
||||
# Copyright (c) 2016 MXCHIP Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is furnished
|
||||
# to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
# IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
###############################################################################
|
||||
|
||||
EXTRA_POST_BUILD_TARGETS += gen_standard_images
|
||||
|
||||
#bootloader
|
||||
BOOT_BIN_FILE := $(BOOTLOADER_OUTFILE_BIN)
|
||||
BOOT_OFFSET := 0x0
|
||||
|
||||
#application
|
||||
APP_BIN_FILE :=$(BIN_OUTPUT_FILE)
|
||||
APP_OFFSET:= 0xC000
|
||||
|
||||
#wifi firmware
|
||||
|
||||
# Required to build Full binary file
|
||||
GEN_COMMON_BIN_OUTPUT_FILE_SCRIPT:= $(SCRIPTS_PATH)/gen_common_bin_output_file.py
|
||||
|
||||
MOC_ALL_BIN_OUTPUT_FILE :=$(LINK_OUTPUT_FILE:$(LINK_OUTPUT_SUFFIX)=.all$(BIN_OUTPUT_SUFFIX))
|
||||
|
||||
gen_standard_images: build_done
|
||||
$(QUIET)$(ECHO) Generate Standard Flash Images: $(MOC_ALL_BIN_OUTPUT_FILE)
|
||||
$(QUIET)$(RM) $(MOC_ALL_BIN_OUTPUT_FILE)
|
||||
$(PYTHON) $(GEN_COMMON_BIN_OUTPUT_FILE_SCRIPT) -o $(MOC_ALL_BIN_OUTPUT_FILE) -f $(BOOT_OFFSET) $(BOOT_BIN_FILE)
|
||||
$(PYTHON) $(GEN_COMMON_BIN_OUTPUT_FILE_SCRIPT) -o $(MOC_ALL_BIN_OUTPUT_FILE) -f $(APP_OFFSET) $(APP_BIN_FILE)
|
||||
31
mico-os/board/NUCLEO_F412ZG/memory.ld
Normal file
31
mico-os/board/NUCLEO_F412ZG/memory.ld
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
|
||||
APP_FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 900k
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
30
mico-os/board/NUCLEO_F412ZG/micoLinkerForIAR.icf
Normal file
30
mico-os/board/NUCLEO_F412ZG/micoLinkerForIAR.icf
Normal file
@@ -0,0 +1,30 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x0800C000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x0800C000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2003FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x15000;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block HEAP };
|
||||
582
mico-os/board/NUCLEO_F412ZG/platform.c
Normal file
582
mico-os/board/NUCLEO_F412ZG/platform.c
Normal file
@@ -0,0 +1,582 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals mapping table and platform
|
||||
* specific functions.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "mico_platform.h"
|
||||
#include "platform.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_peripheral.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_logging.h"
|
||||
#include "spi_flash_platform_interface.h"
|
||||
#include "wlan_platform_common.h"
|
||||
#include "CheckSumUtils.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
#ifdef USE_MiCOKit_STMEMS
|
||||
#include "MiCOKit_STmems/MiCOKit_STmems.h"
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
extern WEAK void bootloader_start(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
|
||||
/* This table maps STM32 pins to GPIO definitions on the schematic*/
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* Common GPIOs for internal use */
|
||||
[MICO_SYS_LED] = { GPIOB, 7 }, //PASS,BLUE LD2
|
||||
[MICO_RF_LED] = { GPIOB, 14 },//PASS,RED LD3
|
||||
[BOOT_SEL] = { GPIOE, 11 },//PASS,Arduino_D5 KEY1
|
||||
[MFG_SEL] = { GPIOE, 9 }, //PASS,Arduino_D6 KEY2
|
||||
[EasyLink_BUTTON] = { GPIOC, 13 }, //PASS,USER BUTTON BLUE
|
||||
|
||||
/* GPIOs for external use */
|
||||
[MICO_GPIO_1] = { GPIOG, 9 },//PASS,Arduino_D0,Arduino_RXD,USART6_RX,USER_UART,Arduino_UART
|
||||
[MICO_GPIO_2] = { GPIOG, 14 },//PASS,Arduino_D1,Arduino_TXD,USART6_TX,USER_UART,Arduino_UART
|
||||
[MICO_GPIO_3] = { GPIOF, 15 },//PASS,Arduino_D2,MIC MP34DT01 sensor
|
||||
[MICO_GPIO_4] = { GPIOE, 13 },//PASS,Arduino_D3,MIC MP34DT01 sensor
|
||||
[MICO_GPIO_5] = { GPIOF, 14 },//PASS,Arduino_D4,MIC MP34DT01 sensor
|
||||
[MICO_GPIO_6] = { GPIOE, 11 },//PASS,Arduino_D5,Arduino_D5 KEY1
|
||||
[MICO_GPIO_7] = { GPIOE, 9 },//PASS,Arduino_D6,Arduino_D6 KEY2
|
||||
[MICO_GPIO_8] = { GPIOF, 13 },//PASS,Arduino_D7,FLASH SPI_SCS
|
||||
|
||||
[MICO_GPIO_9] = { GPIOF, 12 },//PASS,Arduino_D8,STmems RGB LED sensor SDA
|
||||
[MICO_GPIO_10] = { GPIOD, 15 },//PASS,Arduino_D9,STmems RGB LED sensor SCL
|
||||
[MICO_GPIO_11] = { GPIOD, 14 },//PASS,Arduino_D10,Arduino_CS,WIFI SPI_SCS
|
||||
[MICO_GPIO_12] = { GPIOA, 7 },//PASS,or PB5//PASS,Arduino_D11,Arduino_SI,WIFI&FLASH SPI_MOSI,SPI1
|
||||
[MICO_GPIO_13] = { GPIOA, 6 },//PASS,Arduino_D12,Arduino_SO,WIFI&FLASH SPI_MISO
|
||||
[MICO_GPIO_14] = { GPIOA, 5 },//PASS,Arduino_D13,Arduino_SCK,WIFI&FLASH SPI_SCK
|
||||
[MICO_GPIO_15] = { GPIOB, 9 },//PASS,Arduino_D14,Arduino_SDA,STmems OLED
|
||||
//STmems Temperature & humidity sensor,STmems Pressure Sensor
|
||||
//STmems UV Index Sensor,Motion Sensor,IIC1
|
||||
[MICO_GPIO_16] = { GPIOB, 8 },//PASS,Arduino_D15,Arduino_SCL,STmems OLED
|
||||
//STmems Temperature & humidity sensor,STmems Pressure Sensor
|
||||
//STmems UV Index Sensor,Motion Sensor
|
||||
|
||||
[MICO_GPIO_17] = { GPIOA, 3 },//PASS,Arduino_A0,WIFI RESET
|
||||
[MICO_GPIO_18] = { GPIOC, 0 },//PASS,Arduino_A1,WIFI SPI_IRQ
|
||||
[MICO_GPIO_19] = { GPIOC, 3 },//PASS,Arduino_A2,STmems Light sensor,ADC
|
||||
[MICO_GPIO_21] = { GPIOC, 1 },//PASS,Arduino_A3,STmems DC Motor sensor,DAC
|
||||
[MICO_GPIO_20] = { GPIOC, 4 },//PASS,Arduino_A4,WIFI WAKEIN
|
||||
[MICO_GPIO_22] = { GPIOC, 5 },//PASS,Arduino_A5,WIFI WAKEOUT
|
||||
|
||||
[MICO_USART3_RX] = { GPIOD, 9 },//PASS,STDIO_UART_RX,USART3_RX,Nucleo STLK_RX
|
||||
[MICO_USART3_TX] = { GPIOD, 8 },//PASS,STDIO_UART_TX,USART3_TX,Nucleo STLK_TX
|
||||
[MICO_USART_NBIOT_TX] = { GPIOA, 9 },
|
||||
[MICO_USART_NBIOT_RX] = { GPIOA, 10},
|
||||
[MICO_USART_NBIOT_RTS] = { GPIOA, 12},
|
||||
[MICO_USART_NBIOT_CTS] = { GPIOA, 11},
|
||||
[MICO_GPIO_POWER] = { GPIOD, 2 },
|
||||
[MICO_GPIO_GPRS_START] = { GPIOB, 5 },
|
||||
[MICO_GPIO_GPRS_RST] = { GPIOA, 8 },
|
||||
[MICO_GPIO_GPRS_WAKEUP] = { GPIOA, 1 },
|
||||
};
|
||||
|
||||
const platform_pwm_t *platform_pwm_peripherals = NULL;
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.port = I2C1,
|
||||
.pin_scl = &platform_gpio_pins[MICO_GPIO_16],
|
||||
.pin_sda = &platform_gpio_pins[MICO_GPIO_15],
|
||||
.peripheral_clock_reg = RCC_APB1Periph_I2C1,
|
||||
.tx_dma = DMA1,
|
||||
.tx_dma_peripheral_clock = RCC_AHB1Periph_DMA1,
|
||||
.tx_dma_stream = DMA1_Stream7,//6
|
||||
.rx_dma_stream = DMA1_Stream0,//0
|
||||
.tx_dma_stream_id = 7,
|
||||
.rx_dma_stream_id = 0,
|
||||
.tx_dma_channel = DMA_Channel_1,
|
||||
.rx_dma_channel = DMA_Channel_1,
|
||||
.gpio_af_scl = GPIO_AF_I2C1,
|
||||
.gpio_af_sda = GPIO_AF_I2C1
|
||||
},
|
||||
};
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.port = USART3,
|
||||
.pin_tx = &platform_gpio_pins[MICO_USART3_TX],
|
||||
.pin_rx = &platform_gpio_pins[MICO_USART3_RX],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream4,
|
||||
.channel = DMA_Channel_7,
|
||||
.irq_vector = DMA1_Stream4_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF4,
|
||||
.error_flags = ( DMA_HISR_TEIF4 | DMA_HISR_FEIF4 | DMA_HISR_DMEIF4 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA1,
|
||||
.stream = DMA1_Stream1,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA1_Stream1_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF1,
|
||||
.error_flags = ( DMA_LISR_TEIF1 | DMA_LISR_FEIF1 | DMA_LISR_DMEIF1 ),
|
||||
},
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.port = USART6,
|
||||
.pin_tx = &platform_gpio_pins[MICO_GPIO_2],
|
||||
.pin_rx = &platform_gpio_pins[MICO_GPIO_1],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream6,
|
||||
.channel = DMA_Channel_5,
|
||||
.irq_vector = DMA2_Stream6_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF6,
|
||||
.error_flags = ( DMA_HISR_TEIF6 | DMA_HISR_FEIF6 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream1,
|
||||
.channel = DMA_Channel_5,
|
||||
.irq_vector = DMA2_Stream1_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF1,
|
||||
.error_flags = ( DMA_LISR_TEIF1 | DMA_LISR_FEIF1 | DMA_LISR_DMEIF1 ),
|
||||
},
|
||||
},
|
||||
[MICO_UART_3] =
|
||||
{
|
||||
.port = USART1,
|
||||
.pin_tx = &platform_gpio_pins[MICO_USART_NBIOT_TX],
|
||||
.pin_rx = &platform_gpio_pins[MICO_USART_NBIOT_RX],
|
||||
.pin_cts = NULL,
|
||||
.pin_rts = NULL,
|
||||
.tx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream7,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream7_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF7,
|
||||
.error_flags = ( DMA_HISR_TEIF7 | DMA_HISR_FEIF7 ),
|
||||
},
|
||||
.rx_dma_config =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream5,
|
||||
.channel = DMA_Channel_4,
|
||||
.irq_vector = DMA2_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 | DMA_HISR_DMEIF5 ),
|
||||
},
|
||||
},
|
||||
};
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
const platform_spi_t platform_spi_peripherals[] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.port = SPI1,
|
||||
.gpio_af = GPIO_AF_SPI1,
|
||||
.peripheral_clock_reg = RCC_APB2Periph_SPI1,
|
||||
.peripheral_clock_func = RCC_APB2PeriphClockCmd,
|
||||
.pin_mosi = &platform_gpio_pins[MICO_GPIO_12],
|
||||
.pin_miso = &platform_gpio_pins[MICO_GPIO_13],
|
||||
.pin_clock = &platform_gpio_pins[MICO_GPIO_14],
|
||||
.tx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream5,
|
||||
.channel = DMA_Channel_3,
|
||||
.irq_vector = DMA2_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 ),
|
||||
},
|
||||
.rx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream2,
|
||||
.channel = DMA_Channel_3,
|
||||
.irq_vector = DMA2_Stream2_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF2,
|
||||
.error_flags = ( DMA_LISR_TEIF2 | DMA_LISR_FEIF2 | DMA_LISR_DMEIF2 ),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_EMBEDDED] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_EMBEDDED,
|
||||
.flash_start_addr = 0x08000000,
|
||||
.flash_length = 0x100000, //1MBytes
|
||||
},
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x000000,
|
||||
.flash_length = 0x200000, //2M
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
/* Logic partition on flash devices */
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[MICO_PARTITION_BOOTLOADER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Bootloader",
|
||||
.partition_start_addr = 0x08000000,
|
||||
.partition_length = 0x8000, //32k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_APPLICATION] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_EMBEDDED,
|
||||
.partition_description = "Application",
|
||||
.partition_start_addr = 0x0800C000,
|
||||
.partition_length = 0xE1000, //900k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_ATE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
},
|
||||
[MICO_PARTITION_RF_FIRMWARE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "RF Firmware",
|
||||
.partition_start_addr = 0x2000,
|
||||
.partition_length = 0x3E000, //248k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS,
|
||||
},
|
||||
[MICO_PARTITION_OTA_TEMP] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "OTA Storage",
|
||||
.partition_start_addr = 0x40000,
|
||||
.partition_length = 0x70000, //448k bytes B0000
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x0,
|
||||
.partition_length = 0x1000, // 4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_PARAMETER_2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER2",
|
||||
.partition_start_addr = 0x1000,
|
||||
.partition_length = 0x1000, //4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[MICO_PARTITION_FILESYS] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "FILESYS",
|
||||
.partition_start_addr = 0x100000,
|
||||
.partition_length = 0x100000, //1M bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined ( USE_MICO_SPI_FLASH )
|
||||
const mico_spi_device_t mico_spi_flash =
|
||||
{
|
||||
.port = MICO_SPI_1,
|
||||
.chip_select = MICO_GPIO_8, //arduino D7
|
||||
.speed = 40000000,
|
||||
.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_HIGH | SPI_USE_DMA | SPI_MSB_FIRST ),
|
||||
.bits = 8
|
||||
};
|
||||
#endif
|
||||
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[MICO_ADC_1] = { ADC1, ADC_Channel_11, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_21] },//PC1
|
||||
[MICO_ADC_2] = { ADC1, ADC_Channel_13, RCC_APB2Periph_ADC1, 1, (platform_gpio_t*)&platform_gpio_pins[MICO_GPIO_19] },//PC3
|
||||
};
|
||||
|
||||
/* Wi-Fi control pins. Used by platform/MCU/wlan_platform_common.c
|
||||
* SDIO: EMW1062_PIN_BOOTSTRAP[1:0] = b'00
|
||||
* gSPI: EMW1062_PIN_BOOTSTRAP[1:0] = b'01
|
||||
*/
|
||||
const platform_gpio_t wifi_control_pins[] =
|
||||
{
|
||||
[WIFI_PIN_RESET ] = { GPIOA, 3 },
|
||||
[WIFI_PIN_32K_CLK] = { GPIOF, 5 },
|
||||
};
|
||||
|
||||
/* Wi-Fi gSPI bus pins. Used by platform/MCU/STM32F2xx/EMW1062_driver/wlan_spi.c */
|
||||
const platform_gpio_t wifi_spi_pins[] =
|
||||
{
|
||||
[WIFI_PIN_SPI_IRQ ] = { GPIOC, 0 },
|
||||
[WIFI_PIN_SPI_CS ] = { GPIOD, 14 },
|
||||
[WIFI_PIN_SPI_CLK ] = { GPIOA, 5 },
|
||||
[WIFI_PIN_SPI_MOSI] = { GPIOA, 7 },
|
||||
[WIFI_PIN_SPI_MISO] = { GPIOA, 6 },
|
||||
};
|
||||
|
||||
const platform_spi_t wifi_spi =
|
||||
{
|
||||
.port = SPI1,
|
||||
.gpio_af = GPIO_AF_SPI1,
|
||||
.peripheral_clock_reg = RCC_APB2Periph_SPI1,
|
||||
.peripheral_clock_func = RCC_APB2PeriphClockCmd,
|
||||
.pin_mosi = &wifi_spi_pins[WIFI_PIN_SPI_MOSI],
|
||||
.pin_miso = &wifi_spi_pins[WIFI_PIN_SPI_MISO],
|
||||
.pin_clock = &wifi_spi_pins[WIFI_PIN_SPI_CLK],
|
||||
.tx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream5,
|
||||
.channel = DMA_Channel_3,
|
||||
.irq_vector = DMA2_Stream5_IRQn,
|
||||
.complete_flags = DMA_HISR_TCIF5,
|
||||
.error_flags = ( DMA_HISR_TEIF5 | DMA_HISR_FEIF5 ),
|
||||
},
|
||||
.rx_dma =
|
||||
{
|
||||
.controller = DMA2,
|
||||
.stream = DMA2_Stream2,
|
||||
.channel = DMA_Channel_3,
|
||||
.irq_vector = DMA2_Stream2_IRQn,
|
||||
.complete_flags = DMA_LISR_TCIF2,
|
||||
.error_flags = ( DMA_LISR_TEIF2 | DMA_LISR_FEIF2 | DMA_LISR_DMEIF2 ),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
#if defined (MICO_WIFI_SHARE_SPI_BUS) || !defined (MICO_NO_WIFI)
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream2_IRQHandler )
|
||||
{
|
||||
platform_wifi_spi_rx_dma_irq( );
|
||||
}
|
||||
#endif
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( USART6_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( USART3_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( USART1_IRQHandler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_3] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream4_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream6_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream7_IRQHandler )
|
||||
{
|
||||
platform_uart_tx_dma_irq( &platform_uart_drivers[MICO_UART_3] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA1_Stream1_IRQHandler )
|
||||
{
|
||||
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream1_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( DMA2_Stream5_IRQHandler )
|
||||
{
|
||||
platform_uart_rx_dma_irq( &platform_uart_drivers[MICO_UART_3] );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
/* Interrupt priority setup. Called by MiCO/platform/MCU/STM32F2xx/platform_init.c */
|
||||
NVIC_SetPriority( RTC_WKUP_IRQn , 1 ); /* RTC Wake-up event */
|
||||
NVIC_SetPriority( SDIO_IRQn , 2 ); /* WLAN SDIO */
|
||||
NVIC_SetPriority( DMA2_Stream2_IRQn, 3 ); /* WLAN SPI DMA */
|
||||
NVIC_SetPriority( USART3_IRQn , 6 ); /* MICO_UART_1 */
|
||||
NVIC_SetPriority( USART6_IRQn , 6 ); /* MICO_UART_2 */
|
||||
NVIC_SetPriority( USART1_IRQn , 6 ); /* MICO_UART_3 */
|
||||
NVIC_SetPriority( DMA1_Stream4_IRQn, 7 ); /* MICO_UART_1 TX DMA */
|
||||
NVIC_SetPriority( DMA1_Stream1_IRQn, 7 ); /* MICO_UART_1 RX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream6_IRQn, 7 ); /* MICO_UART_2 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream1_IRQn, 7 ); /* MICO_UART_2 RX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream7_IRQn, 7 ); /* MICO_UART_3 TX DMA */
|
||||
NVIC_SetPriority( DMA2_Stream5_IRQn, 7 ); /* MICO_UART_3 RX DMA */
|
||||
NVIC_SetPriority( EXTI0_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI1_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI2_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI3_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI4_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI9_5_IRQn , 14 ); /* GPIO */
|
||||
NVIC_SetPriority( EXTI15_10_IRQn , 14 ); /* GPIO */
|
||||
}
|
||||
|
||||
void init_platform( void )
|
||||
{
|
||||
button_init_t init;
|
||||
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_PULL_UP);
|
||||
|
||||
//Initialise EasyLink buttons
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = RestoreDefault_TimeOut;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
|
||||
}
|
||||
|
||||
//#ifdef BOOTLOADER
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
MicoGpioInitialize( (mico_gpio_t)MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
MicoGpioInitialize((mico_gpio_t)BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize((mico_gpio_t)MFG_SEL, INPUT_PULL_UP);
|
||||
}
|
||||
|
||||
//#endif
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
}
|
||||
}
|
||||
|
||||
void MicoRfLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_RF_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
}
|
||||
}
|
||||
|
||||
bool MicoShouldEnterMFGMode(void)
|
||||
{
|
||||
// if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==false)
|
||||
// return true;
|
||||
// else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MicoShouldEnterBootloader(void)
|
||||
{
|
||||
// if(MicoGpioInputGet((mico_gpio_t)BOOT_SEL)==false && MicoGpioInputGet((mico_gpio_t)MFG_SEL)==true)
|
||||
// return true;
|
||||
// else
|
||||
return false;
|
||||
}
|
||||
|
||||
219
mico-os/board/NUCLEO_F412ZG/platform.h
Normal file
219
mico-os/board/NUCLEO_F412ZG/platform.h
Normal file
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides all MICO Peripherals defined for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PLATFORM_H_
|
||||
#define __PLATFORM_H_
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SYS_LED,
|
||||
MICO_RF_LED,
|
||||
BOOT_SEL,
|
||||
MFG_SEL,
|
||||
EasyLink_BUTTON,
|
||||
|
||||
MICO_GPIO_1,
|
||||
MICO_GPIO_2,
|
||||
MICO_GPIO_3,
|
||||
MICO_GPIO_4,
|
||||
MICO_GPIO_5,
|
||||
MICO_GPIO_6,
|
||||
MICO_GPIO_7,
|
||||
MICO_GPIO_8,
|
||||
|
||||
MICO_GPIO_9,
|
||||
MICO_GPIO_10,
|
||||
MICO_GPIO_11,
|
||||
MICO_GPIO_12,
|
||||
MICO_GPIO_13,
|
||||
MICO_GPIO_14,
|
||||
MICO_GPIO_15,
|
||||
MICO_GPIO_16,
|
||||
MICO_GPIO_17,
|
||||
MICO_GPIO_18,
|
||||
MICO_GPIO_19,
|
||||
MICO_GPIO_20,
|
||||
MICO_GPIO_21,
|
||||
MICO_GPIO_22,
|
||||
MICO_USART3_RX,
|
||||
MICO_USART3_TX,
|
||||
MICO_USART_NBIOT_TX,
|
||||
MICO_USART_NBIOT_RX,
|
||||
MICO_USART_NBIOT_RTS,
|
||||
MICO_USART_NBIOT_CTS,
|
||||
MICO_GPIO_POWER,
|
||||
MICO_GPIO_GPRS_RST,
|
||||
MICO_GPIO_GPRS_START,
|
||||
MICO_GPIO_GPRS_WAKEUP,
|
||||
MICO_GPIO_MAX, /* Denotes the total number of GPIO port aliases. Not a valid GPIO alias */
|
||||
MICO_GPIO_NONE,
|
||||
} mico_gpio_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_SPI_1,
|
||||
MICO_SPI_MAX, /* Denotes the total number of SPI port aliases. Not a valid SPI alias */
|
||||
MICO_SPI_NONE,
|
||||
} mico_spi_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_I2C_1,
|
||||
MICO_I2C_MAX, /* Denotes the total number of I2C port aliases. Not a valid I2C alias */
|
||||
MICO_I2C_NONE,
|
||||
} mico_i2c_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_IIS_MAX, /* Denotes the total number of IIS port aliases. Not a valid IIS alias */
|
||||
MICO_IIS_NONE,
|
||||
} mico_iis_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PWM_MAX, /* Denotes the total number of PWM port aliases. Not a valid PWM alias */
|
||||
MICO_PWM_NONE,
|
||||
} mico_pwm_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_ADC_1, /* F412 only one ADC 0-15 channel */
|
||||
MICO_ADC_2,
|
||||
MICO_ADC_MAX, /* Denotes the total number of ADC port aliases. Not a valid ADC alias */
|
||||
MICO_ADC_NONE,
|
||||
} mico_adc_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_UART_1,
|
||||
MICO_UART_2,
|
||||
MICO_UART_3,
|
||||
MICO_UART_4,
|
||||
MICO_UART_5,
|
||||
MICO_UART_MAX, /* Denotes the total number of UART port aliases. Not a valid UART alias */
|
||||
MICO_UART_NONE,
|
||||
} mico_uart_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_FLASH_EMBEDDED,
|
||||
MICO_FLASH_SPI,
|
||||
MICO_FLASH_MAX,
|
||||
MICO_FLASH_NONE,
|
||||
} mico_flash_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_PARTITION_FILESYS,
|
||||
MICO_PARTITION_USER_MAX
|
||||
} mico_user_partition_t;
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define STDIO_UART (MICO_UART_1)
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#else
|
||||
#define STDIO_UART (MICO_UART_1)
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
#endif
|
||||
|
||||
#define UART_FOR_APP (MICO_UART_2)
|
||||
#define UART_FOR_NBIOT (MICO_UART_3)
|
||||
#define MFG_TEST (MICO_UART_1)
|
||||
#define CLI_UART (MICO_UART_1)
|
||||
|
||||
/* Components connected to external I/Os*/
|
||||
#define USE_MICO_SPI_FLASH
|
||||
//#define SFLASH_SUPPORT_MACRONIX_PARTS
|
||||
//#define SFLASH_SUPPORT_SST_PARTS
|
||||
#define SFLASH_SUPPORT_WINBOND_PARTS
|
||||
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_1)
|
||||
#define Arduino_TXD (MICO_GPIO_2)
|
||||
#define Arduino_D2 (MICO_GPIO_3)
|
||||
#define Arduino_D3 (MICO_GPIO_4)
|
||||
#define Arduino_D4 (MICO_GPIO_5)
|
||||
#define Arduino_D5 (MICO_GPIO_6)
|
||||
#define Arduino_D6 (MICO_GPIO_7)
|
||||
#define Arduino_D7 (MICO_GPIO_8)
|
||||
#define Arduino_D8 (MICO_GPIO_9) //P9813_PIN_DIN
|
||||
#define Arduino_D9 (MICO_GPIO_10) //P9813_PIN_CIN
|
||||
|
||||
#define Arduino_CS (MICO_GPIO_11)
|
||||
#define Arduino_SI (MICO_GPIO_12)
|
||||
#define Arduino_SO (MICO_GPIO_13)
|
||||
#define Arduino_SCK (MICO_GPIO_14)
|
||||
|
||||
#define Arduino_SDA (MICO_GPIO_15)
|
||||
#define Arduino_SCL (MICO_GPIO_16)
|
||||
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_2) //light sensor.
|
||||
#define Arduino_A3 (MICO_ADC_1) //dc_motor
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
|
||||
#define Arduino_I2C (MICO_I2C_1)
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#define USE_MiCOKit_STMEMS
|
||||
#define SSD1106_USE_I2C //Control oled by I2C mode.
|
||||
#define NUCLEO_F412ZG_EASYLINK_BUTTON //To decide EasylinkButton's input mode.
|
||||
|
||||
#ifdef USE_MiCOKit_STMEMS
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "MiCOKit_STmems/MiCOKit_STmems_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_STMEMS
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
150
mico-os/board/NUCLEO_F412ZG/platform_config.h
Normal file
150
mico-os/board/NUCLEO_F412ZG/platform_config.h
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform_config.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-May-2014
|
||||
* @brief This file provides common configuration for current platform.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2014 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "1.0"
|
||||
#define DEFAULT_NAME "NUCLEO"
|
||||
#define MODEL "NUCLEO-F412ZG"
|
||||
|
||||
|
||||
/* MICO RTOS tick rate in Hz */
|
||||
#define MICO_DEFAULT_TICK_RATE_HZ (1000) //RTOS閺冨爼妫块悧锟<E682A7> 1ms
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable watchdog. For debugging only */
|
||||
//#define MICO_DISABLE_WATCHDOG
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable standard IO, i.e. printf(), etc. */
|
||||
//#define MICO_DISABLE_STDIO
|
||||
|
||||
/************************************************************************
|
||||
* Enable press space go to boot */
|
||||
#define MICO_ENABLE_STDIO_TO_BOOT
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable MCU powersave API functions */
|
||||
//#define MICO_DISABLE_MCU_POWERSAVE
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to enable MCU real time clock */
|
||||
#define MICO_ENABLE_MCU_RTC
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define RestoreDefault_TimeOut (3000)
|
||||
|
||||
/************************************************************************
|
||||
* CPU clock 100MHZ*/
|
||||
#define MCU_CLOCK_HZ (100000000)
|
||||
|
||||
/************************************************************************
|
||||
* How many bits are used in NVIC priority configuration */
|
||||
#define CORTEX_NVIC_PRIO_BITS (4)
|
||||
|
||||
/************************************************************************
|
||||
* Enable write protection to write-disabled embedded flash sectors */
|
||||
//#define MCU_EBANLE_FLASH_PROTECT
|
||||
|
||||
#define HSE_SOURCE RCC_HSE_OFF /* Use internal crystal */
|
||||
#define AHB_CLOCK_DIVIDER RCC_SYSCLK_Div1 /* AHB clock = System clock */
|
||||
#define APB1_CLOCK_DIVIDER RCC_HCLK_Div2 /* APB1 clock = AHB clock / 2 */
|
||||
#define APB2_CLOCK_DIVIDER RCC_HCLK_Div1 /* APB2 clock = AHB clock / 1 */
|
||||
#define PLL_SOURCE RCC_PLLSource_HSI /* PLL source = external crystal */
|
||||
#define PLL_M_CONSTANT 16 /* PLLM = 16 */
|
||||
#define PLL_N_CONSTANT 400 /* PLLN = 400 */
|
||||
#define PLL_P_CONSTANT 4 /* PLLP = 4 */
|
||||
#define PPL_Q_CONSTANT 7 /* PLLQ = 7 */
|
||||
#define PPL_R_CONSTANT 2 /* PLLR = 2 */
|
||||
#define SYSTEM_CLOCK_SOURCE RCC_SYSCLKSource_PLLCLK /* System clock source = PLL clock */
|
||||
#define SYSTICK_CLOCK_SOURCE SysTick_CLKSource_HCLK /* SysTick clock source = AHB clock */
|
||||
#define INT_FLASH_WAIT_STATE FLASH_Latency_3 /* Internal flash wait state = 3 cycles */
|
||||
#define PWR_WakeUp_Pin PWR_WakeUp_Pin2 /* PWR_Wake_Up_Pin */
|
||||
|
||||
/******************************************************
|
||||
* EMW1062 Options
|
||||
******************************************************/
|
||||
/* Wi-Fi chip module */
|
||||
#define EMW1062
|
||||
|
||||
/* WiFi driver use gSPI mode, and share spi bus with other devices by different /cs pins */
|
||||
#define MICO_WIFI_SHARE_SPI_BUS
|
||||
|
||||
/* GPIO pins are used to bootstrap Wi-Fi to SDIO or gSPI mode */
|
||||
//#define MICO_WIFI_USE_GPIO_FOR_BOOTSTRAP
|
||||
|
||||
/* Wi-Fi GPIO0 pin is used for out-of-band interrupt */
|
||||
#define MICO_WIFI_OOB_IRQ_GPIO_PIN ( 0 )
|
||||
|
||||
/* Wi-Fi power pin is present */
|
||||
//#define MICO_USE_WIFI_POWER_PIN
|
||||
|
||||
/* Wi-Fi reset pin is present */
|
||||
#define MICO_USE_WIFI_RESET_PIN
|
||||
|
||||
/* Wi-Fi 32K pin is present */
|
||||
#define MICO_USE_WIFI_32K_PIN //WiFi濡<E6BFA1>虫健閺冨爼鎸撻悽鍗烆樆闁劍褰佹笟锟<E7AC9F>
|
||||
|
||||
/* USE SDIO 1bit mode. */
|
||||
//#define SDIO_1_BIT
|
||||
|
||||
/* Wi-Fi power pin is active high */
|
||||
//#define MICO_USE_WIFI_POWER_PIN_ACTIVE_HIGH
|
||||
|
||||
/* WLAN Powersave Clock Source
|
||||
* The WLAN sleep clock can be driven from one of two sources:
|
||||
* 1. MCO (MCU Clock Output) - default
|
||||
* 2. WLAN 32K internal oscillator (30% inaccuracy)
|
||||
*/
|
||||
//#define MICO_USE_WIFI_32K_CLOCK_MCO
|
||||
|
||||
//#define MICO_USE_BUILTIN_RF_DRIVER //鐞涖劎銇氶悽銊ュ敶闁劍鏆熼幑顕嗙礉閼板奔绗夐弰顖氼樆闁劎娈慠F driver
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user