mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-16 23:18:24 +08:00
修复mico-sdk错误
This commit is contained in:
@@ -1,96 +1,96 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_STmems.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 8-May-2015
|
||||
* @brief micokit st mems extension board peripherals operations..
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "mico_platform.h"
|
||||
#include "MiCOKit_STmems.h"
|
||||
|
||||
#define micokit_STmems_log(M, ...) custom_log("MICOKIT_STMEMS", M, ##__VA_ARGS__)
|
||||
#define micokit_STmems_log_trace() custom_log_trace("MICOKIT_STMEMS")
|
||||
|
||||
WEAK void micokit_STmems_key1_clicked_callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WEAK void micokit_STmems_key2_clicked_callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------- API ------------------------------------
|
||||
OSStatus micokit_STmems_init(void)
|
||||
{
|
||||
OSStatus err = kUnknownErr;
|
||||
#if defined(MICOKIT_STMEMS_KEY1)||defined(MICOKIT_STMEMS_KEY2)
|
||||
button_init_t init;
|
||||
#endif
|
||||
|
||||
//init RGB LED(P9813)
|
||||
rgb_led_init();
|
||||
rgb_led_close(); // off
|
||||
|
||||
dc_motor_init();
|
||||
dc_motor_set(0); // off
|
||||
|
||||
// init OLED
|
||||
OLED_Init();
|
||||
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_1, MODEL);
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_2, "MiCO ");
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_3, " Starting... ");
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_4, " ");
|
||||
|
||||
#ifdef MICOKIT_STMEMS_KEY1
|
||||
init.gpio = MICOKIT_STMEMS_KEY1;
|
||||
init.pressed_func = micokit_STmems_key1_clicked_callback;
|
||||
init.long_pressed_func = NULL;
|
||||
init.long_pressed_timeout = 5000;
|
||||
button_init( IOBUTTON_USER_1, init);
|
||||
#endif
|
||||
|
||||
#ifdef MICOKIT_STMEMS_KEY2
|
||||
init.gpio = MICOKIT_STMEMS_KEY2;
|
||||
init.pressed_func = micokit_STmems_key2_clicked_callback;
|
||||
init.long_pressed_func = NULL;
|
||||
init.long_pressed_timeout = 5000;
|
||||
button_init( IOBUTTON_USER_2, init);
|
||||
#endif
|
||||
|
||||
/*init HTS221 */
|
||||
err = hts221_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init HTS221" );
|
||||
|
||||
/*init UVIS25 */
|
||||
err = uvis25_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init UVIS25" );
|
||||
|
||||
/*init LSM9DS1_ACC_GYR */
|
||||
err = lsm9ds1_acc_gyr_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LSM9DS1_ACC_GYR" );
|
||||
|
||||
err = lsm9ds1_mag_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LSM9DS1_MAG" );
|
||||
|
||||
/*init LPS25HB */
|
||||
err = lps25hb_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LPS25HB" );
|
||||
|
||||
light_sensor_init();
|
||||
|
||||
exit:
|
||||
return err;
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_STmems.c
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 8-May-2015
|
||||
* @brief micokit st mems extension board peripherals operations..
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "mico_platform.h"
|
||||
#include "MiCOKit_STmems.h"
|
||||
|
||||
#define micokit_STmems_log(M, ...) custom_log("MICOKIT_STMEMS", M, ##__VA_ARGS__)
|
||||
#define micokit_STmems_log_trace() custom_log_trace("MICOKIT_STMEMS")
|
||||
|
||||
WEAK void micokit_STmems_key1_clicked_callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WEAK void micokit_STmems_key2_clicked_callback(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------- API ------------------------------------
|
||||
OSStatus micokit_STmems_init(void)
|
||||
{
|
||||
OSStatus err = kUnknownErr;
|
||||
#if defined(MICOKIT_STMEMS_KEY1)||defined(MICOKIT_STMEMS_KEY2)
|
||||
button_init_t init;
|
||||
#endif
|
||||
|
||||
//init RGB LED(P9813)
|
||||
rgb_led_init();
|
||||
rgb_led_close(); // off
|
||||
|
||||
dc_motor_init();
|
||||
dc_motor_set(0); // off
|
||||
|
||||
// init OLED
|
||||
OLED_Init();
|
||||
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_1, MODEL);
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_2, "MiCO ");
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_3, " Starting... ");
|
||||
OLED_ShowString(OLED_DISPLAY_COLUMN_START, OLED_DISPLAY_ROW_4, " ");
|
||||
|
||||
#ifdef MICOKIT_STMEMS_KEY1
|
||||
init.gpio = MICOKIT_STMEMS_KEY1;
|
||||
init.pressed_func = micokit_STmems_key1_clicked_callback;
|
||||
init.long_pressed_func = NULL;
|
||||
init.long_pressed_timeout = 5000;
|
||||
button_init( IOBUTTON_USER_1, init);
|
||||
#endif
|
||||
|
||||
#ifdef MICOKIT_STMEMS_KEY2
|
||||
init.gpio = MICOKIT_STMEMS_KEY2;
|
||||
init.pressed_func = micokit_STmems_key2_clicked_callback;
|
||||
init.long_pressed_func = NULL;
|
||||
init.long_pressed_timeout = 5000;
|
||||
button_init( IOBUTTON_USER_2, init);
|
||||
#endif
|
||||
|
||||
/*init HTS221 */
|
||||
err = hts221_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init HTS221" );
|
||||
|
||||
/*init UVIS25 */
|
||||
err = uvis25_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init UVIS25" );
|
||||
|
||||
/*init LSM9DS1_ACC_GYR */
|
||||
err = lsm9ds1_acc_gyr_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LSM9DS1_ACC_GYR" );
|
||||
|
||||
err = lsm9ds1_mag_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LSM9DS1_MAG" );
|
||||
|
||||
/*init LPS25HB */
|
||||
err = lps25hb_sensor_init();
|
||||
require_noerr_string( err, exit, "ERROR: Unable to Init LPS25HB" );
|
||||
|
||||
light_sensor_init();
|
||||
|
||||
exit:
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_ext.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 8-May-2015
|
||||
* @brief micokit st mems extension board peripherals operations..
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __MICOKIT_STMEMS_H_
|
||||
#define __MICOKIT_STMEMS_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
//------------------------- MiCOKit STmems board modules drivers ------------------
|
||||
#include "rgb_led/P9813/rgb_led.h"
|
||||
#include "display/VGM128064/oled.h"
|
||||
#include "motor/dc_motor/dc_motor.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
#include "sensor/HTS221/hts221.h"
|
||||
#include "sensor/LPS25HB/lps25hb.h"
|
||||
#include "sensor/UVIS25/uvis25.h"
|
||||
#include "sensor/LSM9DS1/lsm9ds1.h"
|
||||
#include "sensor/light_adc/light_sensor.h"
|
||||
|
||||
|
||||
/** @addtogroup MICO_Drivers_interface
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup MiCOKit_STmems_Driver MiCOKit STmems Driver
|
||||
* @brief Provide device driver interface for MiCOKitSTmems board
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MiCOKit_STmems_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MiCOKit_STmems_Init MiCOKit STmems Init
|
||||
* @brief Provide init api for MiCOKit STmems board
|
||||
* @{
|
||||
*/
|
||||
|
||||
//--------------------------- MiCOKit STmems board info ---------------------------
|
||||
#define MICOKIT_STMEMS_MANUFACTURER "MXCHIP"
|
||||
#define MICOKIT_STMEMS_NAME "MiCOKit-STmems"
|
||||
|
||||
#define MFG_TEST_MAX_MODULE_NUM 8
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief MiCOKit STmems board initialization
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus micokit_STmems_init(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // __MICOKIT_STMEMS_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_ext.h
|
||||
* @author William Xu
|
||||
* @version V1.0.0
|
||||
* @date 8-May-2015
|
||||
* @brief micokit st mems extension board peripherals operations..
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __MICOKIT_STMEMS_H_
|
||||
#define __MICOKIT_STMEMS_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
//------------------------- MiCOKit STmems board modules drivers ------------------
|
||||
#include "rgb_led/P9813/rgb_led.h"
|
||||
#include "display/VGM128064/oled.h"
|
||||
#include "motor/dc_motor/dc_motor.h"
|
||||
#include "keypad/gpio_button/button.h"
|
||||
|
||||
#include "sensor/HTS221/hts221.h"
|
||||
#include "sensor/LPS25HB/lps25hb.h"
|
||||
#include "sensor/UVIS25/uvis25.h"
|
||||
#include "sensor/LSM9DS1/lsm9ds1.h"
|
||||
#include "sensor/light_adc/light_sensor.h"
|
||||
|
||||
|
||||
/** @addtogroup MICO_Drivers_interface
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup MiCOKit_STmems_Driver MiCOKit STmems Driver
|
||||
* @brief Provide device driver interface for MiCOKitSTmems board
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MiCOKit_STmems_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MiCOKit_STmems_Init MiCOKit STmems Init
|
||||
* @brief Provide init api for MiCOKit STmems board
|
||||
* @{
|
||||
*/
|
||||
|
||||
//--------------------------- MiCOKit STmems board info ---------------------------
|
||||
#define MICOKIT_STMEMS_MANUFACTURER "MXCHIP"
|
||||
#define MICOKIT_STMEMS_NAME "MiCOKit-STmems"
|
||||
|
||||
#define MFG_TEST_MAX_MODULE_NUM 8
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief MiCOKit STmems board initialization
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus micokit_STmems_init(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // __MICOKIT_STMEMS_H_
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
#
|
||||
# UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
# Copyright (c) 2016 MXCHIP Inc.
|
||||
#
|
||||
# The contents of this file may not be disclosed to third parties, copied or
|
||||
# duplicated in any form, in whole or in part, without the prior written
|
||||
# permission of MXCHIP Corporation.
|
||||
#
|
||||
|
||||
NAME := Lib_MiCOKit_STmems
|
||||
|
||||
$(NAME)_SOURCES := MiCOKit_STmems.c
|
||||
|
||||
GLOBAL_INCLUDES := . \
|
||||
..
|
||||
|
||||
$(NAME)_COMPONENTS += drivers/display/VGM128064 \
|
||||
drivers/keypad/gpio_button \
|
||||
drivers/motor/dc_motor \
|
||||
drivers/rgb_led/P9813 \
|
||||
drivers/sensor/HTS221 \
|
||||
drivers/sensor/UVIS25 \
|
||||
drivers/sensor/LSM9DS1 \
|
||||
drivers/sensor/LPS25HB \
|
||||
#
|
||||
# UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
# Copyright (c) 2016 MXCHIP Inc.
|
||||
#
|
||||
# The contents of this file may not be disclosed to third parties, copied or
|
||||
# duplicated in any form, in whole or in part, without the prior written
|
||||
# permission of MXCHIP Corporation.
|
||||
#
|
||||
|
||||
NAME := Lib_MiCOKit_STmems
|
||||
|
||||
$(NAME)_SOURCES := MiCOKit_STmems.c
|
||||
|
||||
GLOBAL_INCLUDES := . \
|
||||
..
|
||||
|
||||
$(NAME)_COMPONENTS += drivers/display/VGM128064 \
|
||||
drivers/keypad/gpio_button \
|
||||
drivers/motor/dc_motor \
|
||||
drivers/rgb_led/P9813 \
|
||||
drivers/sensor/HTS221 \
|
||||
drivers/sensor/UVIS25 \
|
||||
drivers/sensor/LSM9DS1 \
|
||||
drivers/sensor/LPS25HB \
|
||||
drivers/sensor/light_adc
|
||||
@@ -1,44 +1,44 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_stmems.h
|
||||
* @author Willian Xu
|
||||
* @version V1.0.0
|
||||
* @date 20-May-2015
|
||||
* @brief micokit st mems extension board peripherals pin defines.
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __MICOKIT_STMEMS_DEF_H_
|
||||
#define __MICOKIT_STMEMS_DEF_H_
|
||||
|
||||
//-------------------------- MicoKit-EXT board pin define ----------------------
|
||||
|
||||
#define SSD1106_USE_I2C
|
||||
#define OLED_I2C_PORT (Arduino_I2C)
|
||||
|
||||
|
||||
#define P9813_PIN_CIN (Arduino_D9)
|
||||
#define P9813_PIN_DIN (Arduino_D8)
|
||||
|
||||
#define DC_MOTOR (MICO_GPIO_21)
|
||||
|
||||
#define MICOKIT_STMEMS_KEY1 (Arduino_D5)
|
||||
#define MICOKIT_STMEMS_KEY2 (Arduino_D6)
|
||||
|
||||
#define HTS221_I2C_PORT (Arduino_I2C)
|
||||
#define LPS25HB_I2C_PORT (Arduino_I2C)
|
||||
#define UVIS25_I2C_PORT (Arduino_I2C)
|
||||
#define LSM9DS1_I2C_PORT (Arduino_I2C)
|
||||
|
||||
#define LIGHT_SENSOR_ADC (Arduino_A2)
|
||||
|
||||
#endif // __MICOKIT_EXT_DEF_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file micokit_stmems.h
|
||||
* @author Willian Xu
|
||||
* @version V1.0.0
|
||||
* @date 20-May-2015
|
||||
* @brief micokit st mems extension board peripherals pin defines.
|
||||
******************************************************************************
|
||||
* UNPUBLISHED PROPRIETARY SOURCE CODE
|
||||
* Copyright (c) 2016 MXCHIP Inc.
|
||||
*
|
||||
* The contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of MXCHIP Corporation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __MICOKIT_STMEMS_DEF_H_
|
||||
#define __MICOKIT_STMEMS_DEF_H_
|
||||
|
||||
//-------------------------- MicoKit-EXT board pin define ----------------------
|
||||
|
||||
#define SSD1106_USE_I2C
|
||||
#define OLED_I2C_PORT (Arduino_I2C)
|
||||
|
||||
|
||||
#define P9813_PIN_CIN (Arduino_D9)
|
||||
#define P9813_PIN_DIN (Arduino_D8)
|
||||
|
||||
#define DC_MOTOR (MICO_GPIO_21)
|
||||
|
||||
#define MICOKIT_STMEMS_KEY1 (Arduino_D5)
|
||||
#define MICOKIT_STMEMS_KEY2 (Arduino_D6)
|
||||
|
||||
#define HTS221_I2C_PORT (Arduino_I2C)
|
||||
#define LPS25HB_I2C_PORT (Arduino_I2C)
|
||||
#define UVIS25_I2C_PORT (Arduino_I2C)
|
||||
#define LSM9DS1_I2C_PORT (Arduino_I2C)
|
||||
|
||||
#define LIGHT_SENSOR_ADC (Arduino_A2)
|
||||
|
||||
#endif // __MICOKIT_EXT_DEF_H_
|
||||
|
||||
Reference in New Issue
Block a user