├── Hardware ├── IMUCubeCTRL.PrjPCB ├── IMUCubeCTRL_Pcb.PcbDoc ├── IMUCubeCTRL_Sch.SchDoc ├── IMUCubePIN.PrjPCB ├── IMUCubePIN_Pcb.PcbDoc ├── IMUCubePIN_Sch.SchDoc ├── IMUCubeSL.PrjPCB ├── IMUCubeSL_A_Pcb.PcbDoc ├── IMUCubeSL_B_Pcb.PcbDoc ├── IMUCubeSL_C_Pcb.PcbDoc ├── IMUCubeSL_D_Pcb.PcbDoc ├── IMUCubeSL_E_Pcb.PcbDoc ├── IMUCubeSL_Sch.SchDoc └── IMUCube_Pcb.PcbDoc ├── LICENSE ├── README.md └── Software ├── IMUCube_BLE_S130_beaconAdv ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_BLE │ │ └── common │ │ │ ├── ble_advdata.c │ │ │ ├── ble_advdata.h │ │ │ ├── ble_conn_params.c │ │ │ ├── ble_conn_params.h │ │ │ ├── ble_conn_state.c │ │ │ ├── ble_conn_state.h │ │ │ ├── ble_date_time.h │ │ │ ├── ble_gatt_db.h │ │ │ ├── ble_sensor_location.h │ │ │ ├── ble_srv_common.c │ │ │ └── ble_srv_common.h │ │ ├── nRF_Drivers │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_clock.h │ │ │ ├── nrf_drv_common.h │ │ │ └── nrf_drv_uart.h │ │ ├── nrf_drv_config.h │ │ ├── nrf_drv_config_validation.h │ │ └── uart │ │ │ └── nrf_drv_uart.c │ │ ├── nRF_Libraries │ │ ├── inc │ │ │ ├── app_error.h │ │ │ ├── app_error_weak.h │ │ │ ├── app_timer.h │ │ │ ├── app_util.h │ │ │ ├── app_util_platform.h │ │ │ ├── nordic_common.h │ │ │ ├── nrf_assert.h │ │ │ ├── nrf_error.h │ │ │ ├── nrf_log.h │ │ │ ├── sdk_common.h │ │ │ ├── sdk_errors.h │ │ │ ├── sdk_macros.h │ │ │ └── sdk_os.h │ │ ├── timer │ │ │ └── app_timer.c │ │ └── util │ │ │ ├── app_error.c │ │ │ ├── app_error_weak.c │ │ │ └── app_util_platform.c │ │ └── nRF_SoftDevice │ │ ├── common │ │ ├── ant_stack_handler_types.h │ │ ├── app_ram_base.h │ │ ├── ble_stack_handler_types.h │ │ ├── softdevice_handler.c │ │ ├── softdevice_handler.h │ │ ├── softdevice_handler_appsh.c │ │ └── softdevice_handler_appsh.h │ │ └── s130 │ │ ├── ble.h │ │ ├── ble_err.h │ │ ├── ble_gap.h │ │ ├── ble_gatt.h │ │ ├── ble_gattc.h │ │ ├── ble_gatts.h │ │ ├── ble_hci.h │ │ ├── ble_l2cap.h │ │ ├── ble_ranges.h │ │ ├── ble_types.h │ │ ├── nrf_error.h │ │ ├── nrf_error_sdm.h │ │ ├── nrf_error_soc.h │ │ ├── nrf_mbr.h │ │ ├── nrf_nvic.h │ │ ├── nrf_sd_def.h │ │ ├── nrf_sdm.h │ │ ├── nrf_soc.h │ │ └── nrf_svc.h ├── Program │ ├── algorithms │ │ └── algorithm_mathUnit.h │ ├── drivers │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_ws2812b.c │ │ └── module_ws2812b.h │ └── nrf5x_conf.h ├── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx └── ues s130_nrf51_2.0.1_softdevice.txt ├── IMUCube_BLE_S130_testHardware ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_BLE │ │ └── common │ │ │ ├── ble_advdata.c │ │ │ ├── ble_advdata.h │ │ │ ├── ble_conn_params.c │ │ │ ├── ble_conn_params.h │ │ │ ├── ble_conn_state.c │ │ │ ├── ble_conn_state.h │ │ │ ├── ble_date_time.h │ │ │ ├── ble_gatt_db.h │ │ │ ├── ble_sensor_location.h │ │ │ ├── ble_srv_common.c │ │ │ └── ble_srv_common.h │ │ ├── nRF_Drivers │ │ ├── adc │ │ │ └── nrf_drv_adc.c │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_adc.h │ │ │ ├── nrf_drv_clock.h │ │ │ ├── nrf_drv_common.h │ │ │ ├── nrf_drv_spi.h │ │ │ └── nrf_drv_uart.h │ │ ├── nrf_drv_config.h │ │ ├── nrf_drv_config_validation.h │ │ ├── spi_master │ │ │ └── nrf_drv_spi.c │ │ └── uart │ │ │ └── nrf_drv_uart.c │ │ ├── nRF_Libraries │ │ ├── inc │ │ │ ├── app_error.h │ │ │ ├── app_error_weak.h │ │ │ ├── app_timer.h │ │ │ ├── app_util.h │ │ │ ├── app_util_platform.h │ │ │ ├── nordic_common.h │ │ │ ├── nrf_assert.h │ │ │ ├── nrf_error.h │ │ │ ├── nrf_log.h │ │ │ ├── sdk_common.h │ │ │ ├── sdk_errors.h │ │ │ ├── sdk_macros.h │ │ │ └── sdk_os.h │ │ ├── timer │ │ │ └── app_timer.c │ │ └── util │ │ │ ├── app_error.c │ │ │ ├── app_error_weak.c │ │ │ └── app_util_platform.c │ │ └── nRF_SoftDevice │ │ ├── common │ │ ├── ant_stack_handler_types.h │ │ ├── app_ram_base.h │ │ ├── ble_stack_handler_types.h │ │ ├── softdevice_handler.c │ │ ├── softdevice_handler.h │ │ ├── softdevice_handler_appsh.c │ │ └── softdevice_handler_appsh.h │ │ └── s130 │ │ ├── ble.h │ │ ├── ble_err.h │ │ ├── ble_gap.h │ │ ├── ble_gatt.h │ │ ├── ble_gattc.h │ │ ├── ble_gatts.h │ │ ├── ble_hci.h │ │ ├── ble_l2cap.h │ │ ├── ble_ranges.h │ │ ├── ble_types.h │ │ ├── nrf_error.h │ │ ├── nrf_error_sdm.h │ │ ├── nrf_error_soc.h │ │ ├── nrf_mbr.h │ │ ├── nrf_nvic.h │ │ ├── nrf_sd_def.h │ │ ├── nrf_sdm.h │ │ ├── nrf_soc.h │ │ └── nrf_svc.h ├── Program │ ├── algorithms │ │ ├── algorithm_mathUnit.h │ │ ├── algorithm_string.c │ │ └── algorithm_string.h │ ├── applications │ │ ├── app_kSerial.c │ │ └── app_kSerial.h │ ├── drivers │ │ ├── nrf5x_adc.c │ │ ├── nrf5x_adc.h │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ ├── nrf5x_spi.c │ │ ├── nrf5x_spi.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_mpu9250.c │ │ ├── module_mpu9250.h │ │ ├── module_serial.c │ │ ├── module_serial.h │ │ ├── module_ws2812b.c │ │ └── module_ws2812b.h │ └── nrf5x_conf.h ├── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx └── ues s130_nrf51_2.0.1_softdevice.txt ├── IMUCube_Module_MPU9250 ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_Drivers │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_clock.h │ │ │ ├── nrf_drv_common.h │ │ │ ├── nrf_drv_spi.h │ │ │ └── nrf_drv_uart.h │ │ ├── nrf_drv_config.h │ │ ├── nrf_drv_config_validation.h │ │ ├── spi_master │ │ │ └── nrf_drv_spi.c │ │ └── uart │ │ │ └── nrf_drv_uart.c │ │ └── nRF_Libraries │ │ ├── inc │ │ ├── app_error.h │ │ ├── app_error_weak.h │ │ ├── app_util.h │ │ ├── app_util_platform.h │ │ ├── nordic_common.h │ │ ├── nrf_assert.h │ │ ├── nrf_error.h │ │ ├── nrf_log.h │ │ └── sdk_errors.h │ │ └── util │ │ └── app_util_platform.c ├── Program │ ├── algorithms │ │ ├── algorithm_mathUnit.h │ │ ├── algorithm_string.c │ │ └── algorithm_string.h │ ├── drivers │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ ├── nrf5x_spi.c │ │ ├── nrf5x_spi.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_mpu9250.c │ │ ├── module_mpu9250.h │ │ ├── module_serial.c │ │ └── module_serial.h │ └── nrf5x_conf.h └── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx ├── IMUCube_Module_WS2812B ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_Drivers │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_clock.h │ │ │ └── nrf_drv_common.h │ │ ├── nrf_drv_config.h │ │ └── nrf_drv_config_validation.h │ │ └── nRF_Libraries │ │ ├── inc │ │ ├── app_error.h │ │ ├── app_error_weak.h │ │ ├── app_util.h │ │ ├── app_util_platform.h │ │ ├── nordic_common.h │ │ ├── nrf_assert.h │ │ ├── nrf_error.h │ │ ├── nrf_log.h │ │ └── sdk_errors.h │ │ └── util │ │ └── app_util_platform.c ├── Program │ ├── algorithms │ │ └── algorithm_mathUnit.h │ ├── drivers │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_ws2812b.c │ │ └── module_ws2812b.h │ └── nrf5x_conf.h └── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx ├── IMUCube_Peripheral_ADC ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_Drivers │ │ ├── adc │ │ │ └── nrf_drv_adc.c │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_adc.h │ │ │ ├── nrf_drv_clock.h │ │ │ ├── nrf_drv_common.h │ │ │ └── nrf_drv_uart.h │ │ ├── nrf_drv_config.h │ │ ├── nrf_drv_config_validation.h │ │ └── uart │ │ │ └── nrf_drv_uart.c │ │ └── nRF_Libraries │ │ ├── inc │ │ ├── app_error.h │ │ ├── app_error_weak.h │ │ ├── app_util.h │ │ ├── app_util_platform.h │ │ ├── nordic_common.h │ │ ├── nrf_assert.h │ │ ├── nrf_error.h │ │ ├── nrf_log.h │ │ └── sdk_errors.h │ │ └── util │ │ └── app_util_platform.c ├── Program │ ├── algorithms │ │ ├── algorithm_mathUnit.h │ │ ├── algorithm_string.c │ │ └── algorithm_string.h │ ├── drivers │ │ ├── nrf5x_adc.c │ │ ├── nrf5x_adc.h │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_serial.c │ │ └── module_serial.h │ └── nrf5x_conf.h └── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx ├── IMUCube_Peripheral_GPIO ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_Drivers │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_clock.h │ │ │ └── nrf_drv_common.h │ │ ├── nrf_drv_config.h │ │ └── nrf_drv_config_validation.h │ │ └── nRF_Libraries │ │ ├── inc │ │ ├── app_error.h │ │ ├── app_error_weak.h │ │ ├── app_util.h │ │ ├── app_util_platform.h │ │ ├── nordic_common.h │ │ ├── nrf_assert.h │ │ ├── nrf_error.h │ │ ├── nrf_log.h │ │ └── sdk_errors.h │ │ └── util │ │ └── app_util_platform.c ├── Program │ ├── algorithms │ │ └── algorithm_mathUnit.h │ ├── drivers │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ └── nrf5x_conf.h └── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx ├── IMUCube_Peripheral_UART ├── Libraries │ ├── CMSIS │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm4.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── system_nrf51.c │ │ ├── system_nrf51.h │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ └── nRF_Components │ │ ├── documentation │ │ ├── NordicS.jpg │ │ ├── index.html │ │ ├── license.txt │ │ ├── nRF5x_series_logo.png │ │ └── release_notes.txt │ │ ├── nRF_Drivers │ │ ├── clock │ │ │ └── nrf_drv_clock.c │ │ ├── common │ │ │ └── nrf_drv_common.c │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── inc │ │ │ ├── nrf_delay.h │ │ │ ├── nrf_drv_clock.h │ │ │ ├── nrf_drv_common.h │ │ │ └── nrf_drv_uart.h │ │ ├── nrf_drv_config.h │ │ ├── nrf_drv_config_validation.h │ │ └── uart │ │ │ └── nrf_drv_uart.c │ │ └── nRF_Libraries │ │ ├── inc │ │ ├── app_error.h │ │ ├── app_error_weak.h │ │ ├── app_util.h │ │ ├── app_util_platform.h │ │ ├── nordic_common.h │ │ ├── nrf_assert.h │ │ ├── nrf_error.h │ │ ├── nrf_log.h │ │ └── sdk_errors.h │ │ └── util │ │ └── app_util_platform.c ├── Program │ ├── algorithms │ │ ├── algorithm_mathUnit.h │ │ ├── algorithm_string.c │ │ └── algorithm_string.h │ ├── drivers │ │ ├── nrf5x_delay.c │ │ ├── nrf5x_delay.h │ │ └── nrf5x_system.h │ ├── imuCube.c │ ├── imuCube.h │ ├── imuCube_bsp.c │ ├── imuCube_bsp.h │ ├── imuCube_it.c │ ├── main.c │ ├── modules │ │ ├── module_serial.c │ │ └── module_serial.h │ └── nrf5x_conf.h └── ProjectCube │ ├── ClearFile.bat │ ├── ProjectCube.uvguix.Hom │ ├── ProjectCube.uvguix.Hom-MSI │ ├── ProjectCube.uvoptx │ └── ProjectCube.uvprojx └── IMUCube_testHardware ├── Libraries ├── CMSIS │ ├── arm_common_tables.h │ ├── arm_const_structs.h │ ├── arm_math.h │ ├── arm_startup_nrf51.s │ ├── arm_startup_nrf52.s │ ├── cmsis_armcc.h │ ├── cmsis_armcc_V6.h │ ├── cmsis_gcc.h │ ├── core_cm0.h │ ├── core_cm4.h │ ├── core_cmFunc.h │ ├── core_cmInstr.h │ ├── core_cmSimd.h │ ├── system_nrf51.c │ ├── system_nrf51.h │ ├── system_nrf52.c │ └── system_nrf52.h └── nRF_Components │ ├── documentation │ ├── NordicS.jpg │ ├── index.html │ ├── license.txt │ ├── nRF5x_series_logo.png │ └── release_notes.txt │ ├── nRF_Drivers │ ├── adc │ │ └── nrf_drv_adc.c │ ├── clock │ │ └── nrf_drv_clock.c │ ├── common │ │ └── nrf_drv_common.c │ ├── hal │ │ ├── nrf_adc.c │ │ ├── nrf_adc.h │ │ ├── nrf_clock.h │ │ ├── nrf_comp.h │ │ ├── nrf_ecb.c │ │ ├── nrf_ecb.h │ │ ├── nrf_egu.h │ │ ├── nrf_gpio.h │ │ ├── nrf_gpiote.h │ │ ├── nrf_i2s.h │ │ ├── nrf_lpcomp.h │ │ ├── nrf_nvmc.c │ │ ├── nrf_nvmc.h │ │ ├── nrf_pdm.h │ │ ├── nrf_ppi.h │ │ ├── nrf_pwm.h │ │ ├── nrf_qdec.h │ │ ├── nrf_rng.h │ │ ├── nrf_rtc.h │ │ ├── nrf_saadc.c │ │ ├── nrf_saadc.h │ │ ├── nrf_spi.h │ │ ├── nrf_spim.h │ │ ├── nrf_spis.h │ │ ├── nrf_temp.h │ │ ├── nrf_timer.h │ │ ├── nrf_twi.h │ │ ├── nrf_twim.h │ │ ├── nrf_twis.h │ │ ├── nrf_uart.h │ │ ├── nrf_uarte.h │ │ └── nrf_wdt.h │ ├── inc │ │ ├── nrf_delay.h │ │ ├── nrf_drv_adc.h │ │ ├── nrf_drv_clock.h │ │ ├── nrf_drv_common.h │ │ ├── nrf_drv_spi.h │ │ └── nrf_drv_uart.h │ ├── nrf_drv_config.h │ ├── nrf_drv_config_validation.h │ ├── spi_master │ │ └── nrf_drv_spi.c │ └── uart │ │ └── nrf_drv_uart.c │ └── nRF_Libraries │ ├── inc │ ├── app_error.h │ ├── app_error_weak.h │ ├── app_util.h │ ├── app_util_platform.h │ ├── nordic_common.h │ ├── nrf_assert.h │ ├── nrf_error.h │ ├── nrf_log.h │ └── sdk_errors.h │ └── util │ └── app_util_platform.c ├── Program ├── algorithms │ ├── algorithm_mathUnit.h │ ├── algorithm_string.c │ └── algorithm_string.h ├── drivers │ ├── nrf5x_adc.c │ ├── nrf5x_adc.h │ ├── nrf5x_delay.c │ ├── nrf5x_delay.h │ ├── nrf5x_spi.c │ ├── nrf5x_spi.h │ └── nrf5x_system.h ├── imuCube.c ├── imuCube.h ├── imuCube_bsp.c ├── imuCube_bsp.h ├── imuCube_it.c ├── main.c ├── modules │ ├── module_mpu9250.c │ ├── module_mpu9250.h │ ├── module_serial.c │ ├── module_serial.h │ ├── module_ws2812b.c │ └── module_ws2812b.h └── nrf5x_conf.h └── ProjectCube ├── ClearFile.bat ├── ProjectCube.uvguix.Hom ├── ProjectCube.uvguix.Hom-MSI ├── ProjectCube.uvoptx └── ProjectCube.uvprojx /Hardware/IMUCubeCTRL_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeCTRL_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeCTRL_Sch.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeCTRL_Sch.SchDoc -------------------------------------------------------------------------------- /Hardware/IMUCubePIN.PrjPCB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubePIN.PrjPCB -------------------------------------------------------------------------------- /Hardware/IMUCubePIN_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubePIN_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubePIN_Sch.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubePIN_Sch.SchDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL.PrjPCB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL.PrjPCB -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_A_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_A_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_B_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_B_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_C_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_C_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_D_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_D_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_E_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_E_Pcb.PcbDoc -------------------------------------------------------------------------------- /Hardware/IMUCubeSL_Sch.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCubeSL_Sch.SchDoc -------------------------------------------------------------------------------- /Hardware/IMUCube_Pcb.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Hardware/IMUCube_Pcb.PcbDoc -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ========================================================================================== 2 | 3 | *** IMUCube v2.0 Hardware License *** 4 | 5 | CC BY-SA 4.0 6 | (http://creativecommons.org/licenses/by-sa/4.0/deed.zh_TW) 7 | 8 | 9 | 你可自由: 10 | 11 | 分享 — 以任何媒介或格式重製及散布本素材。 12 | 修改 — 重混、轉換本素材、及依本素材建立新素材。 13 | 且為任何目的,包含商業性質之使用。 14 | 只要你遵守授權條款規定,授權人不能撤回你使用本素材的自由。 15 | 16 | 惟需遵照下列條件: 17 | 18 | 姓名標示 — 19 | 你必須給予適當表彰、提供指向本授權條款的連結,以及指出本素材是否已被變更。你可以任何合理方式為前述表彰,但不得以任何方式暗示授權人為你或你的使用方式背書。 20 | 21 | 相同方式分享 — 22 | 若你重混、轉換本素材,或依本素材建立新素材,你必須依本素材的授權條款來散布你的貢獻物。 23 | 24 | 不得增加額外限制 — 25 | 你不能增設法律條款或科技措施,來限制別人依授權條款本已許可的作為。 26 | 27 | 28 | ------------------------------------------------------------------------------------------ 29 | 30 | *** IMUCube Software License *** 31 | 32 | The MIT License (MIT) 33 | (http://opensource.org/licenses/MIT) 34 | 35 | Copyright (c) 2014 Hom 36 | 37 | Permission is hereby granted, free of charge, to any person obtaining a copy of 38 | this software and associated documentation files (the "Software"), to deal in 39 | the Software without restriction, including without limitation the rights to 40 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 41 | the Software, and to permit persons to whom the Software is furnished to do so, 42 | subject to the following conditions: 43 | 44 | The above copyright notice and this permission notice shall be included in all 45 | copies or substantial portions of the Software. 46 | 47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 48 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 49 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 50 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 51 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 52 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 53 | 54 | ========================================================================================== 55 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_date_time.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_date_time.h -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_sensor_location.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_sensor_location.h -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_srv_common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_BLE/common/ble_srv_common.c -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Libraries/inc/sdk_os.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** @cond */ 14 | /**@file 15 | * 16 | * @defgroup sdk_os SDK OS Abstraction 17 | * @ingroup experimental_api 18 | * @details In order to made SDK modules independent of use of an embedded OS, and permit 19 | * application with varied task architecture, SDK abstracts the OS specific 20 | * elements here in order to make all other modules agnostic to the OS or task 21 | * architecture. 22 | * @{ 23 | */ 24 | 25 | #ifndef SDK_OS_H__ 26 | #define SDK_OS_H__ 27 | 28 | #define SDK_MUTEX_DEFINE(X) 29 | #define SDK_MUTEX_INIT(X) 30 | #define SDK_MUTEX_LOCK(X) 31 | #define SDK_MUTEX_UNLOCK(X) 32 | 33 | /** 34 | * @defgroup os_data_type Data types. 35 | */ 36 | 37 | /** @} */ 38 | /** @endcond */ 39 | #endif // SDK_OS_H__ 40 | 41 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Libraries/util/app_error_weak.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_error.h" 14 | 15 | #ifdef DEBUG 16 | #include "bsp.h" 17 | #endif 18 | 19 | /*lint -save -e14 */ 20 | 21 | /** 22 | * Function is implemented as weak so that it can be overwritten by custom application error handler 23 | * when needed. 24 | */ 25 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) 26 | { 27 | // On assert, the system can only recover with a reset. 28 | #ifndef DEBUG 29 | NVIC_SystemReset(); 30 | #else 31 | 32 | #ifdef BSP_DEFINES_ONLY 33 | LEDS_ON(LEDS_MASK); 34 | #else 35 | UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR)); 36 | // This call can be used for debug purposes during application development. 37 | // @note CAUTION: Activating this code will write the stack to flash on an error. 38 | // This function should NOT be used in a final product. 39 | // It is intended STRICTLY for development/debugging purposes. 40 | // The flash write will happen EVEN if the radio is active, thus interrupting 41 | // any communication. 42 | // Use with care. Uncomment the line below to use. 43 | //ble_debug_assert_handler(error_code, line_num, p_file_name); 44 | #endif // BSP_DEFINES_ONLY 45 | 46 | app_error_save_and_stop(id, pc, info); 47 | 48 | #endif // DEBUG 49 | } 50 | 51 | /*lint -restore */ 52 | 53 | 54 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_SoftDevice/common/softdevice_handler_appsh.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "softdevice_handler_appsh.h" 14 | #include "app_scheduler.h" 15 | #include 16 | 17 | void softdevice_evt_get(void * p_event_data, uint16_t event_size) 18 | { 19 | APP_ERROR_CHECK_BOOL(event_size == 0); 20 | intern_softdevice_events_execute(); 21 | } 22 | 23 | uint32_t softdevice_evt_schedule(void) 24 | { 25 | return app_sched_event_put(NULL, 0, softdevice_evt_get); 26 | } 27 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_SoftDevice/common/softdevice_handler_appsh.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef SOFTDEVICE_HANDLER_APPSH_H 14 | #define SOFTDEVICE_HANDLER_APPSH_H 15 | 16 | #include "softdevice_handler.h" 17 | #include 18 | 19 | #define SOFTDEVICE_HANDLER_APPSH_INIT(CLOCK_SOURCE,USE_SCHEDULER) \ 20 | SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,(USE_SCHEDULER) ? softdevice_evt_schedule : NULL) 21 | 22 | uint32_t softdevice_evt_schedule(void); 23 | 24 | #endif //SOFTDEVICE_HANDLER_APPSH_H 25 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Libraries/nRF_Components/nRF_SoftDevice/s130/nrf_sd_def.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_SD_DEF_H__ 14 | #define NRF_SD_DEF_H__ 15 | 16 | #include 17 | 18 | #define SD_PPI_CHANNELS_USED 0xFFF0C000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ 19 | #define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ 20 | #define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ 21 | #define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ 22 | 23 | #endif /* NRF_SD_DEF_H__ */ 24 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_WS2812B_Config( void ); 25 | /*====================================================================================================*/ 26 | /*====================================================================================================*/ 27 | #endif 28 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_beaconAdv/ues s130_nrf51_2.0.1_softdevice.txt: -------------------------------------------------------------------------------- 1 | Flash: 108 kB (0x1B000 bytes). 2 | RAM: 4.95 kB (0x13C8 bytes) (minimum required memory). 3 | 4 | Change IROM1 Start to 0x1B000 (s130) or 0x1C000 (s132). -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_date_time.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_date_time.h -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_sensor_location.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_sensor_location.h -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_srv_common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_BLE/common/ble_srv_common.c -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Libraries/inc/sdk_os.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** @cond */ 14 | /**@file 15 | * 16 | * @defgroup sdk_os SDK OS Abstraction 17 | * @ingroup experimental_api 18 | * @details In order to made SDK modules independent of use of an embedded OS, and permit 19 | * application with varied task architecture, SDK abstracts the OS specific 20 | * elements here in order to make all other modules agnostic to the OS or task 21 | * architecture. 22 | * @{ 23 | */ 24 | 25 | #ifndef SDK_OS_H__ 26 | #define SDK_OS_H__ 27 | 28 | #define SDK_MUTEX_DEFINE(X) 29 | #define SDK_MUTEX_INIT(X) 30 | #define SDK_MUTEX_LOCK(X) 31 | #define SDK_MUTEX_UNLOCK(X) 32 | 33 | /** 34 | * @defgroup os_data_type Data types. 35 | */ 36 | 37 | /** @} */ 38 | /** @endcond */ 39 | #endif // SDK_OS_H__ 40 | 41 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Libraries/util/app_error_weak.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_error.h" 14 | 15 | #ifdef DEBUG 16 | #include "bsp.h" 17 | #endif 18 | 19 | /*lint -save -e14 */ 20 | 21 | /** 22 | * Function is implemented as weak so that it can be overwritten by custom application error handler 23 | * when needed. 24 | */ 25 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) 26 | { 27 | // On assert, the system can only recover with a reset. 28 | #ifndef DEBUG 29 | NVIC_SystemReset(); 30 | #else 31 | 32 | #ifdef BSP_DEFINES_ONLY 33 | LEDS_ON(LEDS_MASK); 34 | #else 35 | UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR)); 36 | // This call can be used for debug purposes during application development. 37 | // @note CAUTION: Activating this code will write the stack to flash on an error. 38 | // This function should NOT be used in a final product. 39 | // It is intended STRICTLY for development/debugging purposes. 40 | // The flash write will happen EVEN if the radio is active, thus interrupting 41 | // any communication. 42 | // Use with care. Uncomment the line below to use. 43 | //ble_debug_assert_handler(error_code, line_num, p_file_name); 44 | #endif // BSP_DEFINES_ONLY 45 | 46 | app_error_save_and_stop(id, pc, info); 47 | 48 | #endif // DEBUG 49 | } 50 | 51 | /*lint -restore */ 52 | 53 | 54 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_SoftDevice/common/softdevice_handler_appsh.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "softdevice_handler_appsh.h" 14 | #include "app_scheduler.h" 15 | #include 16 | 17 | void softdevice_evt_get(void * p_event_data, uint16_t event_size) 18 | { 19 | APP_ERROR_CHECK_BOOL(event_size == 0); 20 | intern_softdevice_events_execute(); 21 | } 22 | 23 | uint32_t softdevice_evt_schedule(void) 24 | { 25 | return app_sched_event_put(NULL, 0, softdevice_evt_get); 26 | } 27 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_SoftDevice/common/softdevice_handler_appsh.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef SOFTDEVICE_HANDLER_APPSH_H 14 | #define SOFTDEVICE_HANDLER_APPSH_H 15 | 16 | #include "softdevice_handler.h" 17 | #include 18 | 19 | #define SOFTDEVICE_HANDLER_APPSH_INIT(CLOCK_SOURCE,USE_SCHEDULER) \ 20 | SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,(USE_SCHEDULER) ? softdevice_evt_schedule : NULL) 21 | 22 | uint32_t softdevice_evt_schedule(void); 23 | 24 | #endif //SOFTDEVICE_HANDLER_APPSH_H 25 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Libraries/nRF_Components/nRF_SoftDevice/s130/nrf_sd_def.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_SD_DEF_H__ 14 | #define NRF_SD_DEF_H__ 15 | 16 | #include 17 | 18 | #define SD_PPI_CHANNELS_USED 0xFFF0C000uL /**< PPI channels utilized by SotfDevice (not available to the application). */ 19 | #define SD_PPI_GROUPS_USED 0x0000000CuL /**< PPI groups utilized by SoftDevice (not available to the application). */ 20 | #define SD_TIMERS_USED 0x00000001uL /**< Timers used by SoftDevice. */ 21 | #define SD_SWI_USED 0x0000003CuL /**< Software interrupts used by SoftDevice */ 22 | 23 | #endif /* NRF_SD_DEF_H__ */ 24 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/algorithms/algorithm_string.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_string.h" */ 2 | 3 | #ifndef __ALGORITHM_STRING_H 4 | #define __ALGORITHM_STRING_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef enum { 10 | Type_B = 2, // 無號數二進制 11 | Type_O = 8, // 無號數八進制 12 | Type_D = 10, // 無號數十進制 13 | Type_H = 16, // 無號數十六進制 14 | Type_I = 0, // 有號數 15 | Type_F = 1, // 浮點數 16 | } StringType; 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); 20 | uint16_t lenOfStr( char *pStr ); 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/applications/app_kSerial.h: -------------------------------------------------------------------------------- 1 | /* #include "app_kSerial.h" */ 2 | 3 | #ifndef __APP_KSERIAL_H 4 | #define __APP_KSERIAL_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | typedef enum { 10 | KS_INT8 = 0x00, // 8'b000x_xxxx, max lens = 24 11 | KS_INT16 = 0x20, // 8'b001x_xxxx, max lens = 12 12 | KS_INT32 = 0x40, // 8'b010x_xxxx, max lens = 6 13 | KS_INT64 = 0x60, // 8'b011x_xxxx, max lens = 3 14 | KS_FLOAT32 = 0xC0, // 8'b110x_xxxx, max lens = 6 15 | KS_FLOAT64 = 0xE0, // 8'b111x_xxxx, max lens = 3 16 | } KSerial_TypeDef; 17 | 18 | typedef void (*ptrSerial)(uint8_t); 19 | /*=====================================================================================================*/ 20 | /*=====================================================================================================*/ 21 | void kSerial_Config( ptrSerial pSerial ); 22 | void kSerial_SendData( void *signalData, uint8_t type, uint8_t lens ); 23 | /*=====================================================================================================*/ 24 | /*=====================================================================================================*/ 25 | #endif 26 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/drivers/nrf5x_adc.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_adc.h" */ 2 | 3 | #ifndef __NRF5x_ADC_H 4 | #define __NRF5x_ADC_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define BATTERY_VOL_CONV 0.0070157f; 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | void ADC_Config( void ); 13 | int16_t ADC_Read( nrf_adc_config_input_t channel ); 14 | /*====================================================================================================*/ 15 | /*====================================================================================================*/ 16 | #endif 17 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/drivers/nrf5x_spi.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_spi.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================* 6 | **函數 : SPI_RW 7 | **功能 : SPI Read and Write 8 | **輸入 : *SPIx, *writeData, writeLens, *readData, readLens 9 | **輸出 : None 10 | **使用 : SPI_RW(&SPIx, writeData, writeLens, readData, readLens); 11 | **====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ) 14 | { 15 | SPIx->flag = false; 16 | nrf_drv_spi_transfer(&(SPIx->instance), writeData, writeLens, readData, readLens); 17 | while(!SPIx->flag) 18 | __WFE(); 19 | } 20 | /*=====================================================================================================*/ 21 | /*=====================================================================================================*/ 22 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/drivers/nrf5x_spi.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_spi.h" */ 2 | 3 | #ifndef __NRF5x_SPI_H 4 | #define __NRF5x_SPI_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef struct { 10 | const nrf_drv_spi_t instance; 11 | __IO bool flag; 12 | } nrf_drv_kspi_t; 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ); 16 | /*====================================================================================================*/ 17 | /*====================================================================================================*/ 18 | #endif 19 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_ADC_Config( void ); 25 | void IMUCube_UART_Config( void ); 26 | void IMUCube_MPU9250_Config( void ); 27 | void IMUCube_WS2812B_Config( void ); 28 | /*====================================================================================================*/ 29 | /*====================================================================================================*/ 30 | #endif 31 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/Program/modules/module_serial.h: -------------------------------------------------------------------------------- 1 | /* #include "module_serial.h" */ 2 | 3 | #ifndef __MODULE_SERIAL_H 4 | #define __MODULE_SERIAL_H 5 | 6 | #include 7 | #include "drivers\nrf5x_system.h" 8 | #include "algorithms\algorithm_string.h" 9 | /*====================================================================================================*/ 10 | /*====================================================================================================*/ 11 | void Serial_Config( void ); 12 | 13 | void Serial_SendByte( uint8_t sendByte ); 14 | void Serial_SendData( uint8_t *sendData, uint16_t lens ); 15 | void Serial_SendStr( char *pWord ); 16 | void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); 17 | uint8_t Serial_RecvByte( void ); 18 | void Serial_RecvData( uint8_t *recvData, uint16_t lens ); 19 | //int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); 20 | //void Serial_RecvStr( char *pWord ); 21 | //int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); 22 | /*====================================================================================================*/ 23 | /*====================================================================================================*/ 24 | #endif 25 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_BLE_S130_testHardware/ues s130_nrf51_2.0.1_softdevice.txt: -------------------------------------------------------------------------------- 1 | Flash: 108 kB (0x1B000 bytes). 2 | RAM: 4.95 kB (0x13C8 bytes) (minimum required memory). 3 | 4 | Change IROM1 Start to 0x1B000 (s130) or 0x1C000 (s132). -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/algorithms/algorithm_string.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_string.h" */ 2 | 3 | #ifndef __ALGORITHM_STRING_H 4 | #define __ALGORITHM_STRING_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef enum { 10 | Type_B = 2, // 無號數二進制 11 | Type_O = 8, // 無號數八進制 12 | Type_D = 10, // 無號數十進制 13 | Type_H = 16, // 無號數十六進制 14 | Type_I = 0, // 有號數 15 | Type_F = 1, // 浮點數 16 | } StringType; 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); 20 | uint16_t lenOfStr( char *pStr ); 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/drivers/nrf5x_spi.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_spi.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================* 6 | **函數 : SPI_RW 7 | **功能 : SPI Read and Write 8 | **輸入 : *SPIx, *writeData, writeLens, *readData, readLens 9 | **輸出 : None 10 | **使用 : SPI_RW(&SPIx, writeData, writeLens, readData, readLens); 11 | **====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ) 14 | { 15 | SPIx->flag = false; 16 | nrf_drv_spi_transfer(&(SPIx->instance), writeData, writeLens, readData, readLens); 17 | while(!SPIx->flag) 18 | __WFE(); 19 | } 20 | /*=====================================================================================================*/ 21 | /*=====================================================================================================*/ 22 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/drivers/nrf5x_spi.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_spi.h" */ 2 | 3 | #ifndef __NRF5x_SPI_H 4 | #define __NRF5x_SPI_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef struct { 10 | const nrf_drv_spi_t instance; 11 | __IO bool flag; 12 | } nrf_drv_kspi_t; 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ); 16 | /*====================================================================================================*/ 17 | /*====================================================================================================*/ 18 | #endif 19 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | #include "modules\module_serial.h" 5 | #include "modules\module_mpu9250.h" 6 | 7 | #include "imuCube.h" 8 | /*====================================================================================================*/ 9 | /*====================================================================================================*/ 10 | void IMUCube_Init( void ) 11 | { 12 | IMUCube_CKOCK_Config(); 13 | IMUCube_GPIO_Config(); 14 | IMUCube_UART_Config(); 15 | IMUCube_MPU9250_Config(); 16 | } 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void IMUCube_Loop( void ) 20 | { 21 | int16_t imu[10] = {0}; 22 | 23 | while(1) { 24 | delay_ms(100); 25 | 26 | MPU9250_getData(imu); 27 | printf("AX:%5i\tAY:%5i\tAZ:%5i\tGX:%5i\tGY:%5i\tGZ:%5i\tMX:%5i\tMY:%5i\tMZ:%5i\r\n", imu[1], imu[2], imu[3], imu[4], imu[5], imu[6], imu[7], imu[8], imu[9]); 28 | } 29 | } 30 | /*====================================================================================================*/ 31 | /*====================================================================================================*/ 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_UART_Config( void ); 25 | void IMUCube_MPU9250_Config( void ); 26 | /*====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | #endif 29 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/modules/module_serial.h: -------------------------------------------------------------------------------- 1 | /* #include "module_serial.h" */ 2 | 3 | #ifndef __MODULE_SERIAL_H 4 | #define __MODULE_SERIAL_H 5 | 6 | #include 7 | #include "drivers\nrf5x_system.h" 8 | #include "algorithms\algorithm_string.h" 9 | /*====================================================================================================*/ 10 | /*====================================================================================================*/ 11 | void Serial_Config( void ); 12 | 13 | void Serial_SendByte( uint8_t sendByte ); 14 | void Serial_SendData( uint8_t *sendData, uint16_t lens ); 15 | void Serial_SendStr( char *pWord ); 16 | void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); 17 | uint8_t Serial_RecvByte( void ); 18 | void Serial_RecvData( uint8_t *recvData, uint16_t lens ); 19 | //int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); 20 | //void Serial_RecvStr( char *pWord ); 21 | //int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); 22 | /*====================================================================================================*/ 23 | /*====================================================================================================*/ 24 | #endif 25 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/Program/nrf5x_conf.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_conf.h" */ 2 | 3 | #ifndef __NRF5x_CONF_H 4 | #define __NRF5x_CONF_H 5 | /*====================================================================================================*/ 6 | /*====================================================================================================*/ 7 | //#include "nrf_adc.h" // ADC 8 | //#include "nrf_clock.h" // CLOCK 9 | //#include "nrf_ecb.h" // ECB 10 | //#include "nrf_egu.h" // EGU 11 | #include "nrf_gpio.h" // GPIO 12 | //#include "nrf_gpiote.h" // GPIOTE 13 | //#include "nrf_i2s.h" // I2S 14 | //#include "nrf_lpcomp.h" // LPCOMP 15 | //#include "nrf_nvmc.h" // NVMC 16 | //#include "nrf_pdm" // PDM 17 | //#include "nrf_ppi.h" // PPI 18 | //#include "nrf_pwm.h" // PWM 19 | //#include "nrf_qdec.h" // QDEC 20 | //#include "nrf_rng.h" // RNG 21 | //#include "nrf_rtc.h" // RTC 22 | //#include "nrf_saadc.h" // SAADC 23 | //#include "nrf_spi.h" // SPI 24 | //#include "nrf_spim.h" // SPIM 25 | //#include "nrf_spis.h" // SPIS 26 | //#include "nrf_temp.h" // TEMP 27 | //#include "nrf_timer.h" // TIMER 28 | //#include "nrf_twi.h" // TWI 29 | //#include "nrf_twim.h" // TWIM 30 | //#include "nrf_uart.h" // UART 31 | //#include "nrf_uarte.h" // UARTE 32 | //#include "nrf_wdt.h" // WDT 33 | 34 | #include "nrf_drv_clock.h" // CLOCK 35 | #include "nrf_drv_uart.h" // UART 36 | #include "nrf_drv_spi.h" // SPI 37 | /*====================================================================================================*/ 38 | /*====================================================================================================*/ 39 | #endif 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_MPU9250/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_system.h" 4 | #include "nrf5x_delay.h" 5 | 6 | #include "nrf_delay.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================* 9 | **函數 : delay_us 10 | **功能 : Delay us 11 | **輸入 : vCnt_us 12 | **輸出 : None 13 | **使用 : delay_us(times); 14 | **====================================================================================================*/ 15 | /*====================================================================================================*/ 16 | void delay_us( __IO uint32_t vCnt_us ) 17 | { 18 | nrf_delay_us(vCnt_us); 19 | } 20 | /*====================================================================================================*/ 21 | /*====================================================================================================* 22 | **函數 : delay_ms 23 | **功能 : Delay ms 24 | **輸入 : vCnt_ms 25 | **輸出 : None 26 | **使用 : delay_ms(times); 27 | **====================================================================================================*/ 28 | /*====================================================================================================*/ 29 | void delay_ms( __IO uint32_t vCnt_ms ) 30 | { 31 | while(vCnt_ms != 0) { 32 | vCnt_ms--; 33 | nrf_delay_us(999); 34 | } 35 | } 36 | /*=====================================================================================================*/ 37 | /*=====================================================================================================*/ 38 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | #include "modules\module_ws2812b.h" 5 | 6 | #include "imuCube.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ) 10 | { 11 | IMUCube_CKOCK_Config(); 12 | IMUCube_GPIO_Config(); 13 | IMUCube_WS2812B_Config(); 14 | } 15 | /*====================================================================================================*/ 16 | /*====================================================================================================*/ 17 | void IMUCube_Loop( void ) 18 | { 19 | while(1) { 20 | WS2812B_DEMO(); 21 | } 22 | } 23 | /*====================================================================================================*/ 24 | /*====================================================================================================*/ 25 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_WS2812B_Config( void ); 25 | /*====================================================================================================*/ 26 | /*====================================================================================================*/ 27 | #endif 28 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/modules/module_ws2812b.h: -------------------------------------------------------------------------------- 1 | /* #include "module_ws2812b.h" */ 2 | 3 | #ifndef __MODULE_WS2812B_H 4 | #define __MODULE_WS2812B_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define WS2812B_LOGIC_H() NRF_GPIO->OUTSET = WS_PIN; \ 10 | __ASM ( \ 11 | " NOP\n\t" \ 12 | " NOP\n\t" \ 13 | " NOP\n\t" \ 14 | " NOP\n\t" \ 15 | " NOP\n\t" \ 16 | " NOP\n\t" \ 17 | " NOP\n\t" \ 18 | " NOP\n\t" \ 19 | " NOP\n\t" \ 20 | ); \ 21 | NRF_GPIO->OUTCLR = WS_PIN; 22 | 23 | #define WS2812B_LOGIC_L() NRF_GPIO->OUTSET = WS_PIN; \ 24 | __ASM ( \ 25 | " NOP\n\t" \ 26 | ); \ 27 | NRF_GPIO->OUTCLR = WS_PIN; \ 28 | __ASM ( \ 29 | " NOP\n\t" \ 30 | " NOP\n\t" \ 31 | " NOP\n\t" \ 32 | " NOP\n\t" \ 33 | " NOP\n\t" \ 34 | " NOP\n\t" \ 35 | " NOP\n\t" \ 36 | " NOP\n\t" \ 37 | ); 38 | 39 | #define WS2812B_RESET() NRF_GPIO->OUTCLR = WS_PIN; \ 40 | delay_us(50); 41 | /*====================================================================================================*/ 42 | /*====================================================================================================*/ 43 | void WS2812B_Config( void ); 44 | 45 | void WS2812B_setRGB( uint16_t index, uint8_t r, uint8_t g, uint8_t b ); 46 | void WS2812B_sendPixel( uint16_t index, uint8_t r, uint8_t g, uint8_t b ); 47 | void WS2812B_show( void ); 48 | void WS2812B_clearAll( uint8_t r, uint8_t g, uint8_t b ); 49 | 50 | void WS2812B_testRainbow( void ); 51 | void WS2812B_testBreath( uint32_t speed ); 52 | void WS2812B_DEMO( void ); 53 | /*====================================================================================================*/ 54 | /*====================================================================================================*/ 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/Program/nrf5x_conf.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_conf.h" */ 2 | 3 | #ifndef __NRF5x_CONF_H 4 | #define __NRF5x_CONF_H 5 | /*====================================================================================================*/ 6 | /*====================================================================================================*/ 7 | //#include "nrf_adc.h" // ADC 8 | //#include "nrf_clock.h" // CLOCK 9 | //#include "nrf_ecb.h" // ECB 10 | //#include "nrf_egu.h" // EGU 11 | #include "nrf_gpio.h" // GPIO 12 | //#include "nrf_gpiote.h" // GPIOTE 13 | //#include "nrf_i2s.h" // I2S 14 | //#include "nrf_lpcomp.h" // LPCOMP 15 | //#include "nrf_nvmc.h" // NVMC 16 | //#include "nrf_pdm" // PDM 17 | //#include "nrf_ppi.h" // PPI 18 | //#include "nrf_pwm.h" // PWM 19 | //#include "nrf_qdec.h" // QDEC 20 | //#include "nrf_rng.h" // RNG 21 | //#include "nrf_rtc.h" // RTC 22 | //#include "nrf_saadc.h" // SAADC 23 | //#include "nrf_spi.h" // SPI 24 | //#include "nrf_spim.h" // SPIM 25 | //#include "nrf_spis.h" // SPIS 26 | //#include "nrf_temp.h" // TEMP 27 | //#include "nrf_timer.h" // TIMER 28 | //#include "nrf_twi.h" // TWI 29 | //#include "nrf_twim.h" // TWIM 30 | //#include "nrf_uart.h" // UART 31 | //#include "nrf_uarte.h" // UARTE 32 | //#include "nrf_wdt.h" // WDT 33 | 34 | #include "nrf_drv_clock.h" // CLOCK 35 | /*====================================================================================================*/ 36 | /*====================================================================================================*/ 37 | #endif 38 | -------------------------------------------------------------------------------- /Software/IMUCube_Module_WS2812B/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/algorithms/algorithm_string.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_string.h" */ 2 | 3 | #ifndef __ALGORITHM_STRING_H 4 | #define __ALGORITHM_STRING_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef enum { 10 | Type_B = 2, // 無號數二進制 11 | Type_O = 8, // 無號數八進制 12 | Type_D = 10, // 無號數十進制 13 | Type_H = 16, // 無號數十六進制 14 | Type_I = 0, // 有號數 15 | Type_F = 1, // 浮點數 16 | } StringType; 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); 20 | uint16_t lenOfStr( char *pStr ); 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/drivers/nrf5x_adc.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_adc.h" */ 2 | 3 | #ifndef __NRF5x_ADC_H 4 | #define __NRF5x_ADC_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define ADCx_CHANNEL 0 // AIN0 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | void ADC_Config( void ); 13 | int16_t ADC_Read( nrf_adc_config_input_t channel ); 14 | /*====================================================================================================*/ 15 | /*====================================================================================================*/ 16 | #endif 17 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | #include "drivers\nrf5x_adc.h" 5 | #include "modules\module_serial.h" 6 | 7 | #include "imuCube.h" 8 | /*====================================================================================================*/ 9 | /*====================================================================================================*/ 10 | void IMUCube_Init( void ) 11 | { 12 | IMUCube_CKOCK_Config(); 13 | IMUCube_GPIO_Config(); 14 | IMUCube_ADC_Config(); 15 | IMUCube_UART_Config(); 16 | } 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void IMUCube_Loop( void ) 20 | { 21 | uint16_t adc = 0; 22 | float vol = 0; 23 | 24 | while(1) { 25 | delay_ms(100); 26 | adc = ADC_Read(NRF_ADC_CONFIG_INPUT_7); 27 | vol = adc * 0.0070157f; 28 | printf("VOL = %2.4f V, AD = %d\r\n", vol, adc); 29 | } 30 | } 31 | /*====================================================================================================*/ 32 | /*====================================================================================================*/ 33 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_ADC_Config( void ); 25 | void IMUCube_UART_Config( void ); 26 | /*====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | #endif 29 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/Program/modules/module_serial.h: -------------------------------------------------------------------------------- 1 | /* #include "module_serial.h" */ 2 | 3 | #ifndef __MODULE_SERIAL_H 4 | #define __MODULE_SERIAL_H 5 | 6 | #include 7 | #include "drivers\nrf5x_system.h" 8 | #include "algorithms\algorithm_string.h" 9 | /*====================================================================================================*/ 10 | /*====================================================================================================*/ 11 | void Serial_Config( void ); 12 | 13 | void Serial_SendByte( uint8_t sendByte ); 14 | void Serial_SendData( uint8_t *sendData, uint16_t lens ); 15 | void Serial_SendStr( char *pWord ); 16 | void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); 17 | uint8_t Serial_RecvByte( void ); 18 | void Serial_RecvData( uint8_t *recvData, uint16_t lens ); 19 | //int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); 20 | //void Serial_RecvStr( char *pWord ); 21 | //int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); 22 | /*====================================================================================================*/ 23 | /*====================================================================================================*/ 24 | #endif 25 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_ADC/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_system.h" 4 | #include "nrf5x_delay.h" 5 | 6 | #include "nrf_delay.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================* 9 | **函數 : delay_us 10 | **功能 : Delay us 11 | **輸入 : vCnt_us 12 | **輸出 : None 13 | **使用 : delay_us(times); 14 | **====================================================================================================*/ 15 | /*====================================================================================================*/ 16 | void delay_us( __IO uint32_t vCnt_us ) 17 | { 18 | nrf_delay_us(vCnt_us); 19 | } 20 | /*====================================================================================================*/ 21 | /*====================================================================================================* 22 | **函數 : delay_ms 23 | **功能 : Delay ms 24 | **輸入 : vCnt_ms 25 | **輸出 : None 26 | **使用 : delay_ms(times); 27 | **====================================================================================================*/ 28 | /*====================================================================================================*/ 29 | void delay_ms( __IO uint32_t vCnt_ms ) 30 | { 31 | while(vCnt_ms != 0) { 32 | vCnt_ms--; 33 | nrf_delay_us(999); 34 | } 35 | } 36 | /*=====================================================================================================*/ 37 | /*=====================================================================================================*/ 38 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | void IMUCube_Init( void ) 9 | { 10 | IMUCube_CKOCK_Config(); 11 | IMUCube_GPIO_Config(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void IMUCube_Loop( void ) 16 | { 17 | while(1) { 18 | while(KEY_Read()) { 19 | BUZ_Toggle(); 20 | MOT_Set(); 21 | delay_ms(1); 22 | } 23 | MOT_Reset(); 24 | BUZ_Reset(); 25 | } 26 | } 27 | /*====================================================================================================*/ 28 | /*====================================================================================================*/ 29 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/imuCube_bsp.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube_bsp.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | void IMUCube_CKOCK_Config( void ) 9 | { 10 | nrf_drv_clock_init(); 11 | } 12 | /*====================================================================================================*/ 13 | /*====================================================================================================*/ 14 | void IMUCube_GPIO_Config( void ) 15 | { 16 | nrf_gpio_cfg(KEY, NRF_GPIO_PIN_DIR_INPUT, 17 | NRF_GPIO_PIN_INPUT_CONNECT, 18 | NRF_GPIO_PIN_PULLDOWN, 19 | NRF_GPIO_PIN_S0S1, 20 | NRF_GPIO_PIN_NOSENSE); 21 | nrf_gpio_cfg(BUZ, NRF_GPIO_PIN_DIR_OUTPUT, 22 | NRF_GPIO_PIN_INPUT_DISCONNECT, 23 | NRF_GPIO_PIN_NOPULL, 24 | NRF_GPIO_PIN_S0S1, 25 | NRF_GPIO_PIN_NOSENSE); 26 | nrf_gpio_cfg(MOT, NRF_GPIO_PIN_DIR_OUTPUT, 27 | NRF_GPIO_PIN_INPUT_DISCONNECT, 28 | NRF_GPIO_PIN_NOPULL, 29 | NRF_GPIO_PIN_S0S1, 30 | NRF_GPIO_PIN_NOSENSE); 31 | 32 | BUZ_Reset(); 33 | MOT_Reset(); 34 | } 35 | /*====================================================================================================*/ 36 | /*====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | /*====================================================================================================*/ 25 | /*====================================================================================================*/ 26 | #endif 27 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/Program/nrf5x_conf.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_conf.h" */ 2 | 3 | #ifndef __NRF5x_CONF_H 4 | #define __NRF5x_CONF_H 5 | /*====================================================================================================*/ 6 | /*====================================================================================================*/ 7 | //#include "nrf_adc.h" // ADC 8 | //#include "nrf_clock.h" // CLOCK 9 | //#include "nrf_ecb.h" // ECB 10 | //#include "nrf_egu.h" // EGU 11 | #include "nrf_gpio.h" // GPIO 12 | //#include "nrf_gpiote.h" // GPIOTE 13 | //#include "nrf_i2s.h" // I2S 14 | //#include "nrf_lpcomp.h" // LPCOMP 15 | //#include "nrf_nvmc.h" // NVMC 16 | //#include "nrf_pdm" // PDM 17 | //#include "nrf_ppi.h" // PPI 18 | //#include "nrf_pwm.h" // PWM 19 | //#include "nrf_qdec.h" // QDEC 20 | //#include "nrf_rng.h" // RNG 21 | //#include "nrf_rtc.h" // RTC 22 | //#include "nrf_saadc.h" // SAADC 23 | //#include "nrf_spi.h" // SPI 24 | //#include "nrf_spim.h" // SPIM 25 | //#include "nrf_spis.h" // SPIS 26 | //#include "nrf_temp.h" // TEMP 27 | //#include "nrf_timer.h" // TIMER 28 | //#include "nrf_twi.h" // TWI 29 | //#include "nrf_twim.h" // TWIM 30 | //#include "nrf_uart.h" // UART 31 | //#include "nrf_uarte.h" // UARTE 32 | //#include "nrf_wdt.h" // WDT 33 | 34 | #include "nrf_drv_clock.h" // CLOCK 35 | /*====================================================================================================*/ 36 | /*====================================================================================================*/ 37 | #endif 38 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_GPIO/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/algorithms/algorithm_string.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_string.h" */ 2 | 3 | #ifndef __ALGORITHM_STRING_H 4 | #define __ALGORITHM_STRING_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef enum { 10 | Type_B = 2, // 無號數二進制 11 | Type_O = 8, // 無號數八進制 12 | Type_D = 10, // 無號數十進制 13 | Type_H = 16, // 無號數十六進制 14 | Type_I = 0, // 有號數 15 | Type_F = 1, // 浮點數 16 | } StringType; 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); 20 | uint16_t lenOfStr( char *pStr ); 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | #include "modules\module_serial.h" 5 | 6 | #include "imuCube.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ) 10 | { 11 | IMUCube_CKOCK_Config(); 12 | IMUCube_GPIO_Config(); 13 | IMUCube_UART_Config(); 14 | } 15 | /*====================================================================================================*/ 16 | /*====================================================================================================*/ 17 | void IMUCube_Loop( void ) 18 | { 19 | uint8_t recvByte = 0; 20 | 21 | while(1) { 22 | recvByte = Serial_RecvByte(); 23 | if(recvByte == 0x0D) 24 | Serial_SendByte(0x0A); 25 | Serial_SendByte(recvByte); 26 | } 27 | } 28 | /*====================================================================================================*/ 29 | /*====================================================================================================*/ 30 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_UART_Config( void ); 25 | /*====================================================================================================*/ 26 | /*====================================================================================================*/ 27 | #endif 28 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/Program/modules/module_serial.h: -------------------------------------------------------------------------------- 1 | /* #include "module_serial.h" */ 2 | 3 | #ifndef __MODULE_SERIAL_H 4 | #define __MODULE_SERIAL_H 5 | 6 | #include 7 | #include "drivers\nrf5x_system.h" 8 | #include "algorithms\algorithm_string.h" 9 | /*====================================================================================================*/ 10 | /*====================================================================================================*/ 11 | void Serial_Config( void ); 12 | 13 | void Serial_SendByte( uint8_t sendByte ); 14 | void Serial_SendData( uint8_t *sendData, uint16_t lens ); 15 | void Serial_SendStr( char *pWord ); 16 | void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); 17 | uint8_t Serial_RecvByte( void ); 18 | void Serial_RecvData( uint8_t *recvData, uint16_t lens ); 19 | //int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); 20 | //void Serial_RecvStr( char *pWord ); 21 | //int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); 22 | /*====================================================================================================*/ 23 | /*====================================================================================================*/ 24 | #endif 25 | -------------------------------------------------------------------------------- /Software/IMUCube_Peripheral_UART/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/documentation/NordicS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_testHardware/Libraries/nRF_Components/documentation/NordicS.jpg -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/documentation/nRF5x_series_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitSprout/IMUCube/78a836c33c752342ef789ef4e45b907b1db61c83/Software/IMUCube_testHardware/Libraries/nRF_Components/documentation/nRF5x_series_logo.png -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_ecb.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | * $LastChangedRevision: 25419 $ 12 | */ 13 | 14 | /** 15 | * @file 16 | * @brief Implementation of AES ECB driver 17 | */ 18 | 19 | 20 | //lint -e438 21 | 22 | #include 23 | #include 24 | #include 25 | #include "nrf.h" 26 | #include "nrf_ecb.h" 27 | 28 | static uint8_t ecb_data[48]; ///< ECB data structure for RNG peripheral to access. 29 | static uint8_t* ecb_key; ///< Key: Starts at ecb_data 30 | static uint8_t* ecb_cleartext; ///< Cleartext: Starts at ecb_data + 16 bytes. 31 | static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes. 32 | 33 | bool nrf_ecb_init(void) 34 | { 35 | ecb_key = ecb_data; 36 | ecb_cleartext = ecb_data + 16; 37 | ecb_ciphertext = ecb_data + 32; 38 | 39 | NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data; 40 | return true; 41 | } 42 | 43 | 44 | bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf) 45 | { 46 | uint32_t counter = 0x1000000; 47 | if(src_buf != ecb_cleartext) 48 | { 49 | memcpy(ecb_cleartext,src_buf,16); 50 | } 51 | NRF_ECB->EVENTS_ENDECB = 0; 52 | NRF_ECB->TASKS_STARTECB = 1; 53 | while(NRF_ECB->EVENTS_ENDECB == 0) 54 | { 55 | counter--; 56 | if(counter == 0) 57 | { 58 | return false; 59 | } 60 | } 61 | NRF_ECB->EVENTS_ENDECB = 0; 62 | if(dest_buf != ecb_ciphertext) 63 | { 64 | memcpy(dest_buf,ecb_ciphertext,16); 65 | } 66 | return true; 67 | } 68 | 69 | void nrf_ecb_set_key(const uint8_t * key) 70 | { 71 | memcpy(ecb_key,key,16); 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_saadc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** 14 | * @file 15 | * @brief SAADC HAL implementation 16 | */ 17 | 18 | #include "nrf_saadc.h" 19 | 20 | void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config) 21 | { 22 | NRF_SAADC->CH[channel].CONFIG = 23 | ((config->resistor_p << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) 24 | | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) 25 | | ((config->gain << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) 26 | | ((config->reference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) 27 | | ((config->acq_time << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) 28 | | ((config->mode << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); 29 | nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n); 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/nRF_Drivers/hal/nrf_temp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef NRF_TEMP_H__ 14 | #define NRF_TEMP_H__ 15 | 16 | #include "nrf.h" 17 | 18 | /** 19 | * @defgroup nrf_temperature TEMP (temperature) abstraction 20 | * @{ 21 | * @ingroup nrf_drivers temperature_example 22 | * @brief Temperature module init and read functions. 23 | * 24 | */ 25 | 26 | /**@cond NO_DOXYGEN */ 27 | #define MASK_SIGN (0x00000200UL) 28 | #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 29 | 30 | /** 31 | * @brief Function for preparing the temp module for temperature measurement. 32 | * 33 | * This function initializes the TEMP module and writes to the hidden configuration register. 34 | */ 35 | static __INLINE void nrf_temp_init(void) 36 | { 37 | /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 38 | *(uint32_t *) 0x4000C504 = 0; 39 | } 40 | 41 | /** 42 | * @brief Function for reading temperature measurement. 43 | * 44 | * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 45 | */ 46 | static __INLINE int32_t nrf_temp_read(void) 47 | { 48 | /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 49 | return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 50 | } 51 | /**@endcond */ 52 | 53 | /** @} */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/nRF_Libraries/inc/app_error_weak.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #ifndef APP_ERROR_WEAK_H__ 14 | #define APP_ERROR_WEAK_H__ 15 | 16 | /** @file 17 | * 18 | * @defgroup app_error Common application error handler 19 | * @{ 20 | * @ingroup app_common 21 | * 22 | * @brief Common application error handler. 23 | */ 24 | 25 | /**@brief Callback function for asserts in the SoftDevice. 26 | * 27 | * @details A pointer to this function will be passed to the SoftDevice. This function will be 28 | * called by the SoftDevice if certain unrecoverable errors occur within the 29 | * application or SoftDevice. 30 | * 31 | * See @ref nrf_fault_handler_t for more details. 32 | * 33 | * @param[in] id Fault identifier. See @ref NRF_FAULT_IDS. 34 | * @param[in] pc The program counter of the instruction that triggered the fault, or 0 if 35 | * unavailable. 36 | * @param[in] info Optional additional information regarding the fault. Refer to each fault 37 | * identifier for details. 38 | * 39 | * @remarks Function is implemented as weak so that it can be overwritten by custom application 40 | * error handler when needed. 41 | */ 42 | #ifdef __CC_ARM 43 | void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 44 | #else 45 | __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info); 46 | #endif 47 | 48 | 49 | /** @} */ 50 | 51 | #endif // APP_ERROR_WEAK_H__ 52 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Libraries/nRF_Components/nRF_Libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | #include "app_util_platform.h" 14 | 15 | static uint32_t m_in_critical_region = 0; 16 | 17 | void app_util_disable_irq(void) 18 | { 19 | __disable_irq(); 20 | m_in_critical_region++; 21 | } 22 | 23 | void app_util_enable_irq(void) 24 | { 25 | m_in_critical_region--; 26 | if (m_in_critical_region == 0) 27 | { 28 | __enable_irq(); 29 | } 30 | } 31 | 32 | void app_util_critical_region_enter(uint8_t *p_nested) 33 | { 34 | #ifdef NRF52 35 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 36 | #endif 37 | 38 | #if defined(SOFTDEVICE_PRESENT) 39 | /* return value can be safely ignored */ 40 | (void) sd_nvic_critical_region_enter(p_nested); 41 | #else 42 | app_util_disable_irq(); 43 | #endif 44 | } 45 | 46 | void app_util_critical_region_exit(uint8_t nested) 47 | { 48 | #ifdef NRF52 49 | ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get()) 50 | #endif 51 | 52 | #if defined(SOFTDEVICE_PRESENT) 53 | /* return value can be safely ignored */ 54 | (void) sd_nvic_critical_region_exit(nested); 55 | #else 56 | app_util_enable_irq(); 57 | #endif 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/algorithms/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef __ALGORITHM_MATHUNIT_H 4 | #define __ALGORITHM_MATHUNIT_H 5 | 6 | #include "arm_math.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( _mathD ) (_mathD * 0.0174532925f) 12 | #define toDeg( _mathR ) (_mathR * 57.2957795f) 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/algorithms/algorithm_string.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_string.h" */ 2 | 3 | #ifndef __ALGORITHM_STRING_H 4 | #define __ALGORITHM_STRING_H 5 | 6 | #include "drivers\nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef enum { 10 | Type_B = 2, // 無號數二進制 11 | Type_O = 8, // 無號數八進制 12 | Type_D = 10, // 無號數十進制 13 | Type_H = 16, // 無號數十六進制 14 | Type_I = 0, // 有號數 15 | Type_F = 1, // 浮點數 16 | } StringType; 17 | /*====================================================================================================*/ 18 | /*====================================================================================================*/ 19 | void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); 20 | uint16_t lenOfStr( char *pStr ); 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/drivers/nrf5x_adc.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_adc.h" */ 2 | 3 | #ifndef __NRF5x_ADC_H 4 | #define __NRF5x_ADC_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | #define BATTERY_VOL_CONV 0.0070157f; 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | void ADC_Config( void ); 13 | int16_t ADC_Read( nrf_adc_config_input_t channel ); 14 | /*====================================================================================================*/ 15 | /*====================================================================================================*/ 16 | #endif 17 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/drivers/nrf5x_delay.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_delay.h" 4 | 5 | #include "nrf_delay.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================* 8 | **函數 : delay_us 9 | **功能 : Delay us 10 | **輸入 : vCnt_us 11 | **輸出 : None 12 | **使用 : delay_us(times); 13 | **====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void delay_us( __IO uint32_t vCnt_us ) 16 | { 17 | nrf_delay_us(vCnt_us); 18 | } 19 | /*====================================================================================================*/ 20 | /*====================================================================================================* 21 | **函數 : delay_ms 22 | **功能 : Delay ms 23 | **輸入 : vCnt_ms 24 | **輸出 : None 25 | **使用 : delay_ms(times); 26 | **====================================================================================================*/ 27 | /*====================================================================================================*/ 28 | void delay_ms( __IO uint32_t vCnt_ms ) 29 | { 30 | while(vCnt_ms != 0) { 31 | vCnt_ms--; 32 | nrf_delay_us(999); 33 | } 34 | } 35 | /*=====================================================================================================*/ 36 | /*=====================================================================================================*/ 37 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/drivers/nrf5x_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_delay.h" */ 2 | 3 | #ifndef __NRF5x_DELAY_H 4 | #define __NRF5x_DELAY_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void delay_us( __IO uint32_t vCnt_us ); 10 | void delay_ms( __IO uint32_t vCnt_ms ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/drivers/nrf5x_spi.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "nrf5x_spi.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================* 6 | **函數 : SPI_RW 7 | **功能 : SPI Read and Write 8 | **輸入 : *SPIx, *writeData, writeLens, *readData, readLens 9 | **輸出 : None 10 | **使用 : SPI_RW(&SPIx, writeData, writeLens, readData, readLens); 11 | **====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ) 14 | { 15 | SPIx->flag = false; 16 | nrf_drv_spi_transfer(&(SPIx->instance), writeData, writeLens, readData, readLens); 17 | while(!SPIx->flag) 18 | __WFE(); 19 | } 20 | /*=====================================================================================================*/ 21 | /*=====================================================================================================*/ 22 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/drivers/nrf5x_spi.h: -------------------------------------------------------------------------------- 1 | /* #include "nrf5x_spi.h" */ 2 | 3 | #ifndef __NRF5x_SPI_H 4 | #define __NRF5x_SPI_H 5 | 6 | #include "nrf5x_system.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | typedef struct { 10 | const nrf_drv_spi_t instance; 11 | __IO bool flag; 12 | } nrf_drv_kspi_t; 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | void SPI_RW( nrf_drv_kspi_t *SPIx, uint8_t *writeData, uint8_t writeLens, uint8_t *readData, uint8_t readLens ); 16 | /*====================================================================================================*/ 17 | /*====================================================================================================*/ 18 | #endif 19 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/imuCube.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | #include "drivers\nrf5x_adc.h" 5 | #include "modules\module_serial.h" 6 | #include "modules\module_mpu9250.h" 7 | #include "modules\module_ws2812b.h" 8 | 9 | #include "imuCube.h" 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | void IMUCube_Init( void ) 13 | { 14 | IMUCube_CKOCK_Config(); 15 | IMUCube_GPIO_Config(); 16 | IMUCube_ADC_Config(); 17 | IMUCube_UART_Config(); 18 | IMUCube_MPU9250_Config(); 19 | IMUCube_WS2812B_Config(); 20 | } 21 | /*====================================================================================================*/ 22 | /*====================================================================================================*/ 23 | void IMUCube_Loop( void ) 24 | { 25 | int16_t imu[10] = {0}; 26 | float vol = 0; 27 | 28 | WS2812B_testRainbow(); 29 | WS2812B_Clear(); 30 | 31 | while(1) { 32 | delay_ms(100); 33 | while(KEY_Read()) { 34 | BUZ_Toggle(); 35 | MOT_Set(); 36 | delay_ms(1); 37 | } 38 | MOT_Reset(); 39 | BUZ_Reset(); 40 | MPU9250_getData(imu); 41 | vol = ADC_Read(NRF_ADC_CONFIG_INPUT_7) * BATTERY_VOL_CONV; 42 | printf("AX:%5i\tAY:%5i\tAZ:%5i\tGX:%5i\tGY:%5i\tGZ:%5i\tMX:%5i\tMY:%5i\tMZ:%5i\tVB:%.2f\r\n", imu[1], imu[2], imu[3], imu[4], imu[5], imu[6], imu[7], imu[8], imu[9], vol); 43 | } 44 | } 45 | /*====================================================================================================*/ 46 | /*====================================================================================================*/ 47 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/imuCube.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube.h" */ 2 | 3 | #ifndef __IMUCUBE_H 4 | #define __IMUCUBE_H 5 | 6 | #include "imuCube_bsp.h" 7 | /*====================================================================================================*/ 8 | /*====================================================================================================*/ 9 | void IMUCube_Init( void ); 10 | void IMUCube_Loop( void ); 11 | /*====================================================================================================*/ 12 | /*====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/imuCube_bsp.h: -------------------------------------------------------------------------------- 1 | /* #include "imuCube_bsp.h" */ 2 | 3 | #ifndef __IMUCUBE_BSP_H 4 | #define __IMUCUBE_BSP_H 5 | 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | #define BUZ (0) 9 | #define BUZ_Set() __GPIO_SET(BUZ) 10 | #define BUZ_Reset() __GPIO_RST(BUZ) 11 | #define BUZ_Toggle() __GPIO_TOG(BUZ) 12 | 13 | #define MOT (24) 14 | #define MOT_Set() __GPIO_SET(MOT) 15 | #define MOT_Reset() __GPIO_RST(MOT) 16 | #define MOT_Toggle() __GPIO_TOG(MOT) 17 | 18 | #define KEY (23) 19 | #define KEY_Read() (__GPIO_READ(KEY) == 1) 20 | /*====================================================================================================*/ 21 | /*====================================================================================================*/ 22 | void IMUCube_CKOCK_Config( void ); 23 | void IMUCube_GPIO_Config( void ); 24 | void IMUCube_ADC_Config( void ); 25 | void IMUCube_UART_Config( void ); 26 | void IMUCube_MPU9250_Config( void ); 27 | void IMUCube_WS2812B_Config( void ); 28 | /*====================================================================================================*/ 29 | /*====================================================================================================*/ 30 | #endif 31 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/imuCube_it.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | /*====================================================================================================*/ 5 | /*====================================================================================================*/ 6 | void NMI_Handler( void ) { while(1); } 7 | void HardFault_Handler( void ) { while(1); } 8 | void SVC_Handler( void ) { while(1); } 9 | void PendSV_Handler( void ) { while(1); } 10 | /*====================================================================================================*/ 11 | /*====================================================================================================*/ 12 | //void SysTick_Handler( void ); 13 | //void POWER_CLOCK_IRQHandler( void ); 14 | //void RADIO_IRQHandler( void ); 15 | //void UART0_IRQHandler( void ); 16 | //void SPI0_TWI0_IRQHandler( void ); 17 | //void SPI1_TWI1_IRQHandler( void ); 18 | //void GPIOTE_IRQHandler( void ); 19 | //void ADC_IRQHandler( void ); 20 | //void TIMER0_IRQHandler( void ); 21 | //void TIMER1_IRQHandler( void ); 22 | //void TIMER2_IRQHandler( void ); 23 | //void RTC0_IRQHandler( void ); 24 | //void TEMP_IRQHandler( void ); 25 | //void RNG_IRQHandler( void ); 26 | //void ECB_IRQHandler( void ); 27 | //void CCM_AAR_IRQHandler( void ); 28 | //void WDT_IRQHandler( void ); 29 | //void RTC1_IRQHandler( void ); 30 | //void QDEC_IRQHandler( void ); 31 | //void LPCOMP_IRQHandler( void ); 32 | //void SWI0_IRQHandler( void ); 33 | //void SWI1_IRQHandler( void ); 34 | //void SWI2_IRQHandler( void ); 35 | //void SWI3_IRQHandler( void ); 36 | //void SWI4_IRQHandler( void ); 37 | //void SWI5_IRQHandler( void ); 38 | /*====================================================================================================*/ 39 | /*====================================================================================================*/ 40 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/main.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================================*/ 2 | /*====================================================================================================*/ 3 | #include "drivers\nrf5x_system.h" 4 | 5 | #include "imuCube.h" 6 | /*====================================================================================================*/ 7 | /*====================================================================================================*/ 8 | int main( void ) 9 | { 10 | IMUCube_Init(); 11 | IMUCube_Loop(); 12 | } 13 | /*====================================================================================================*/ 14 | /*====================================================================================================*/ 15 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/Program/modules/module_serial.h: -------------------------------------------------------------------------------- 1 | /* #include "module_serial.h" */ 2 | 3 | #ifndef __MODULE_SERIAL_H 4 | #define __MODULE_SERIAL_H 5 | 6 | #include 7 | #include "drivers\nrf5x_system.h" 8 | #include "algorithms\algorithm_string.h" 9 | /*====================================================================================================*/ 10 | /*====================================================================================================*/ 11 | void Serial_Config( void ); 12 | 13 | void Serial_SendByte( uint8_t sendByte ); 14 | void Serial_SendData( uint8_t *sendData, uint16_t lens ); 15 | void Serial_SendStr( char *pWord ); 16 | void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); 17 | uint8_t Serial_RecvByte( void ); 18 | void Serial_RecvData( uint8_t *recvData, uint16_t lens ); 19 | //int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); 20 | //void Serial_RecvStr( char *pWord ); 21 | //int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); 22 | /*====================================================================================================*/ 23 | /*====================================================================================================*/ 24 | #endif 25 | -------------------------------------------------------------------------------- /Software/IMUCube_testHardware/ProjectCube/ClearFile.bat: -------------------------------------------------------------------------------- 1 | del *.bak /s 2 | del *.ddk /s 3 | del *.edk /s 4 | del *.lst /s 5 | del *.lnp /s 6 | del *.mpf /s 7 | del *.mpj /s 8 | del *.obj /s 9 | del *.omf /s 10 | del *.opt /s 11 | del *.plg /s 12 | del *.rpt /s 13 | del *.tmp /s 14 | del *.__i /s 15 | del *.crf /s 16 | del *.o /s 17 | del *.d /s 18 | del *.axf /s 19 | del *.tra /s 20 | del *.dep /s 21 | del JLinkLog.txt /s 22 | 23 | del *.iex /s 24 | del *.htm /s 25 | del *.sct /s 26 | del *.hex /s 27 | del *.map /s 28 | del JLinkSettings.ini /s 29 | exit 30 | --------------------------------------------------------------------------------