mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 22:18:14 +08:00
修改了Web后台的部分界面,增加了HAmqtt中的总电量传感器,后台新增mqtt上报频率设置
This commit is contained in:
60
mico-os/board/MKG55/MKG55.mk
Normal file
60
mico-os/board/MKG55/MKG55.mk
Normal file
@@ -0,0 +1,60 @@
|
||||
###############################################################################
|
||||
#
|
||||
# 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_MKG55
|
||||
|
||||
WLAN_CHIP := 43362
|
||||
WLAN_CHIP_REVISION := A2
|
||||
WLAN_CHIP_FAMILY := 43362
|
||||
WLAN_CHIP_FIRMWARE_VER := 5.90.230.12
|
||||
|
||||
MODULE := 1062
|
||||
HOST_MCU_FAMILY := ATSAMG55
|
||||
HOST_MCU_VARIANT := ATSAMG55
|
||||
HOST_MCU_PART_NUMBER := ATSAMG55
|
||||
|
||||
BUS := SPI
|
||||
|
||||
# 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/MKG55
|
||||
|
||||
# Components
|
||||
$(NAME)_COMPONENTS += drivers/keypad/gpio_button
|
||||
$(NAME)_COMPONENTS += drivers/MiCOKit_EXT
|
||||
$(NAME)_COMPONENTS += drivers/spi_flash
|
||||
|
||||
# Source files
|
||||
$(NAME)_SOURCES := platform.c
|
||||
|
||||
WIFI_FIRMWARE := $(MICO_OS_PATH)/resources/wifi_firmware/$(WLAN_CHIP)/$(WLAN_CHIP)$(WLAN_CHIP_REVISION)$(WLAN_CHIP_BIN_TYPE)-$(WLAN_CHIP_FIRMWARE_VER).bin
|
||||
|
||||
|
||||
|
||||
BIN
mico-os/board/MKG55/MiCOKit-G55 V1.0.pdf
Normal file
BIN
mico-os/board/MKG55/MiCOKit-G55 V1.0.pdf
Normal file
Binary file not shown.
39
mico-os/board/MKG55/bootloaderLinkerForIAR.icf
Normal file
39
mico-os/board/MKG55/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__ = 0x00400000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00400000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x00407FFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20020000;
|
||||
/*-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 };
|
||||
20
mico-os/board/MKG55/bootloaderLinkerForKeil.sct
Normal file
20
mico-os/board/MKG55/bootloaderLinkerForKeil.sct
Normal file
@@ -0,0 +1,20 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x08000000 0x00008000 {
|
||||
ER_IROM1 0x08000000 0x00008000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
startup_stm32f2xx_bootloader_RVMDK.o
|
||||
}
|
||||
ER_IROM2 0x20000000 0x00008000 {
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20008000 0x00012000
|
||||
{
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
BIN
mico-os/board/MKG55/flash_prog.elf
Normal file
BIN
mico-os/board/MKG55/flash_prog.elf
Normal file
Binary file not shown.
31
mico-os/board/MKG55/memory.ld
Normal file
31
mico-os/board/MKG55/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 = 0x00400000, LENGTH = 32K
|
||||
APP_FLASH (rx) : ORIGIN = 0x00420000, LENGTH = 384K
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
30
mico-os/board/MKG55/micoLinkerForIAR.icf
Normal file
30
mico-os/board/MKG55/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__ = 0x00420000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00420000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0047FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20027FFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x1E000;
|
||||
/**** 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 };
|
||||
428
mico-os/board/MKG55/platform.c
Normal file
428
mico-os/board/MKG55/platform.c
Normal file
@@ -0,0 +1,428 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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 "stdio.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_peripheral.h"
|
||||
#include "platform_logging.h"
|
||||
#include "mico_platform.h"
|
||||
#include "wlan_platform_common.h"
|
||||
#include "spi_flash_platform_interface.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformStandbyButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
extern WEAK void bootloader_start(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
const platform_gpio_t platform_gpio_pins[] =
|
||||
{
|
||||
/* Common GPIOs for internal use */
|
||||
[STDIO_UART_TX] = { IOPORT_CREATE_PIN( PIOA, 10 ), false, 0, 0 },
|
||||
[STDIO_UART_RX] = { IOPORT_CREATE_PIN( PIOA, 9 ), false, 0, 0 },
|
||||
|
||||
[FLASH_PIN_SPI_CS ] = { IOPORT_CREATE_PIN( PIOA, 30 ), false, 0, 0 },
|
||||
[FLASH_PIN_SPI_CLK ] = { IOPORT_CREATE_PIN( PIOA, 29 ), false, 0, 0 },
|
||||
[FLASH_PIN_SPI_MOSI] = { IOPORT_CREATE_PIN( PIOA, 28 ), false, 0, 0 },
|
||||
[FLASH_PIN_SPI_MISO] = { IOPORT_CREATE_PIN( PIOA, 27 ), false, 0, 0 },
|
||||
|
||||
[MICO_SYS_LED] = { IOPORT_CREATE_PIN( PIOB, 10 ), false, 0, 0 },
|
||||
[MICO_RF_LED] = { IOPORT_CREATE_PIN( PIOA, 24 ), false, 0, 0 },
|
||||
[EasyLink_BUTTON] = { IOPORT_CREATE_PIN( PIOA, 2 ), false, 0, 0 },
|
||||
|
||||
[BOOT_SEL] = { IOPORT_CREATE_PIN( PIOB, 14 ), false, 0, 0 },
|
||||
[MFG_SEL] = { IOPORT_CREATE_PIN( PIOB, 15 ), false, 0, 0 },
|
||||
|
||||
|
||||
/* GPIOs for external use */
|
||||
[Arduino_RXD] = { IOPORT_CREATE_PIN( PIOB, 1 ), false, 0, 0 },
|
||||
[Arduino_TXD] = { IOPORT_CREATE_PIN( PIOB, 0 ), false, 0, 0 },
|
||||
[Arduino_D2] = { IOPORT_CREATE_PIN( PIOA, 21 ), false, 0, 0 },
|
||||
[Arduino_D3] = { IOPORT_CREATE_PIN( PIOA, 22 ), false, 0, 0 },
|
||||
[Arduino_D4] = { IOPORT_CREATE_PIN( PIOA, 23 ), false, 0, 0 },
|
||||
[Arduino_D5] = { IOPORT_CREATE_PIN( PIOA, 6 ), false, 0, 0 },
|
||||
[Arduino_D6] = { IOPORT_CREATE_PIN( PIOA, 25 ), false, 0, 0 },
|
||||
[Arduino_D7] = { IOPORT_CREATE_PIN( PIOB, 13 ), false, 0, 0 },
|
||||
[Arduino_D8] = { IOPORT_CREATE_PIN( PIOA, 0 ), false, 0, 0 },
|
||||
[Arduino_D9] = { IOPORT_CREATE_PIN( PIOA, 1 ), false, 0, 0 },
|
||||
[Arduino_CS] = { IOPORT_CREATE_PIN( PIOA, 31 ), false, 0, 0 },
|
||||
[Arduino_SI] = { IOPORT_CREATE_PIN( PIOA, 28 ), false, 0, 0 },
|
||||
[Arduino_SO] = { IOPORT_CREATE_PIN( PIOA, 27 ), false, 0, 0 },
|
||||
[Arduino_SCK] = { IOPORT_CREATE_PIN( PIOA, 29 ), false, 0, 0 },
|
||||
[Arduino_SDA] = { IOPORT_CREATE_PIN( PIOA, 3 ), false, 0, 0 },
|
||||
[Arduino_SCL] = { IOPORT_CREATE_PIN( PIOA, 4 ), false, 0, 0 },
|
||||
|
||||
};
|
||||
|
||||
const platform_adc_t platform_adc_peripherals[] =
|
||||
{
|
||||
[ Arduino_A0 ] = { ADC_CHANNEL_0, ADC_INTERRUPT_EOC_0, ADC_12_BITS },
|
||||
[ Arduino_A1 ] = { ADC_CHANNEL_1, ADC_INTERRUPT_EOC_1, ADC_12_BITS },
|
||||
[ Arduino_A2 ] = { ADC_CHANNEL_2, ADC_INTERRUPT_EOC_2, ADC_12_BITS },
|
||||
[ Arduino_A3 ] = { ADC_CHANNEL_3, ADC_INTERRUPT_EOC_3, ADC_12_BITS },
|
||||
[ Arduino_A4 ] = { ADC_CHANNEL_6, ADC_INTERRUPT_EOC_6, ADC_12_BITS },
|
||||
[ Arduino_A5 ] = { ADC_CHANNEL_7, ADC_INTERRUPT_EOC_7, ADC_12_BITS },
|
||||
};
|
||||
|
||||
|
||||
/* PWM mappings */
|
||||
const platform_pwm_t *platform_pwm_peripherals = NULL;
|
||||
|
||||
const platform_spi_t platform_spi_peripherals [] =
|
||||
{
|
||||
[MICO_SPI_1] =
|
||||
{
|
||||
.spi_id = 7,
|
||||
.port = SPI7,
|
||||
.flexcom_base = FLEXCOM7,
|
||||
.peripheral_id = ID_FLEXCOM7,
|
||||
.mosi_pin = &platform_gpio_pins[FLASH_PIN_SPI_MOSI],
|
||||
.mosi_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
.miso_pin = &platform_gpio_pins[FLASH_PIN_SPI_MISO],
|
||||
.miso_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
.clock_pin = &platform_gpio_pins[FLASH_PIN_SPI_CLK],
|
||||
.clock_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
},
|
||||
};
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.uart_id = 0,
|
||||
.port = USART0,
|
||||
.flexcom_base = FLEXCOM0,
|
||||
.peripheral_id = ID_FLEXCOM0,
|
||||
.tx_pin = &platform_gpio_pins[STDIO_UART_TX],
|
||||
.tx_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.rx_pin = &platform_gpio_pins[STDIO_UART_RX],
|
||||
.rx_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.cts_pin = NULL, /* flow control isn't supported */
|
||||
.cts_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.rts_pin = NULL, /* flow control isn't supported */
|
||||
.rts_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.uart_id = 6,
|
||||
.port = USART6,
|
||||
.flexcom_base = FLEXCOM6,
|
||||
.peripheral_id = ID_FLEXCOM6,
|
||||
.tx_pin = &platform_gpio_pins[Arduino_TXD],
|
||||
.tx_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
.rx_pin = &platform_gpio_pins[Arduino_RXD],
|
||||
.rx_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
.cts_pin = NULL, /* flow control isn't supported */
|
||||
.cts_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
.rts_pin = NULL, /* flow control isn't supported */
|
||||
.rts_pin_mux_mode = IOPORT_MODE_MUX_B,
|
||||
},
|
||||
};
|
||||
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
|
||||
const platform_i2c_t platform_i2c_peripherals[] =
|
||||
{
|
||||
[MICO_I2C_1] =
|
||||
{
|
||||
.i2c_id = 3,
|
||||
.port = TWI3,
|
||||
.flexcom_base = FLEXCOM3,
|
||||
.peripheral_id = ID_FLEXCOM3,
|
||||
.sda_pin = &platform_gpio_pins[Arduino_SDA],
|
||||
.sda_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.scl_pin = &platform_gpio_pins[Arduino_SCL],
|
||||
.scl_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
},
|
||||
};
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
/* 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 ] = { IOPORT_CREATE_PIN( PIOA, 26 ), false, 0, 0 },
|
||||
};
|
||||
|
||||
/* 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 ] = { IOPORT_CREATE_PIN( PIOA, 16 ), false, 0, 0 },
|
||||
[WIFI_PIN_SPI_CS ] = { IOPORT_CREATE_PIN( PIOA, 11 ), false, 0, 0 },
|
||||
[WIFI_PIN_SPI_CLK ] = { IOPORT_CREATE_PIN( PIOA, 14 ), false, 0, 0 },
|
||||
[WIFI_PIN_SPI_MOSI] = { IOPORT_CREATE_PIN( PIOA, 13 ), false, 0, 0 },
|
||||
[WIFI_PIN_SPI_MISO] = { IOPORT_CREATE_PIN( PIOA, 12 ), false, 0, 0 },
|
||||
};
|
||||
|
||||
const platform_spi_t wifi_spi =
|
||||
{
|
||||
.spi_id = 5,
|
||||
.port = SPI5,
|
||||
.flexcom_base = FLEXCOM5,
|
||||
.mosi_pin = &wifi_spi_pins[WIFI_PIN_SPI_MOSI],
|
||||
.mosi_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.miso_pin = &wifi_spi_pins[WIFI_PIN_SPI_MISO],
|
||||
.miso_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
.clock_pin = &wifi_spi_pins[WIFI_PIN_SPI_CLK],
|
||||
.clock_pin_mux_mode = IOPORT_MODE_MUX_A,
|
||||
};
|
||||
|
||||
#if defined ( USE_MICO_SPI_FLASH )
|
||||
const mico_spi_device_t mico_spi_flash =
|
||||
{
|
||||
.port = MICO_SPI_1,
|
||||
.chip_select = FLASH_PIN_SPI_CS,
|
||||
.speed = 40000000,
|
||||
.mode = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_HIGH | SPI_NO_DMA | SPI_MSB_FIRST),
|
||||
.bits = 8,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_EMBEDDED] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_EMBEDDED,
|
||||
.flash_start_addr = 0x00400000,
|
||||
.flash_length = 0x80000,
|
||||
},
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x000000,
|
||||
.flash_length = 0x200000,
|
||||
},
|
||||
};
|
||||
|
||||
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 = 0x00400000,
|
||||
.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 = 0x00420000,
|
||||
.partition_length = 0x60000, //384k 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 = 0x4E000, //312k 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 = 0x50000,
|
||||
.partition_length = 0x60000, //384k bytes
|
||||
.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 = "PARAMETER1",
|
||||
.partition_start_addr = 0x1000,
|
||||
.partition_length = 0x1000, //4k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Interrupt Handler Definitions
|
||||
******************************************************/
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( FLEXCOM0_Handler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_1] );
|
||||
}
|
||||
|
||||
MICO_RTOS_DEFINE_ISR( FLEXCOM6_Handler )
|
||||
{
|
||||
platform_uart_irq( &platform_uart_drivers[MICO_UART_2] );
|
||||
}
|
||||
|
||||
#ifndef MICO_NO_WIFI
|
||||
MICO_RTOS_DEFINE_ISR( FLEXCOM5_Handler )
|
||||
{
|
||||
platform_wifi_spi_rx_dma_irq( );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
void platform_init_peripheral_irq_priorities( void )
|
||||
{
|
||||
NVIC_SetPriority ( PIOA_IRQn, 14 );
|
||||
NVIC_SetPriority ( PIOB_IRQn, 14 );
|
||||
NVIC_SetPriority ( FLEXCOM0_IRQn, 6 ); /* STDIO UART */
|
||||
NVIC_SetPriority ( FLEXCOM5_IRQn, 3 ); /* WLAN SPI */
|
||||
NVIC_SetPriority ( FLEXCOM3_IRQn, 3 ); /* I2C on Arduino */
|
||||
NVIC_SetPriority ( RTT_IRQn, 1 ); /* RTT Wake-up event */
|
||||
}
|
||||
|
||||
void init_platform( void )
|
||||
{
|
||||
button_init_t init;
|
||||
|
||||
MicoGpioInitialize( MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputHigh( MICO_SYS_LED );
|
||||
MicoGpioInitialize( MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( MICO_RF_LED );
|
||||
|
||||
//Initialise EasyLink buttons
|
||||
init.gpio = EasyLink_BUTTON;
|
||||
init.pressed_func = PlatformEasyLinkButtonClickedCallback;
|
||||
init.long_pressed_func = PlatformEasyLinkButtonLongPressedCallback;
|
||||
init.long_pressed_timeout = 5000;
|
||||
|
||||
button_init( IOBUTTON_EASYLINK, init );
|
||||
}
|
||||
|
||||
void init_platform_bootloader( void )
|
||||
{
|
||||
MicoGpioInitialize( MICO_SYS_LED, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputHigh( MICO_SYS_LED );
|
||||
MicoGpioInitialize( MICO_RF_LED, OUTPUT_OPEN_DRAIN_NO_PULL );
|
||||
MicoGpioOutputHigh( MICO_RF_LED );
|
||||
|
||||
MicoGpioInitialize(BOOT_SEL, INPUT_PULL_UP);
|
||||
MicoGpioInitialize(MFG_SEL, INPUT_PULL_UP);
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
MicoGpioInitialize( Arduino_D9, OUTPUT_PUSH_PULL );
|
||||
MicoGpioOutputLow( Arduino_D9 );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void MicoSysLed(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
MicoGpioOutputLow( (mico_gpio_t)MICO_SYS_LED );
|
||||
} else {
|
||||
MicoGpioOutputHigh( (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;
|
||||
}
|
||||
|
||||
|
||||
194
mico-os/board/MKG55/platform.h
Normal file
194
mico-os/board/MKG55/platform.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STDIO_UART_TX,
|
||||
STDIO_UART_RX,
|
||||
FLASH_PIN_SPI_CS,
|
||||
FLASH_PIN_SPI_CLK,
|
||||
FLASH_PIN_SPI_MOSI,
|
||||
FLASH_PIN_SPI_MISO,
|
||||
|
||||
MICO_SYS_LED,
|
||||
MICO_RF_LED,
|
||||
EasyLink_BUTTON,
|
||||
BOOT_SEL,
|
||||
MFG_SEL,
|
||||
|
||||
Arduino_RXD,
|
||||
Arduino_TXD,
|
||||
Arduino_D2,
|
||||
Arduino_D3,
|
||||
Arduino_D4,
|
||||
Arduino_D5,
|
||||
Arduino_D6,
|
||||
Arduino_D7,
|
||||
|
||||
Arduino_D8,
|
||||
Arduino_D9,
|
||||
Arduino_CS,
|
||||
Arduino_SI,
|
||||
Arduino_SO,
|
||||
Arduino_SCK,
|
||||
Arduino_SDA,
|
||||
Arduino_SCL,
|
||||
|
||||
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_1,
|
||||
MICO_PWM_2,
|
||||
MICO_PWM_3,
|
||||
MICO_PWM_MAX, /* Denotes the total number of PWM port aliases. Not a valid PWM alias */
|
||||
MICO_PWM_NONE,
|
||||
} mico_pwm_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Arduino_A0,
|
||||
Arduino_A1,
|
||||
Arduino_A2,
|
||||
Arduino_A3,
|
||||
Arduino_A4,
|
||||
Arduino_A5,
|
||||
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_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_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 MFG_TEST MICO_UART_1
|
||||
#define CLI_UART MICO_UART_1
|
||||
|
||||
|
||||
|
||||
#define USE_MICO_SPI_FLASH
|
||||
//#define SFLASH_SUPPORT_MACRONIX_PARTS
|
||||
//#define SFLASH_SUPPORT_SST_PARTS
|
||||
#define SFLASH_SUPPORT_WINBOND_PARTS
|
||||
|
||||
#define USE_MiCOKit_EXT
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
#define Standby_SEL (MICO_GPIO_NONE)
|
||||
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_I2C (MICO_I2C_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#include "micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // __PLATFORM__H__
|
||||
|
||||
198
mico-os/board/MKG55/platform_config.h
Normal file
198
mico-os/board/MKG55/platform_config.h
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_CONFIG_H__
|
||||
#define __PLATFORM_CONFIG_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "MKG55_1"
|
||||
#define DEFAULT_NAME "MiCOKit G55"
|
||||
#define MODEL "MiCOKit-G55"
|
||||
|
||||
/* MICO RTOS tick rate in Hz */
|
||||
#define MICO_DEFAULT_TICK_RATE_HZ (1000)
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable watchdog. For debugging only */
|
||||
//#define MICO_DISABLE_WATCHDOG
|
||||
|
||||
/************************************************************************
|
||||
* Uncomment to disable standard IO, i.e. printf(), etc. */
|
||||
//#define MICO_DISABLE_STDIO
|
||||
|
||||
/************************************************************************
|
||||
* 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)
|
||||
|
||||
/************************************************************************
|
||||
* Restore default and start easylink after press down EasyLink button for 3 seconds. */
|
||||
#define MCU_CLOCK_HZ (120000000)
|
||||
|
||||
/************************************************************************
|
||||
* 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
|
||||
|
||||
/** \name Resonator definitions
|
||||
* @{ */
|
||||
#define BOARD_FREQ_SLCK_XTAL (32768U)
|
||||
#define BOARD_FREQ_SLCK_BYPASS (32768U)
|
||||
#define BOARD_FREQ_MAINCK_XTAL 0 /* Not Mounted */
|
||||
#define BOARD_FREQ_MAINCK_BYPASS 0 /* Not Mounted */
|
||||
#define BOARD_MCK CHIP_FREQ_CPU_MAX
|
||||
/*TBD startup time needs to be adjusted according to measurements */
|
||||
#define BOARD_OSC_STARTUP_US 15625
|
||||
|
||||
|
||||
/* ===== System Clock (MCK) Source Options */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_RC */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_XTAL */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_SLCK_BYPASS */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_8M_RC */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_16M_RC */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_24M_RC */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_XTAL */
|
||||
/* #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_BYPASS */
|
||||
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLLACK
|
||||
|
||||
/* ===== System Clock (MCK) Prescaler Options (Fmck = Fsys / (SYSCLK_PRES)) */
|
||||
#define CONFIG_SYSCLK_PRES SYSCLK_PRES_1
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_2 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_4 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_8 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_16 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_32 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_64 */
|
||||
/* #define CONFIG_SYSCLK_PRES SYSCLK_PRES_3 */
|
||||
|
||||
// ===== PLL0 (A) Options (Fpll = (Fclk * PLL_mul) / PLL_div)
|
||||
// Use mul and div effective values here.
|
||||
#define CONFIG_PLL0_SOURCE PLL_SRC_SLCK_XTAL
|
||||
#define CONFIG_PLL0_MUL 3662
|
||||
#define CONFIG_PLL0_DIV 1
|
||||
|
||||
// ===== Target frequency (System clock)
|
||||
// - External XTAL frequency: 32768Hz
|
||||
// - System clock source: SLCK XTAL
|
||||
// - System clock prescaler: 1 (divided by 1)
|
||||
// - PLLA source: SLCK_XTAL
|
||||
// - PLLA output: SLCK_XTAL * 3662 / 1
|
||||
// - System clock: SLCK_XTAL * 3662 / 1 / 1 = 120MHz
|
||||
|
||||
/* CPU clock : 48MHz */
|
||||
#define CPU_CLOCK_HZ ( 120000000 )
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* EMW1062 Options
|
||||
******************************************************/
|
||||
/* Wi-Fi chip module */
|
||||
#define EMW1062
|
||||
|
||||
/* 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
|
||||
|
||||
/* USE SDIO 1bit mode */
|
||||
//#define SDIO_1_BIT
|
||||
|
||||
/* Wi-Fi power pin is active high */
|
||||
//#define MICO_USE_WIFI_POWER_PIN_ACTIVE_HIGH
|
||||
|
||||
//#define MICO_USE_BUILTIN_RF_DRIVER
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif // __PLATFORM_CONFIG_H__
|
||||
688
mico-os/board/MKG55/samg55_xplained_pro.h
Normal file
688
mico-os/board/MKG55/samg55_xplained_pro.h
Normal file
@@ -0,0 +1,688 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file sangg55_xplained_pro.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.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef SAMG55_XPLAINED_PRO_H_INCLUDED
|
||||
#define SAMG55_XPLAINED_PRO_H_INCLUDED
|
||||
|
||||
//#include <conf_board.h>
|
||||
#include <compiler.h>
|
||||
|
||||
/**
|
||||
* \ingroup group_common_boards
|
||||
* \defgroup samg55_xplained_pro_group SAMG55 Xplained Pro board
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
void system_board_init(void);
|
||||
|
||||
/**
|
||||
* \defgroup samg55_config_group Configuration
|
||||
*
|
||||
* Symbols to use for configuring the board and its initialization.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#ifdef __DOXYGEN__
|
||||
|
||||
/* ! \name Initialization */
|
||||
/* @{ */
|
||||
|
||||
/**
|
||||
* \def CONF_BOARD_KEEP_WATCHDOG_AT_INIT
|
||||
* \brief If defined, the watchdog will remain enabled
|
||||
*
|
||||
* If this symbol is defined, the watchdog is left running with its current
|
||||
* configuration. Otherwise, it is disabled during board initialization.
|
||||
*/
|
||||
# ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT
|
||||
# define CONF_BOARD_KEEP_WATCHDOG_AT_INIT
|
||||
# endif
|
||||
|
||||
/* @} */
|
||||
|
||||
#endif /* __DOXYGEN__ */
|
||||
/**@} */
|
||||
|
||||
/**
|
||||
* \defgroup samg55_xplained_pro_features_group Features
|
||||
*
|
||||
* Symbols that describe features and capabilities of the board.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Name string macro */
|
||||
#define BOARD_NAME "SAMG55_XPLAINED_PRO"
|
||||
|
||||
/** \name Resonator definitions
|
||||
* @{ */
|
||||
#define BOARD_FREQ_SLCK_XTAL (32768U)
|
||||
#define BOARD_FREQ_SLCK_BYPASS (32768U)
|
||||
#define BOARD_FREQ_MAINCK_XTAL 0 /* Not Mounted */
|
||||
#define BOARD_FREQ_MAINCK_BYPASS 0 /* Not Mounted */
|
||||
#define BOARD_MCK CHIP_FREQ_CPU_MAX
|
||||
/*TBD startup time needs to be adjusted according to measurements */
|
||||
#define BOARD_OSC_STARTUP_US 15625
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \name LED0 definitions
|
||||
* @{ */
|
||||
#define LED0_GPIO (PIO_PA6_IDX)
|
||||
#define LED0_FLAGS (PIO_OUTPUT_1 | PIO_DEFAULT)
|
||||
|
||||
#define LED0_PIN IOPORT_CREATE_PIN(PIOA, 6)
|
||||
#define LED0_ACTIVE_LEVEL false
|
||||
#define LED0_INACTIVE_LEVEL !LED0_ACTIVE_LEVEL
|
||||
/** @} */
|
||||
|
||||
/** \name SW0 definitions
|
||||
* @{ */
|
||||
#define SW0_PIN IOPORT_CREATE_PIN(PIOA, 2)
|
||||
#define SW0_ACTIVE false
|
||||
#define SW0_INACTIVE !SW0_ACTIVE
|
||||
#define SW0_SUPC_INPUT 2
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Wrapper macros for SW0, to ensure common naming across all Xplained Pro
|
||||
* boards.
|
||||
*/
|
||||
#define PIN_SW0 {PIO_PA2, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define PIN_SW0_MASK PIO_PA2
|
||||
#define PIN_SW0_PIO PIOA
|
||||
#define PIN_SW0_ID ID_PIOA
|
||||
#define PIN_SW0_TYPE PIO_INPUT
|
||||
#define PIN_SW0_ATTR (PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
//@}
|
||||
|
||||
/**
|
||||
* \name LED #0 definitions
|
||||
*
|
||||
* Wrapper macros for LED0, to ensure common naming across all Xplained Pro
|
||||
* boards.
|
||||
*
|
||||
* @{ */
|
||||
#define LED_0_NAME "LED0 (yellow)"
|
||||
#define LED_0_PIN LED0_PIN
|
||||
#define LED_0_ACTIVE LED0_ACTIVE_LEVEL
|
||||
#define LED_0_INACTIVE LED0_INACTIVE_LEVEL
|
||||
|
||||
#define PIN_LED_0 {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||
#define PIN_LED_0_MASK PIO_PA16
|
||||
#define PIN_LED_0_PIO PIOA
|
||||
#define PIN_LED_0_ID ID_PIOA
|
||||
#define PIN_LED_0_TYPE PIO_OUTPUT_1
|
||||
#define PIN_LED_0_ATTR PIO_DEFAULT
|
||||
/** @} */
|
||||
|
||||
/** Number of on-board LEDs */
|
||||
#define LED_COUNT 1
|
||||
|
||||
/**
|
||||
* \name Button #0 definitions
|
||||
*
|
||||
* Wrapper macros for SW0, to ensure common naming across all Xplained Pro
|
||||
* boards.
|
||||
*
|
||||
* @{ */
|
||||
#define BUTTON_0_NAME "SW0"
|
||||
#define BUTTON_0_PIN SW0_PIN
|
||||
#define BUTTON_0_ACTIVE SW0_ACTIVE
|
||||
#define BUTTON_0_INACTIVE SW0_INACTIVE
|
||||
#define BUTTON_0_SUPC_INPUT SW0_SUPC_INPUT
|
||||
|
||||
#define PUSHBUTTON_1_NAME "SW0"
|
||||
#define PIN_PUSHBUTTON_1 {PIO_PA2, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define PIN_PUSHBUTTON_1_MASK PIO_PA2
|
||||
#define PIN_PUSHBUTTON_1_PIO PIOA
|
||||
#define PIN_PUSHBUTTON_1_ID ID_PIOA
|
||||
#define PIN_PUSHBUTTON_1_TYPE PIO_INPUT
|
||||
#define PIN_PUSHBUTTON_1_ATTR PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE
|
||||
/** @} */
|
||||
|
||||
/** Number of on-board buttons */
|
||||
#define BUTTON_COUNT 1
|
||||
|
||||
#define CONSOLE_UART USART7
|
||||
#define CONSOLE_UART_ID ID_FLEXCOM7
|
||||
/** USART7 pins (TXD7 and RXD7) definitions, PA27,28. */
|
||||
#define PINS_USART7 (PIO_PA27B_RXD7| PIO_PA28B_TXD7)
|
||||
#define PINS_USART7_FLAGS (IOPORT_MODE_MUX_B)
|
||||
|
||||
#define PINS_USART7_PORT IOPORT_PIOA
|
||||
#define PINS_USART7_MASK (PIO_PA27B_RXD7 | PIO_PA28B_TXD7)
|
||||
#define PINS_USART7_PIO PIOA
|
||||
#define PINS_USART7_ID ID_PIOA
|
||||
#define PINS_USART7_TYPE PIO_PERIPH_B
|
||||
#define PINS_USART7_ATTR PIO_DEFAULT
|
||||
|
||||
/** PCK1 pin definition (PA17) */
|
||||
#define PIN_PCK1 (PIO_PA17_IDX)
|
||||
#define PIN_PCK1_MUX (IOPORT_MODE_MUX_B)
|
||||
#define PIN_PCK1_FLAGS (IOPORT_MODE_MUX_B)
|
||||
#define PIN_PCK1_PORT IOPORT_PIOA
|
||||
#define PIN_PCK1_MASK PIO_PA17B_PCK1
|
||||
#define PIN_PCK1_PIO PIOA
|
||||
#define PIN_PCK1_ID ID_PIOA
|
||||
#define PIN_PCK1_TYPE PIO_PERIPH_B
|
||||
#define PIN_PCK1_ATTR PIO_DEFAULT
|
||||
|
||||
#define PIN_TC0_TIOA0 (PIO_PA0_IDX)
|
||||
#define PIN_TC0_TIOA0_MUX (IOPORT_MODE_MUX_B)
|
||||
#define PIN_TC0_TIOA0_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
|
||||
|
||||
#define PIN_TC0_TIOA1 (PIO_PA23_IDX)
|
||||
#define PIN_TC0_TIOA1_MUX (IOPORT_MODE_MUX_B)
|
||||
#define PIN_TC0_TIOA1_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
|
||||
//! \name SPI
|
||||
//@{
|
||||
/** SPI MISO pin definition. */
|
||||
#define SPI_MISO_GPIO (PIO_PA12_IDX)
|
||||
#define SPI_MISO_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** SPI MOSI pin definition. */
|
||||
#define SPI_MOSI_GPIO (PIO_PA13_IDX)
|
||||
#define SPI_MOSI_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** SPI SPCK pin definition. */
|
||||
#define SPI_SPCK_GPIO (PIO_PA14_IDX)
|
||||
#define SPI_SPCK_FLAGS (IOPORT_MODE_MUX_A)
|
||||
|
||||
/** SPI chip select 0 pin definition. */
|
||||
#define SPI_NPCS0_GPIO (PIO_PA11_IDX)
|
||||
#define SPI_NPCS0_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** SPI chip select 1 pin definition. */
|
||||
#define SPI_NPCS1_GPIO (PIO_PA5_IDX)
|
||||
#define SPI_NPCS1_FLAGS (IOPORT_MODE_MUX_B)
|
||||
//@}
|
||||
|
||||
/** \name Extension header #1 pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_PIN_3 IOPORT_CREATE_PIN(PIOA, 17)
|
||||
#define EXT1_PIN_4 IOPORT_CREATE_PIN(PIOA, 18)
|
||||
#define EXT1_PIN_5 IOPORT_CREATE_PIN(PIOA, 26)
|
||||
#define EXT1_PIN_6 IOPORT_CREATE_PIN(PIOA, 25)
|
||||
#define EXT1_PIN_7 IOPORT_CREATE_PIN(PIOA, 0)
|
||||
#define EXT1_PIN_8 IOPORT_CREATE_PIN(PIOA, 23)
|
||||
#define EXT1_PIN_9 IOPORT_CREATE_PIN(PIOA, 24)
|
||||
#define EXT1_PIN_10 IOPORT_CREATE_PIN(PIOA, 29)
|
||||
#define EXT1_PIN_11 IOPORT_CREATE_PIN(PIOB, 10)
|
||||
#define EXT1_PIN_12 IOPORT_CREATE_PIN(PIOB, 11)
|
||||
#define EXT1_PIN_13 IOPORT_CREATE_PIN(PIOA, 9)
|
||||
#define EXT1_PIN_14 IOPORT_CREATE_PIN(PIOA, 10)
|
||||
#define EXT1_PIN_15 IOPORT_CREATE_PIN(PIOA, 11)
|
||||
#define EXT1_PIN_16 IOPORT_CREATE_PIN(PIOA, 13)
|
||||
#define EXT1_PIN_17 IOPORT_CREATE_PIN(PIOA, 12)
|
||||
#define EXT1_PIN_18 IOPORT_CREATE_PIN(PIOA, 14)
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 pin definitions by function
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_PIN_ADC_0 EXT1_PIN_3
|
||||
#define EXT1_PIN_ADC_1 EXT1_PIN_4
|
||||
#define EXT1_PIN_GPIO_0 EXT1_PIN_5
|
||||
#define EXT1_PIN_GPIO_1 EXT1_PIN_6
|
||||
#define EXT1_PIN_PWM_0 EXT1_PIN_7
|
||||
#define EXT1_PIN_PWM_1 EXT1_PIN_8
|
||||
#define EXT1_PIN_IRQ EXT1_PIN_9
|
||||
#define EXT1_PIN_I2C_SDA EXT1_PIN_11
|
||||
#define EXT1_PIN_I2C_SCL EXT1_PIN_12
|
||||
#define EXT1_PIN_UART_RX EXT1_PIN_13
|
||||
#define EXT1_PIN_UART_TX EXT1_PIN_14
|
||||
#define EXT1_PIN_SPI_SS_1 EXT1_PIN_10
|
||||
#define EXT1_PIN_SPI_SS_0 EXT1_PIN_15
|
||||
#define EXT1_PIN_SPI_MOSI EXT1_PIN_16
|
||||
#define EXT1_PIN_SPI_MISO EXT1_PIN_17
|
||||
#define EXT1_PIN_SPI_SCK EXT1_PIN_18
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 ADC definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_ADC_MODULE ADC
|
||||
#define EXT1_ADC_0_CHANNEL 0
|
||||
#define EXT1_ADC_1_CHANNEL 1
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 PWM definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_PWM_MODULE TC0
|
||||
#define EXT1_PWM_0_CHANNEL 0
|
||||
#define EXT1_PWM_0_MUX IOPORT_MODE_MUX_B
|
||||
#define EXT1_PWM_1_CHANNEL 1
|
||||
#define EXT1_PWM_1_MUX IOPORT_MODE_MUX_B
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 IRQ/External interrupt definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_IRQ_MODULE SUPC
|
||||
#define EXT1_IRQ_INPUT 11
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 I2C definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_TWI_MODULE TWI4
|
||||
#define EXT1_TWI_TWD_MUX IOPORT_MODE_MUX_B
|
||||
#define EXT1_TWI_TWCK_MUX IOPORT_MODE_MUX_B
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 UART definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_UART_MODULE USART
|
||||
#define EXT1_UART_RXD_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT1_UART_TXD_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #1 SPI definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT1_SPI_MODULE SPI5
|
||||
#define EXT1_SPI_MISO_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT1_SPI_MOSI_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT1_SPI_SPCK_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT1_SPI_NPCS0_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_PIN_3 IOPORT_CREATE_PIN(PIOA, 19)
|
||||
#define EXT3_PIN_4 IOPORT_CREATE_PIN(PIOA, 20)
|
||||
#define EXT3_PIN_5 IOPORT_CREATE_PIN(PIOA, 30)
|
||||
#define EXT3_PIN_6 IOPORT_CREATE_PIN(PIOB, 15)
|
||||
#define EXT3_PIN_7 IOPORT_CREATE_PIN(PIOA, 1)
|
||||
#define EXT3_PIN_8 IOPORT_CREATE_PIN(PIOB, 13)
|
||||
#define EXT3_PIN_9 IOPORT_CREATE_PIN(PIOB, 3)
|
||||
#define EXT3_PIN_10 IOPORT_CREATE_PIN(PIOA, 15)
|
||||
#define EXT3_PIN_11 IOPORT_CREATE_PIN(PIOB, 8)
|
||||
#define EXT3_PIN_12 IOPORT_CREATE_PIN(PIOB, 9)
|
||||
#define EXT3_PIN_13 IOPORT_CREATE_PIN(PIOB, 1)
|
||||
#define EXT3_PIN_14 IOPORT_CREATE_PIN(PIOB, 0)
|
||||
#define EXT3_PIN_15 IOPORT_CREATE_PIN(PIOA, 5)
|
||||
#define EXT3_PIN_16 IOPORT_CREATE_PIN(PIOA, 13)
|
||||
#define EXT3_PIN_17 IOPORT_CREATE_PIN(PIOA, 12)
|
||||
#define EXT3_PIN_18 IOPORT_CREATE_PIN(PIOA, 14)
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 pin definitions by function
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_PIN_ADC_0 EXT3_PIN_3
|
||||
#define EXT3_PIN_ADC_1 EXT3_PIN_4
|
||||
#define EXT3_PIN_GPIO_0 EXT3_PIN_5
|
||||
#define EXT3_PIN_PWM_0 EXT3_PIN_7
|
||||
#define EXT3_PIN_IRQ EXT3_PIN_9
|
||||
#define EXT3_PIN_I2C_SDA EXT3_PIN_11
|
||||
#define EXT3_PIN_I2C_SCL EXT3_PIN_12
|
||||
#define EXT3_PIN_UART_RX EXT3_PIN_13
|
||||
#define EXT3_PIN_UART_TX EXT3_PIN_14
|
||||
#define EXT3_PIN_SPI_SS_1 EXT3_PIN_10
|
||||
#define EXT3_PIN_SPI_SS_0 EXT3_PIN_15
|
||||
#define EXT3_PIN_SPI_MOSI EXT3_PIN_16
|
||||
#define EXT3_PIN_SPI_MISO EXT3_PIN_17
|
||||
#define EXT3_PIN_SPI_SCK EXT3_PIN_18
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 ADC definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_ADC_MODULE ADC
|
||||
#define EXT3_ADC_0_CHANNEL 2
|
||||
#define EXT3_ADC_1_CHANNEL 3
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 PWM definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_PWM_MODULE TC2
|
||||
#define EXT3_PWM_0_CHANNEL 0
|
||||
#define EXT3_PWM_0_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 IRQ/External interrupt definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_IRQ_MODULE SUPC
|
||||
#define EXT3_IRQ_INPUT 10
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 I2C definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_TWI_MODULE TWI1
|
||||
#define EXT3_TWI_TWD_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT3_TWI_TWCK_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 UART definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_UART_MODULE UART0
|
||||
#define EXT3_UART_RXD_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT3_UART_TXD_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #3 SPI definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT3_SPI_MODULE SPI5
|
||||
#define EXT3_SPI_MISO_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT3_SPI_MOSI_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT3_SPI_SPCK_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT3_SPI_NPCS1_MUX IOPORT_MODE_MUX_B
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #4 pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT4_PIN_5 IOPORT_CREATE_PIN(PIOA, 15)
|
||||
#define EXT4_PIN_9 IOPORT_CREATE_PIN(PIOB, 8)
|
||||
#define EXT4_PIN_11 IOPORT_CREATE_PIN(PIOB, 10)
|
||||
#define EXT4_PIN_12 IOPORT_CREATE_PIN(PIOB, 11)
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #4 pin definitions by function
|
||||
* @{
|
||||
*/
|
||||
#define EXT4_PIN_GPIO_0 EXT3_PIN_5
|
||||
#define EXT4_PIN_IRQ EXT3_PIN_9
|
||||
#define EXT4_PIN_I2C_SDA EXT3_PIN_11
|
||||
#define EXT4_PIN_I2C_SCL EXT3_PIN_12
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #4 IRQ/External interrupt definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT4_IRQ_MODULE SUPC
|
||||
#define EXT4_IRQ_INPUT 14
|
||||
/** @} */
|
||||
|
||||
/** \name Extension header #4 TWI definitions
|
||||
* @{
|
||||
*/
|
||||
#define EXT4_TWI_MODULE TWI1
|
||||
#define EXT4_TWI_TWD_MUX IOPORT_MODE_MUX_A
|
||||
#define EXT4_TWI_TWCK_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Embedded debugger GPIO interface definitions
|
||||
* @{
|
||||
*/
|
||||
#define EDBG_GPIO0_PIN IOPORT_CREATE_PIN(PIOA, 15)
|
||||
#define EDBG_GPIO1_PIN IOPORT_CREATE_PIN(PIOB, 3)
|
||||
#define EDBG_GPIO2_PIN IOPORT_CREATE_PIN(PIOB, 4)
|
||||
#define EDBG_GPIO3_PIN IOPROT_CREATE_PIN(PIOB, 9)
|
||||
/** @} */
|
||||
|
||||
/** \name Embedded debugger USART interface definitions
|
||||
* @{
|
||||
*/
|
||||
#define EDBG_UART_MODULE USART
|
||||
#define EDBG_UART_RX_PIN IOPORT_CREATE_PIN(PIOA, 5)
|
||||
#define EDBG_UART_RX_MUX IOPORT_MODE_MUX_A
|
||||
#define EDBG_UART_TX_PIN IOPORT_CREATE_PIN(PIOA, 6)
|
||||
#define EDBG_UART_TX_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Embedded debugger I2C interface definitions
|
||||
* @{
|
||||
*/
|
||||
#define EDBG_TWI_MODULE TWI1
|
||||
#define EDBG_TWI_TWD_MUX IOPORT_MODE_MUX_A
|
||||
#define EDBG_TWI_TWCK_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
/** \name Embedded debugger CDC Gateway USART interface definitions
|
||||
* @{
|
||||
*/
|
||||
#define EDBG_CDC_UART_MODULE UART0
|
||||
#define EDBG_CDC_UART_RX_PIN IOPORT_CREATE_PIN(PIOA, 9)
|
||||
#define EDBG_CDC_UART_RX_MUX IOPORT_MODE_MUX_A
|
||||
#define EDBG_CDC_UART_TX_PIN IOPORT_CREATE_PIN(PIOA, 10)
|
||||
#define EDBG_CDC_UART_TX_MUX IOPORT_MODE_MUX_A
|
||||
/** @} */
|
||||
|
||||
//! \name OLED
|
||||
//@{
|
||||
/** OLED command/data select pin */
|
||||
#define UG_2832HSWEG04_DATA_CMD_GPIO (PIO_PA30_IDX)
|
||||
/** OLED reset pin */
|
||||
#define UG_2832HSWEG04_RESET_GPIO (PIO_PA15_IDX)
|
||||
/** OLED SPI configuration */
|
||||
#define UG_2832HSWEG04_SS 1
|
||||
#define UG_2832HSWEG04_BAUDRATE 5000000
|
||||
//! \name OLED dimensions
|
||||
//@{
|
||||
#define LCD_WIDTH_PIXELS (128)
|
||||
#define LCD_HEIGHT_PIXELS (32)
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/** \name TWI
|
||||
* @{
|
||||
*/
|
||||
/** TWI0 pin definitions */
|
||||
#define TWI0_DATA_GPIO PIO_PA9_IDX
|
||||
#define TWI0_DATA_FLAGS IOPORT_MODE_MUX_A
|
||||
#define TWI0_CLK_GPIO PIO_PA10_IDX
|
||||
#define TWI0_CLK_FLAGS IOPORT_MODE_MUX_A
|
||||
/** TWI1 pin definitions */
|
||||
#define TWI1_DATA_GPIO PIO_PB2_IDX
|
||||
#define TWI1_DATA_FLAGS IOPORT_MODE_MUX_A
|
||||
#define TWI1_CLK_GPIO PIO_PB3_IDX
|
||||
#define TWI1_CLK_FLAGS IOPORT_MODE_MUX_A
|
||||
/** TWI4 pin definitions */
|
||||
#define TWI4_DATA_GPIO EXT1_PIN_11
|
||||
#define TWI4_DATA_FLAGS IOPORT_MODE_MUX_A
|
||||
#define TWI4_CLK_GPIO EXT1_PIN_12
|
||||
#define TWI4_CLK_FLAGS IOPORT_MODE_MUX_A
|
||||
/** TWI6 pin definitions */
|
||||
#define TWI6_DATA_GPIO EXT3_PIN_11
|
||||
#define TWI6_DATA_FLAGS IOPORT_MODE_MUX_B
|
||||
#define TWI6_CLK_GPIO EXT3_PIN_12
|
||||
#define TWI6_CLK_FLAGS IOPORT_MODE_MUX_B
|
||||
/** @} */
|
||||
|
||||
//! \name I2S0
|
||||
//@{
|
||||
/** I2S0 SCK pin definition. */
|
||||
#define I2S0_SCK_GPIO (PIO_PA0_IDX)
|
||||
#define I2S0_SCK_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** I2S0 MCK pin definition. */
|
||||
#define I2S0_MCK_GPIO (PIO_PA4_IDX)
|
||||
#define I2S0_MCK_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** I2S0 SDI pin definition. */
|
||||
#define I2S0_SDI_GPIO (PIO_PA2_IDX)
|
||||
#define I2S0_SDI_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** I2S0 SDO pin definition. */
|
||||
#define I2S0_SDO_GPIO (PIO_PA3_IDX)
|
||||
#define I2S0_SDO_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** I2S0 WS pin definition. */
|
||||
#define I2S0_WS_GPIO (PIO_PA1_IDX)
|
||||
#define I2S0_WS_FLAGS (IOPORT_MODE_MUX_A)
|
||||
//@}
|
||||
|
||||
//! \name I2S1
|
||||
//@{
|
||||
/** I2S1 SCK pin definition. */
|
||||
#define I2S1_SCK_GPIO (PIO_PA19_IDX)
|
||||
#define I2S1_SCK_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** I2S1 MCK pin definition. */
|
||||
#define I2S1_MCK_GPIO (PIO_PA24_IDX)
|
||||
#define I2S1_MCK_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** I2S1 SDI pin definition. */
|
||||
#define I2S1_SDI_GPIO (PIO_PA22_IDX)
|
||||
#define I2S1_SDI_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** I2S1 SDO pin definition. */
|
||||
#define I2S1_SDO_GPIO (PIO_PA23_IDX)
|
||||
#define I2S1_SDO_FLAGS (IOPORT_MODE_MUX_A)
|
||||
/** I2S1 WS pin definition. */
|
||||
#define I2S1_WS_GPIO (PIO_PA20_IDX)
|
||||
#define I2S1_WS_FLAGS (IOPORT_MODE_MUX_B)
|
||||
//@}
|
||||
|
||||
//! \name IO1 button definitions */
|
||||
//@{
|
||||
/** Push button #1 definition. Attributes = pull-up + debounce + interrupt on rising edge. */
|
||||
#define PUSHBUTTON_1_NAME "SW0"
|
||||
#define GPIO_PUSH_BUTTON_1 (PIO_PA2_IDX)
|
||||
#define GPIO_PUSH_BUTTON_1_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
//@}
|
||||
|
||||
//! \name Light Sensor
|
||||
//@{
|
||||
#define LIGHT_SENSOR_GPIO PIO_PA17_IDX
|
||||
#define LIGHT_SENSOR_FLAGS PIO_INPUT
|
||||
//@}
|
||||
|
||||
/** \name USB definitions
|
||||
* @{
|
||||
*/
|
||||
#define PIN_USB_VBUS {PIO_PB4, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP}
|
||||
#define USB_VBUS_FLAGS (PIO_INPUT | PIO_DEBOUNCE | PIO_IT_EDGE)
|
||||
#define USB_VBUS_PIN_IRQn (PIOB_IRQn)
|
||||
#define USB_VBUS_PIN (PIO_PB4_IDX)
|
||||
#define USB_VBUS_PIO_ID (ID_PIOB)
|
||||
#define USB_VBUS_PIO_MASK (PIO_PB4)
|
||||
|
||||
/** USB D- pin (System function) */
|
||||
#define PIN_USB_DM {PIO_PA21}
|
||||
/** USB D+ pin (System function) */
|
||||
#define PIN_USB_DP {PIO_PA22}
|
||||
/** @} */
|
||||
|
||||
//! \name IO1 SD card definitions */
|
||||
//@{
|
||||
#define SD_MMC_SPI_MEM_CNT 1
|
||||
#define SD_MMC_0_CD_GPIO (PIO_PA29_IDX)
|
||||
#define SD_MMC_0_CD_DIR (IOPORT_DIR_INPUT)
|
||||
#define SD_MMC_0_CD_MODE (IOPORT_MODE_PULLUP)
|
||||
#define SD_MMC_0_CD_DETECT_VALUE 0
|
||||
#define SD_MMC_SPI SPI5
|
||||
#define SD_MMC_SPI_0_CS 0
|
||||
#define SD_MMC_0_CD_PIO_ID ID_PIOA
|
||||
/**
|
||||
* Wrapper macros for IO1 SD, to ensure common naming across all Xplained Pro
|
||||
* boards.
|
||||
*/
|
||||
#define SD_MMC_0_CD_FLAGS (PIO_INPUT | PIO_PULLUP)
|
||||
#define SD_MMC_0_CD {PIO_PA29, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define SD_MMC_0_CD_MASK PIO_PA29
|
||||
#define SD_MMC_0_CD_PIO PIOA
|
||||
#define SD_MMC_0_CD_ID ID_PIOA
|
||||
#define SD_MMC_0_CD_TYPE PIO_INPUT
|
||||
#define SD_MMC_0_CD_ATTR (PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_EDGE)
|
||||
//@}
|
||||
|
||||
//! \name IO1 temperature sensor definitions */
|
||||
//@{
|
||||
#define BOARD_AT30TSE_TWI TWI4
|
||||
#define BOARD_AT30TSE_TWI_ID ID_TWI4
|
||||
#define BOARD_TWI_SPEED (400000u)
|
||||
#define BOARD_USING_AT30TSE AT30TSE758
|
||||
#define BOARD_AT30TSE_DEVICE_ADDR 0x07
|
||||
//@}
|
||||
|
||||
//! \name OLED1 led definitions */
|
||||
//@{
|
||||
#define OLED1_LED1_PIN EXT3_PIN_7
|
||||
#define OLED1_LED1_ACTIVE false
|
||||
#define OLED1_LED1_INACTIVE !OLED1_LED1_ACTIVE
|
||||
|
||||
#define OLED1_LED2_PIN EXT3_PIN_8
|
||||
#define OLED1_LED2_ACTIVE false
|
||||
#define OLED1_LED2_INACTIVE !OLED1_LED2_ACTIVE
|
||||
|
||||
#define OLED1_LED3_PIN EXT3_PIN_6
|
||||
#define OLED1_LED3_ACTIVE false
|
||||
#define OLED1_LED3_INACTIVE !OLED1_LED3_ACTIVE
|
||||
//@}
|
||||
|
||||
//! \name OLED1 button definitions */
|
||||
//@{
|
||||
/** Push button #1 definition. Attributes = pull-up + debounce + interrupt on rising edge. */
|
||||
#define OLED1_PUSHBUTTON_1_NAME "BUTTON 1"
|
||||
#define OLED1_GPIO_PUSH_BUTTON_1 (PIO_PB3_IDX)
|
||||
#define OLED1_GPIO_PUSH_BUTTON_1_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
|
||||
#define OLED1_PIN_PUSHBUTTON_1 {PIO_PB3, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define OLED1_PIN_PUSHBUTTON_1_MASK PIO_PB3
|
||||
#define OLED1_PIN_PUSHBUTTON_1_PIO PIOB
|
||||
#define OLED1_PIN_PUSHBUTTON_1_ID ID_PIOB
|
||||
#define OLED1_PIN_PUSHBUTTON_1_TYPE PIO_INPUT
|
||||
#define OLED1_PIN_PUSHBUTTON_1_ATTR (PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
|
||||
/** Push button #2 definition. Attributes = pull-up + debounce + interrupt on rising edge. */
|
||||
#define OLED1_PUSHBUTTON_2_NAME "BUTTON 2"
|
||||
#define OLED1_GPIO_PUSH_BUTTON_2 (PIO_PA19_IDX)
|
||||
#define OLED1_GPIO_PUSH_BUTTON_2_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
|
||||
#define OLED1_PIN_PUSHBUTTON_2 {PIO_PA19, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define OLED1_PIN_PUSHBUTTON_2_MASK PIO_PA19
|
||||
#define OLED1_PIN_PUSHBUTTON_2_PIO PIOA
|
||||
#define OLED1_PIN_PUSHBUTTON_2_ID ID_PIOA
|
||||
#define OLED1_PIN_PUSHBUTTON_2_TYPE PIO_INPUT
|
||||
#define OLED1_PIN_PUSHBUTTON_2_ATTR (PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
|
||||
/** Push button #3 definition. Attributes = pull-up + debounce + interrupt on rising edge. */
|
||||
#define OLED1_PUSHBUTTON_3_NAME "BUTTON 3"
|
||||
#define OLED1_GPIO_PUSH_BUTTON_3 (PIO_PA20_IDX)
|
||||
#define OLED1_GPIO_PUSH_BUTTON_3_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
|
||||
#define OLED1_PIN_PUSHBUTTON_3 {PIO_PA20, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
|
||||
#define OLED1_PIN_PUSHBUTTON_3_MASK PIO_PA20
|
||||
#define OLED1_PIN_PUSHBUTTON_3_PIO PIOA
|
||||
#define OLED1_PIN_PUSHBUTTON_3_ID ID_PIOA
|
||||
#define OLED1_PIN_PUSHBUTTON_3_TYPE PIO_INPUT
|
||||
#define OLED1_PIN_PUSHBUTTON_3_ATTR (PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
|
||||
//@}
|
||||
|
||||
//! \name PDM
|
||||
//@{
|
||||
/** PDM CLK pin definition. */
|
||||
#define PDM_CLK_GPIO (PIO_PA10_IDX)
|
||||
#define PDM_CLK_FLAGS (IOPORT_MODE_MUX_B)
|
||||
/** PDM DAT pin definition. */
|
||||
#define PDM_DAT_GPIO (PIO_PA9_IDX)
|
||||
#define PDM_DAT_FLAGS (IOPORT_MODE_MUX_B)
|
||||
//@}
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* SAMG55_XPLAINED_PRO_H_INCLUDED */
|
||||
Reference in New Issue
Block a user