From ee399bd27b7f9fd92abea3f98ec2c59a714d3c9b Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 14 Nov 2018 15:25:58 +0700 Subject: [PATCH] add sand51 project to ses --- .../ses/device_composite.emProject | 84 ++++++++++++++++++- .../metro_m4_express/board_metro_m4_express.c | 22 +++++ 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/examples/device/device_composite/ses/device_composite.emProject b/examples/device/device_composite/ses/device_composite.emProject index 0b17a19a..6406a4bc 100644 --- a/examples/device/device_composite/ses/device_composite.emProject +++ b/examples/device/device_composite/ses/device_composite.emProject @@ -27,7 +27,7 @@ link_use_linker_script_file="No" linker_memory_map_file="ses_nrf5x/nRF52840_xxAA_MemoryMap.xml" linker_section_placement_file="ses_nrf5x/flash_placement.xml" - macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;rootDir=../../../..;nrfxDir=../../../../hw/mcu/nordic/nrfx" + macros="DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;rootDir=../../../..;nrfxDir=../../../../hw/mcu/nordic/nrfx" project_directory="" project_type="Executable" target_reset_script="Reset();" @@ -99,4 +99,86 @@ path="../src" recurse="Yes" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hw/bsp/metro_m4_express/board_metro_m4_express.c b/hw/bsp/metro_m4_express/board_metro_m4_express.c index 78a72327..a4af9cec 100644 --- a/hw/bsp/metro_m4_express/board_metro_m4_express.c +++ b/hw/bsp/metro_m4_express/board_metro_m4_express.c @@ -48,6 +48,11 @@ void board_init(void) { gpio_set_pin_direction(BOARD_LED0, GPIO_DIRECTION_OUT); gpio_set_pin_level(BOARD_LED0, 1-LED_STATE_ON); + +#if CFG_TUSB_OS == OPT_OS_NONE + // Tick init + SysTick_Config(SystemCoreClock/1000); +#endif } void board_led_control(uint32_t led_id, bool state) @@ -55,3 +60,20 @@ void board_led_control(uint32_t led_id, bool state) gpio_set_pin_level(led_id, state ? LED_STATE_ON : (1-LED_STATE_ON)); } + +/*------------------------------------------------------------------*/ +/* TUSB HAL MILLISECOND + *------------------------------------------------------------------*/ +#if CFG_TUSB_OS == OPT_OS_NONE +volatile uint32_t system_ticks = 0; + +void SysTick_Handler (void) +{ + system_ticks++; +} + +uint32_t tusb_hal_millis(void) +{ + return board_tick2ms(system_ticks); +} +#endif \ No newline at end of file