mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 14:08:19 +08:00
修复mico-sdk错误
This commit is contained in:
@@ -26,7 +26,7 @@ NAME := Board_MK3031B
|
||||
WLAN_CHIP := mw30x
|
||||
WLAN_CHIP_REVISION := _uapsta
|
||||
WLAN_CHIP_FAMILY := MW3xx
|
||||
WLAN_CHIP_FIRMWARE_VER := 14.76.36.p84
|
||||
WLAN_CHIP_FIRMWARE_VER := 14.76.36.p103
|
||||
|
||||
MODULE := 3031B
|
||||
HOST_MCU_FAMILY := MW3xx
|
||||
|
||||
0
mico-os/board/MK3031B/flash_prog.elf
Executable file → Normal file
0
mico-os/board/MK3031B/flash_prog.elf
Executable file → Normal file
@@ -1,363 +1,363 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @brief This file provides all MICO Peripherals mapping table and platform
|
||||
* specific functions.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby gra nted, 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 "common.h"
|
||||
#include "mico_platform.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "button.h"
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#include "MiCOKit_EXT/micokit_ext.h"
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
static int uart2_redirect_pin = 0;
|
||||
|
||||
/* UART devices */
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.port_id = UART1_ID,
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.port_id = UART2_ID,
|
||||
},
|
||||
[MICO_UART_3] =
|
||||
{
|
||||
.port_id = UART0_ID,
|
||||
}
|
||||
};
|
||||
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x0,
|
||||
.flash_length = 0x1FA000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
/*
|
||||
FC_COMP_BOOT2 0x0 0x6000 0 boot2
|
||||
FC_COMP_FW 0x6000 0x68000 0 mcufw
|
||||
FC_COMP_FW 0x6E000 0x68000 0 mcufw
|
||||
FC_COMP_PSM 0xD6000 0x4000 0 psm
|
||||
FC_COMP_PSM 0xDA000 0x4000 0 psm
|
||||
FC_COMP_ATE 0xDE000 0x4C000 0 ATE
|
||||
FC_COMP_WLAN_FW 0x12a000 0x49000 0 wififw
|
||||
FC_COMP_WLAN_FW 0x173000 0x49000 0 wififw
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
phy_PARTITION_BOOTLOADER,
|
||||
phy_PARTITION_APPLICATION1,
|
||||
phy_PARTITION_APPLICATION2,
|
||||
phy_PARTITION_ATE,
|
||||
phy_PARTITION_RF_FIRMWARE1,
|
||||
phy_PARTITION_PARAMETER_1,
|
||||
phy_PARTITION_PARAMETER_2,
|
||||
phy_PARTITION_USER,
|
||||
phy_PARTITION_NONE,
|
||||
} phy_partition_t;
|
||||
|
||||
static char part1_desc[16] = "Application", part2_desc[16] = "Application";
|
||||
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[phy_PARTITION_BOOTLOADER] = // bootloader move to application
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "BOOTLOADER",
|
||||
.partition_start_addr = 0x0,
|
||||
.partition_length = 0x6000, //24k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_APPLICATION1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = part1_desc,
|
||||
.partition_start_addr = 0x6000,
|
||||
.partition_length = 0xA9000 + 0xA9000, //1352 bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_APPLICATION2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
.partition_description = part2_desc,
|
||||
.partition_start_addr = 0,
|
||||
.partition_length = 0, //0 bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
|
||||
[phy_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x158000,
|
||||
.partition_length = 0x4000, // 16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_PARAMETER_2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER2",
|
||||
.partition_start_addr = 0x15C000,
|
||||
.partition_length = 0x4000, //16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_ATE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "ATE",
|
||||
.partition_start_addr = 0x160000,
|
||||
.partition_length = 0x40000, //256k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_RF_FIRMWARE1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "RF Firmware",
|
||||
.partition_start_addr = 0x1a0000,
|
||||
.partition_length = 0x48000, //288k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_USER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "User",
|
||||
.partition_start_addr = 0x1e0000,
|
||||
.partition_length = 0x18000, //96k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
void init_platform( void )
|
||||
{
|
||||
#if defined (MOC) && (MOC == 1)
|
||||
button_init_t init;
|
||||
extern int get_last_reset_reason(void);
|
||||
|
||||
if ( get_last_reset_reason() & LAST_RST_CAUSE_WDT )
|
||||
{
|
||||
platform_log( "WARNING: Watchdog reset occured previously." );
|
||||
}
|
||||
|
||||
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_PUSH_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
// 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 USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
|
||||
rgb_led_init();
|
||||
rgb_led_open(0, 0, 0);
|
||||
#endif
|
||||
|
||||
#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 );
|
||||
}
|
||||
}
|
||||
|
||||
mico_logic_partition_t* paltform_flash_get_info(int inPartition)
|
||||
{
|
||||
mico_logic_partition_t *logic_partition;
|
||||
int tmp;
|
||||
|
||||
platform_flash_init( &platform_flash_peripherals[MICO_FLASH_SPI] );
|
||||
|
||||
switch(inPartition)
|
||||
{
|
||||
case MICO_PARTITION_BOOTLOADER:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_BOOTLOADER];
|
||||
break;
|
||||
case MICO_PARTITION_APPLICATION:
|
||||
tmp = get_passive_firmware();
|
||||
if (tmp == 2)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION1];
|
||||
else if (tmp == 1)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION2];
|
||||
else
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
case MICO_PARTITION_ATE:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_ATE];
|
||||
break;
|
||||
case MICO_PARTITION_OTA_TEMP: /* OTA always write the passive firmware */
|
||||
tmp = get_passive_firmware();
|
||||
if (tmp == 2)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION2];
|
||||
else if (tmp == 1)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION1];
|
||||
else
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
case MICO_PARTITION_RF_FIRMWARE: /* RF firmware always RW the active firmware*/
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_RF_FIRMWARE1];
|
||||
break;
|
||||
case MICO_PARTITION_PARAMETER_1:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_PARAMETER_1];
|
||||
break;
|
||||
case MICO_PARTITION_PARAMETER_2:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_PARAMETER_2];
|
||||
break;
|
||||
case MICO_PARTITION_USER: // user partition use the passive wifi firmware partition
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_USER];
|
||||
break;
|
||||
default:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
}
|
||||
|
||||
return logic_partition;
|
||||
}
|
||||
|
||||
WEAK int board_cpu_freq()
|
||||
{
|
||||
return MCU_CLOCK_HZ;
|
||||
}
|
||||
|
||||
WEAK void board_uart_pin_config( int id )
|
||||
{
|
||||
switch ( id )
|
||||
{
|
||||
case UART0_ID:
|
||||
GPIO_PinMuxFun( GPIO_2, GPIO2_UART0_TXD );
|
||||
GPIO_PinMuxFun( GPIO_3, GPIO3_UART0_RXD );
|
||||
break;
|
||||
case UART1_ID:
|
||||
GPIO_PinMuxFun( GPIO_44, GPIO44_UART1_TXD );
|
||||
GPIO_PinMuxFun( GPIO_45, GPIO45_UART1_RXD );
|
||||
break;
|
||||
case UART2_ID:
|
||||
if ( uart2_redirect_pin == 0 )
|
||||
{
|
||||
GPIO_PinMuxFun( GPIO_48, GPIO48_UART2_TXD );
|
||||
GPIO_PinMuxFun( GPIO_49, GPIO49_UART2_RXD );
|
||||
} else
|
||||
{
|
||||
GPIO_PinMuxFun( GPIO_9, GPIO9_UART2_TXD );
|
||||
GPIO_PinMuxFun( GPIO_10, GPIO10_UART2_RXD );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void redirect_uart2_pin(void)
|
||||
{
|
||||
uart2_redirect_pin = 1;
|
||||
}
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
// add test mode for MiCOKit-EXT board,check Arduino_D5 pin when system startup
|
||||
bool MicoExtShouldEnterTestMode(void)
|
||||
{
|
||||
if( MicoGpioInputGet((mico_gpio_t)Arduino_D5)==false ){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @brief This file provides all MICO Peripherals mapping table and platform
|
||||
* specific functions.
|
||||
******************************************************************************
|
||||
*
|
||||
* The MIT License
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* Permission is hereby gra nted, 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 "common.h"
|
||||
#include "mico_platform.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "button.h"
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#include "MiCOKit_EXT/micokit_ext.h"
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
extern WEAK void PlatformEasyLinkButtonClickedCallback(void);
|
||||
extern WEAK void PlatformEasyLinkButtonLongPressedCallback(void);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
******************************************************/
|
||||
static int uart2_redirect_pin = 0;
|
||||
|
||||
/* UART devices */
|
||||
const platform_uart_t platform_uart_peripherals[] =
|
||||
{
|
||||
[MICO_UART_1] =
|
||||
{
|
||||
.port_id = UART1_ID,
|
||||
},
|
||||
[MICO_UART_2] =
|
||||
{
|
||||
.port_id = UART2_ID,
|
||||
},
|
||||
[MICO_UART_3] =
|
||||
{
|
||||
.port_id = UART0_ID,
|
||||
}
|
||||
};
|
||||
|
||||
platform_uart_driver_t platform_uart_drivers[MICO_UART_MAX];
|
||||
|
||||
|
||||
/* Flash memory devices */
|
||||
const platform_flash_t platform_flash_peripherals[] =
|
||||
{
|
||||
[MICO_FLASH_SPI] =
|
||||
{
|
||||
.flash_type = FLASH_TYPE_SPI,
|
||||
.flash_start_addr = 0x0,
|
||||
.flash_length = 0x1FA000,
|
||||
},
|
||||
};
|
||||
|
||||
platform_flash_driver_t platform_flash_drivers[MICO_FLASH_MAX];
|
||||
|
||||
platform_i2c_driver_t platform_i2c_drivers[MICO_I2C_MAX];
|
||||
|
||||
platform_spi_driver_t platform_spi_drivers[MICO_SPI_MAX];
|
||||
|
||||
/*
|
||||
FC_COMP_BOOT2 0x0 0x6000 0 boot2
|
||||
FC_COMP_FW 0x6000 0x68000 0 mcufw
|
||||
FC_COMP_FW 0x6E000 0x68000 0 mcufw
|
||||
FC_COMP_PSM 0xD6000 0x4000 0 psm
|
||||
FC_COMP_PSM 0xDA000 0x4000 0 psm
|
||||
FC_COMP_ATE 0xDE000 0x4C000 0 ATE
|
||||
FC_COMP_WLAN_FW 0x12a000 0x49000 0 wififw
|
||||
FC_COMP_WLAN_FW 0x173000 0x49000 0 wififw
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
phy_PARTITION_BOOTLOADER,
|
||||
phy_PARTITION_APPLICATION1,
|
||||
phy_PARTITION_APPLICATION2,
|
||||
phy_PARTITION_ATE,
|
||||
phy_PARTITION_RF_FIRMWARE1,
|
||||
phy_PARTITION_PARAMETER_1,
|
||||
phy_PARTITION_PARAMETER_2,
|
||||
phy_PARTITION_USER,
|
||||
phy_PARTITION_NONE,
|
||||
} phy_partition_t;
|
||||
|
||||
static char part1_desc[16] = "Application", part2_desc[16] = "Application";
|
||||
|
||||
const mico_logic_partition_t mico_partitions[] =
|
||||
{
|
||||
[phy_PARTITION_BOOTLOADER] = // bootloader move to application
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "BOOTLOADER",
|
||||
.partition_start_addr = 0x0,
|
||||
.partition_length = 0x6000, //24k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_APPLICATION1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = part1_desc,
|
||||
.partition_start_addr = 0x6000,
|
||||
.partition_length = 0xA9000 + 0xA9000, //1352 bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_APPLICATION2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_NONE,
|
||||
.partition_description = part2_desc,
|
||||
.partition_start_addr = 0,
|
||||
.partition_length = 0, //0 bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
|
||||
[phy_PARTITION_PARAMETER_1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER1",
|
||||
.partition_start_addr = 0x158000,
|
||||
.partition_length = 0x4000, // 16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_PARAMETER_2] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "PARAMETER2",
|
||||
.partition_start_addr = 0x15C000,
|
||||
.partition_length = 0x4000, //16k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_ATE] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "ATE",
|
||||
.partition_start_addr = 0x160000,
|
||||
.partition_length = 0x40000, //256k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_RF_FIRMWARE1] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "RF Firmware",
|
||||
.partition_start_addr = 0x1a0000,
|
||||
.partition_length = 0x48000, //288k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
[phy_PARTITION_USER] =
|
||||
{
|
||||
.partition_owner = MICO_FLASH_SPI,
|
||||
.partition_description = "User",
|
||||
.partition_start_addr = 0x1e0000,
|
||||
.partition_length = 0x18000, //96k bytes
|
||||
.partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_EN,
|
||||
},
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
void init_platform( void )
|
||||
{
|
||||
#if defined (MOC) && (MOC == 1)
|
||||
button_init_t init;
|
||||
extern int get_last_reset_reason(void);
|
||||
|
||||
if ( get_last_reset_reason() & LAST_RST_CAUSE_WDT )
|
||||
{
|
||||
platform_log( "WARNING: Watchdog reset occured previously." );
|
||||
}
|
||||
|
||||
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_PUSH_PULL );
|
||||
MicoGpioOutputHigh( (mico_gpio_t)MICO_RF_LED );
|
||||
|
||||
// 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 USE_MiCOKit_EXT
|
||||
dc_motor_init( );
|
||||
dc_motor_set( 0 );
|
||||
|
||||
rgb_led_init();
|
||||
rgb_led_open(0, 0, 0);
|
||||
#endif
|
||||
|
||||
#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 );
|
||||
}
|
||||
}
|
||||
|
||||
mico_logic_partition_t* paltform_flash_get_info(int inPartition)
|
||||
{
|
||||
mico_logic_partition_t *logic_partition;
|
||||
int tmp;
|
||||
|
||||
platform_flash_init( &platform_flash_peripherals[MICO_FLASH_SPI] );
|
||||
|
||||
switch(inPartition)
|
||||
{
|
||||
case MICO_PARTITION_BOOTLOADER:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_BOOTLOADER];
|
||||
break;
|
||||
case MICO_PARTITION_APPLICATION:
|
||||
tmp = get_passive_firmware();
|
||||
if (tmp == 2)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION1];
|
||||
else if (tmp == 1)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION2];
|
||||
else
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
case MICO_PARTITION_ATE:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_ATE];
|
||||
break;
|
||||
case MICO_PARTITION_OTA_TEMP: /* OTA always write the passive firmware */
|
||||
tmp = get_passive_firmware();
|
||||
if (tmp == 2)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION2];
|
||||
else if (tmp == 1)
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_APPLICATION1];
|
||||
else
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
case MICO_PARTITION_RF_FIRMWARE: /* RF firmware always RW the active firmware*/
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_RF_FIRMWARE1];
|
||||
break;
|
||||
case MICO_PARTITION_PARAMETER_1:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_PARAMETER_1];
|
||||
break;
|
||||
case MICO_PARTITION_PARAMETER_2:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_PARAMETER_2];
|
||||
break;
|
||||
case MICO_PARTITION_USER: // user partition use the passive wifi firmware partition
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_USER];
|
||||
break;
|
||||
default:
|
||||
logic_partition = (mico_logic_partition_t *)&mico_partitions[phy_PARTITION_NONE];
|
||||
break;
|
||||
}
|
||||
|
||||
return logic_partition;
|
||||
}
|
||||
|
||||
WEAK int board_cpu_freq()
|
||||
{
|
||||
return MCU_CLOCK_HZ;
|
||||
}
|
||||
|
||||
WEAK void board_uart_pin_config( int id )
|
||||
{
|
||||
switch ( id )
|
||||
{
|
||||
case UART0_ID:
|
||||
GPIO_PinMuxFun( GPIO_2, GPIO2_UART0_TXD );
|
||||
GPIO_PinMuxFun( GPIO_3, GPIO3_UART0_RXD );
|
||||
break;
|
||||
case UART1_ID:
|
||||
GPIO_PinMuxFun( GPIO_44, GPIO44_UART1_TXD );
|
||||
GPIO_PinMuxFun( GPIO_45, GPIO45_UART1_RXD );
|
||||
break;
|
||||
case UART2_ID:
|
||||
if ( uart2_redirect_pin == 0 )
|
||||
{
|
||||
GPIO_PinMuxFun( GPIO_48, GPIO48_UART2_TXD );
|
||||
GPIO_PinMuxFun( GPIO_49, GPIO49_UART2_RXD );
|
||||
} else
|
||||
{
|
||||
GPIO_PinMuxFun( GPIO_9, GPIO9_UART2_TXD );
|
||||
GPIO_PinMuxFun( GPIO_10, GPIO10_UART2_RXD );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void redirect_uart2_pin(void)
|
||||
{
|
||||
uart2_redirect_pin = 1;
|
||||
}
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
// add test mode for MiCOKit-EXT board,check Arduino_D5 pin when system startup
|
||||
bool MicoExtShouldEnterTestMode(void)
|
||||
{
|
||||
if( MicoGpioInputGet((mico_gpio_t)Arduino_D5)==false ){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,254 +1,262 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @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
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
/* EMW3031 PIN
|
||||
PIN FUN1 FUN2 FUN3 FUN4
|
||||
1/3 SWD_CLK GPIO_7
|
||||
2/4 SWD_DIO GPIO_8
|
||||
5 WAKE_UP0 GPIO_22
|
||||
6 WAKE_UP1 GPIO_23
|
||||
7 UART2_RTS GPIO_47 SPI2_CS ADC0_5
|
||||
8 UART2_CTS GPIO_46 SPI2_CLK ADC0_4
|
||||
9 UART2_TXD GPIO_48 SPI2_TXD ADC0_6
|
||||
10 UART2_RXD GPIO_49 SPI2_RXD ADC0_7
|
||||
11 RESET
|
||||
12 SPI0_CS GPIO_1 PWM0_1 UART0_RTS
|
||||
13 SPI0_MISO GPIO_3 PWM0_3 UART0_RXD
|
||||
14 SPI0_MOSI GPIO_2 PWM0_2 UART0_TXD
|
||||
15 SPI0_CLK GPIO_0 PWM0_0 UART0_CTS
|
||||
16 VCC_3V3
|
||||
17 GND
|
||||
18 GPIO_41
|
||||
19 I2C0_SDA GPIO_4 PWM0_4
|
||||
20 I2C0_CLK GPIO_5 PWM0_5
|
||||
21/24 UART1_TXD GPIO_44 ADC0_2
|
||||
22/25 UART1_RXD GPIO_45 ADC0_3
|
||||
23 GPIO_6
|
||||
26A1 I2C1_SDA GPIO_9
|
||||
27A2 I2C1_SCL GPIO_10
|
||||
28A3 GPIO_26 32K_OUT
|
||||
29A4 GND
|
||||
30B1 GPIO_43 ADC0_1
|
||||
31B2 GPIO_42 ADC0_0
|
||||
32B3 GPIO_40
|
||||
33B4 GPIO_39
|
||||
MICO_SYS_LED GPIO_16
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
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_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
MICO_GPIO_26,
|
||||
MICO_GPIO_27,
|
||||
MICO_GPIO_28,
|
||||
MICO_GPIO_29,
|
||||
MICO_GPIO_30,
|
||||
MICO_GPIO_31,
|
||||
MICO_GPIO_32,
|
||||
MICO_GPIO_33,
|
||||
MICO_SYS_LED,
|
||||
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_2,
|
||||
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_2,
|
||||
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_PWM_1,
|
||||
MICO_PWM_2,
|
||||
MICO_PWM_3,
|
||||
MICO_PWM_4,
|
||||
MICO_PWM_5,
|
||||
MICO_PWM_6,
|
||||
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,
|
||||
MICO_ADC_2,
|
||||
MICO_ADC_3,
|
||||
MICO_ADC_4,
|
||||
MICO_ADC_5,
|
||||
MICO_ADC_6,
|
||||
MICO_ADC_7,
|
||||
MICO_ADC_8,
|
||||
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_MAX, /* Denotes the total number of UART port aliases. Not a valid UART alias */
|
||||
MICO_UART_NONE,
|
||||
} mico_uart_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_FLASH_SPI,
|
||||
MICO_FLASH_MAX,
|
||||
MICO_FLASH_NONE,
|
||||
} mico_flash_t;
|
||||
|
||||
/* Donot change MICO_PARTITION_USER_MAX!! */
|
||||
typedef enum
|
||||
{
|
||||
MICO_PARTITION_USER_MAX = 0,
|
||||
MICO_PARTITION_USER = 7,
|
||||
} mico_user_partition_t;
|
||||
|
||||
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
|
||||
#define UART_FOR_APP MICO_UART_2
|
||||
#define MFG_TEST MICO_UART_2
|
||||
#define CLI_UART MICO_UART_1
|
||||
|
||||
/* Components connected to external I/Os*/
|
||||
#define Standby_SEL (MICO_GPIO_29)
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
#define BOOT_SEL MICO_GPIO_19
|
||||
#define MFG_SEL MICO_GPIO_20
|
||||
#define MICO_RF_LED MICO_GPIO_30
|
||||
#define EasyLink_BUTTON MICO_GPIO_23
|
||||
|
||||
typedef struct {
|
||||
int country_code;
|
||||
int enable_healthmon;
|
||||
int dhcp_arp_check;
|
||||
} mico_system_config_t;
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_10)
|
||||
#define Arduino_TXD (MICO_GPIO_9)
|
||||
#define Arduino_D2 (MICO_GPIO_NONE)
|
||||
#define Arduino_D3 (MICO_GPIO_18)
|
||||
#define Arduino_D4 (MICO_GPIO_5)
|
||||
#define Arduino_D5 (MICO_GPIO_6)
|
||||
#define Arduino_D6 (MICO_GPIO_32)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
|
||||
#define Arduino_D8 (MICO_GPIO_28)
|
||||
#define Arduino_D9 (MICO_GPIO_33)
|
||||
#define Arduino_CS (MICO_GPIO_12)
|
||||
#define Arduino_SI (MICO_GPIO_14)
|
||||
#define Arduino_SO (MICO_GPIO_13)
|
||||
#define Arduino_SCK (MICO_GPIO_15)
|
||||
#define Arduino_SDA (MICO_GPIO_26)
|
||||
#define Arduino_SCL (MICO_GPIO_27)
|
||||
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_6)
|
||||
#define Arduino_A3 (MICO_ADC_5)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
|
||||
#define Arduino_I2C (MICO_I2C_2)
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @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
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
/* EMW3031 PIN
|
||||
PIN FUN1 FUN2 FUN3 FUN4
|
||||
1/3 SWD_CLK GPIO_7
|
||||
2/4 SWD_DIO GPIO_8
|
||||
5 WAKE_UP0 GPIO_22
|
||||
6 WAKE_UP1 GPIO_23
|
||||
7 UART2_RTS GPIO_47 SPI2_CS ADC0_5
|
||||
8 UART2_CTS GPIO_46 SPI2_CLK ADC0_4
|
||||
9 UART2_TXD GPIO_48 SPI2_TXD ADC0_6
|
||||
10 UART2_RXD GPIO_49 SPI2_RXD ADC0_7
|
||||
11 RESET
|
||||
12 SPI0_CS GPIO_1 PWM0_1 UART0_RTS
|
||||
13 SPI0_MISO GPIO_3 PWM0_3 UART0_RXD
|
||||
14 SPI0_MOSI GPIO_2 PWM0_2 UART0_TXD
|
||||
15 SPI0_CLK GPIO_0 PWM0_0 UART0_CTS
|
||||
16 VCC_3V3
|
||||
17 GND
|
||||
18 GPIO_41
|
||||
19 I2C0_SDA GPIO_4 PWM0_4
|
||||
20 I2C0_CLK GPIO_5 PWM0_5
|
||||
21/24 UART1_TXD GPIO_44 ADC0_2
|
||||
22/25 UART1_RXD GPIO_45 ADC0_3
|
||||
23 GPIO_6
|
||||
26A1 I2C1_SDA GPIO_9
|
||||
27A2 I2C1_SCL GPIO_10
|
||||
28A3 GPIO_26 32K_OUT
|
||||
29A4 GND
|
||||
30B1 GPIO_43 ADC0_1
|
||||
31B2 GPIO_42 ADC0_0
|
||||
32B3 GPIO_40
|
||||
33B4 GPIO_39
|
||||
MICO_SYS_LED GPIO_16
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
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_GPIO_23,
|
||||
MICO_GPIO_24,
|
||||
MICO_GPIO_25,
|
||||
MICO_GPIO_26,
|
||||
MICO_GPIO_27,
|
||||
MICO_GPIO_28,
|
||||
MICO_GPIO_29,
|
||||
MICO_GPIO_30,
|
||||
MICO_GPIO_31,
|
||||
MICO_GPIO_32,
|
||||
MICO_GPIO_33,
|
||||
MICO_SYS_LED,
|
||||
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_2,
|
||||
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_2,
|
||||
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_1,
|
||||
MICO_IIS_2,
|
||||
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_4,
|
||||
MICO_PWM_5,
|
||||
MICO_PWM_6,
|
||||
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,
|
||||
MICO_ADC_2,
|
||||
MICO_ADC_3,
|
||||
MICO_ADC_4,
|
||||
MICO_ADC_5,
|
||||
MICO_ADC_6,
|
||||
MICO_ADC_7,
|
||||
MICO_ADC_8,
|
||||
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_MAX, /* Denotes the total number of UART port aliases. Not a valid UART alias */
|
||||
MICO_UART_NONE,
|
||||
} mico_uart_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MICO_FLASH_SPI,
|
||||
MICO_FLASH_MAX,
|
||||
MICO_FLASH_NONE,
|
||||
} mico_flash_t;
|
||||
|
||||
/* Donot change MICO_PARTITION_USER_MAX!! */
|
||||
typedef enum
|
||||
{
|
||||
MICO_PARTITION_USER_MAX = 0,
|
||||
MICO_PARTITION_USER = 7,
|
||||
} mico_user_partition_t;
|
||||
|
||||
|
||||
#define STDIO_UART MICO_UART_1
|
||||
#define STDIO_UART_BAUDRATE (115200)
|
||||
|
||||
#define UART_FOR_APP MICO_UART_2
|
||||
#define MFG_TEST MICO_UART_2
|
||||
#define CLI_UART MICO_UART_1
|
||||
|
||||
/* Components connected to external I/Os*/
|
||||
#define Standby_SEL (MICO_GPIO_29)
|
||||
|
||||
/* I/O connection <-> Peripheral Connections */
|
||||
#define BOOT_SEL MICO_GPIO_19
|
||||
#define MFG_SEL MICO_GPIO_20
|
||||
#define MICO_RF_LED MICO_GPIO_30
|
||||
#define EasyLink_BUTTON MICO_GPIO_23
|
||||
|
||||
typedef struct {
|
||||
int country_code;
|
||||
int enable_healthmon;
|
||||
int dhcp_arp_check;
|
||||
} mico_system_config_t;
|
||||
|
||||
/* Arduino extention connector */
|
||||
#define Arduino_RXD (MICO_GPIO_10)
|
||||
#define Arduino_TXD (MICO_GPIO_9)
|
||||
#define Arduino_D2 (MICO_GPIO_NONE)
|
||||
#define Arduino_D3 (MICO_GPIO_18)
|
||||
#define Arduino_D4 (MICO_GPIO_5)
|
||||
#define Arduino_D5 (MICO_GPIO_6)
|
||||
#define Arduino_D6 (MICO_GPIO_32)
|
||||
#define Arduino_D7 (MICO_GPIO_NONE)
|
||||
|
||||
#define Arduino_D8 (MICO_GPIO_28)
|
||||
#define Arduino_D9 (MICO_GPIO_33)
|
||||
#define Arduino_CS (MICO_GPIO_12)
|
||||
#define Arduino_SI (MICO_GPIO_14)
|
||||
#define Arduino_SO (MICO_GPIO_13)
|
||||
#define Arduino_SCK (MICO_GPIO_15)
|
||||
#define Arduino_SDA (MICO_GPIO_26)
|
||||
#define Arduino_SCL (MICO_GPIO_27)
|
||||
|
||||
#define Arduino_A0 (MICO_ADC_NONE)
|
||||
#define Arduino_A1 (MICO_ADC_NONE)
|
||||
#define Arduino_A2 (MICO_ADC_6)
|
||||
#define Arduino_A3 (MICO_ADC_5)
|
||||
#define Arduino_A4 (MICO_ADC_NONE)
|
||||
#define Arduino_A5 (MICO_ADC_NONE)
|
||||
|
||||
#define Arduino_I2C (MICO_I2C_2)
|
||||
#define Arduino_SPI (MICO_SPI_1)
|
||||
#define Arduino_UART (MICO_UART_2)
|
||||
|
||||
#ifdef USE_MiCOKit_EXT
|
||||
#define MICO_I2C_CP (Arduino_I2C)
|
||||
#include "micokit_ext_def.h"
|
||||
#else
|
||||
#define MICO_I2C_CP (MICO_I2C_NONE)
|
||||
#endif //USE_MiCOKit_EXT
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,108 +1,108 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform_config.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @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
|
||||
|
||||
#ifndef __PLATFORM_COMMON_CONFIG_H__
|
||||
#define __PLATFORM_COMMON_CONFIG_H__
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "3031B"
|
||||
#define DEFAULT_NAME "EMW3031B Module"
|
||||
#define MODEL "EMW3031B"
|
||||
|
||||
/* 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)
|
||||
|
||||
/************************************************************************
|
||||
* CPU clock */
|
||||
#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
|
||||
|
||||
/************************************************************************
|
||||
* Platform provide OTA temporary partition as secondary application partition */
|
||||
#define MICO_ENABLE_SECONDARY_APPLICATION
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
#endif
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file platform_config.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 05-Oct-2016
|
||||
* @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
|
||||
|
||||
#ifndef __PLATFORM_COMMON_CONFIG_H__
|
||||
#define __PLATFORM_COMMON_CONFIG_H__
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define HARDWARE_REVISION "3031B"
|
||||
#define DEFAULT_NAME "EMW3031B Module"
|
||||
#define MODEL "EMW3031B"
|
||||
|
||||
/* 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)
|
||||
|
||||
/************************************************************************
|
||||
* CPU clock */
|
||||
#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
|
||||
|
||||
/************************************************************************
|
||||
* Platform provide OTA temporary partition as secondary application partition */
|
||||
#define MICO_ENABLE_SECONDARY_APPLICATION
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user