This repository has been archived on 2023-06-05. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
YunHorn Technology 506e2ebaa4 reset activity threshold to 6, inactivity duration 2s 2022-09-23 13:45:28 +08:00
Core reset activity threshold to 6, inactivity duration 2s 2022-09-23 13:45:28 +08:00
EWARM M7-0920 2022-09-20 11:49:19 +08:00
LoRaWAN reset activity threshold to 6, inactivity duration 2s 2022-09-23 13:45:28 +08:00
MDK-ARM reset activity threshold to 6, inactivity duration 2s 2022-09-23 13:45:28 +08:00
STM32CubeIDE M7-0920 2022-09-20 11:49:19 +08:00
.extSettings 更新 '.extSettings' 2022-09-21 08:15:56 +08:00
.gitignore ignore file change 2022-09-21 08:12:07 +08:00
readme.txt updated readme 2022-09-22 17:32:23 +08:00

readme.txt

/**
  ******************************************************************************
  * @file    Vibration Sensor for Consumer Product Detection and Industry Level Machine Fault Analysis
  * @author  Yunhorn (r) Technology Limited Application Team	                  *
	* @brief   Yunhorn (r) SmarToilets (r) Product configuration file.						*
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2022 Yunhorn Technology Limited.
  * Copyright (c) 2022 Shenzhen Yunhorn Technology Co., Ltd.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */

============  STM32WL 55  ========================================
BUT1_PIN 	PA.0        CN10 Pin nbr 1   [PC.13 CN7 Pin nbr 23]
BUT2_PIN 	PA.1        CN10 Pin nbr 36
BUT3_PIN 	PC.6        CN10 Pin nbr 12   ////  ADXL345-INT2

#define BUT1_Pin GPIO_PIN_0
#define BUT1_GPIO_Port GPIOA
#define BUT1_EXTI_IRQn EXTI0_IRQn

#define BUT3_Pin GPIO_PIN_6
#define BUT3_GPIO_Port GPIOC
#define BUT3_EXTI_IRQn EXTI9_5_IRQn

#define BUT2_Pin GPIO_PIN_1
#define BUT2_GPIO_Port GPIOA
#define BUT2_EXTI_IRQn EXTI1_IRQn
============  STM32WL 55  ========================================

============ STM32WL55JC confirmed =============

===================================

GNG             GND=== CN7 PIN 20
VCC              3.3  ====CN7 PIN 16
===================================
SSD 1306        STM32WL55JC
-----   I2C1   --------------------------------------
SCL              PB.08  ===      CN10 pin 27 
SDA              PB.07  ===       CN10 pin 37

-----   I2C2   --------------------------------------
SCL              PA.12  ===          CN10 pin 3 
SDA              PA.15  ===          CN7  pin 17

-----   I2C3   --------------------------------------
SCL               PB.13  ===          CN7  pin 38
SDA               PB.4   ===          CN7  pin 34

--------------------SPI	  STM32WL55JC
--------------------SPI1  -------------------------------
CLK                 PA.05 ====   CN10 pin 11

MISO                PA.06 ====-  CN10 pin 13

MOSI                PA.07 ====   CN10 pin 15
=======================================


===================================

===================================

/*!
 * LoRaWAN Adaptive Data Rate
 * @note Please note that when ADR is enabled the end-device should be static
 */
#define LORAWAN_ADR_STATE                           LORAMAC_HANDLER_ADR_OFF //LORAMAC_HANDLER_ADR_ON


/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_BUTTON_Functions
  * @{
  */

/**
  * @brief  Configures Yunhorn GPIO INT1/INT2 or Sensor with EXTI Line.
  * @param  DryContactSensor: Specifies the Dry Contact Sensors to be configured.
  *         This parameter can be one of following parameters:
  *           @arg DRY_CONTACT_S1     // REED SWITCH OR WATER LEAKAGE 
  *           @arg DRY_CONTACT_S2
  *           @arg DRY_CONTACT_S3
  * @param  DRY_CONTACT_Mode: Specifies Button mode.
  *   This parameter can be one of following parameters:   
  *     @arg DRY_CONTACT_MODE_GPIO: DRY_CONTACT will be used as simple IO
  *     @arg DRY_CONTACT_MODE_EXTI: DRY_CONTACT will be connected to EXTI line with interrupt
  *                            generation capability  
  * @retval BSP status
  */
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
{
  GPIO_InitTypeDef gpio_init_structure = {0};
  static BSP_EXTI_LineCallback button_callback[BUTTONn] = {BUTTON_SW1_EXTI_Callback, BUTTON_SW2_EXTI_Callback, BUTTON_SW3_EXTI_Callback};
  static uint32_t button_interrupt_priority[BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY, BSP_BUTTON_USER_IT_PRIORITY, BSP_BUTTON_USER_IT_PRIORITY};
  static const uint32_t button_exti_line[BUTTONn] = {BUTTON_SW1_EXTI_LINE, BUTTON_SW2_EXTI_LINE, BUTTON_SW3_EXTI_LINE};

  /* Enable the BUTTON Clock */
  BUTTONx_GPIO_CLK_ENABLE(Button);
  
  gpio_init_structure.Pin = BUTTON_PIN[Button];
  gpio_init_structure.Pull = GPIO_PULLUP;
  gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;

  if(ButtonMode == BUTTON_MODE_GPIO)
  {
    /* Configure Button pin as input */
    gpio_init_structure.Mode = GPIO_MODE_INPUT;
    HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
  }
  else /* (ButtonMode == BUTTON_MODE_EXTI) */
  {
    /* Configure Button pin as input with External interrupt */
    gpio_init_structure.Mode = GPIO_MODE_IT_FALLING;

    HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);

    (void)HAL_EXTI_GetHandle(&hpb_exti[Button], button_exti_line[Button]);
    (void)HAL_EXTI_RegisterCallback(&hpb_exti[Button],  HAL_EXTI_COMMON_CB_ID, button_callback[Button]);

    /* Enable and set Button EXTI Interrupt to the lowest priority */
    HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), button_interrupt_priority[Button], 0x00);
    HAL_NVIC_EnableIRQ((BUTTON_IRQn[Button]));
  }

  return BSP_ERROR_NONE;
}

/**
  * @brief  Push Button DeInit.
  * @param  Button: Button to be configured
  *         This parameter can be one of following parameters:
  *           @arg BUTTON_SW1
  *           @arg BUTTON_SW2
  *           @arg BUTTON_SW3
  * @note PB DeInit does not disable the GPIO clock
  * @retval BSP status
  */
int32_t BSP_PB_DeInit(Button_TypeDef Button)
{
  HAL_NVIC_DisableIRQ((BUTTON_IRQn[Button]));
  HAL_GPIO_DeInit(BUTTON_PORT[Button], BUTTON_PIN[Button]);

  return BSP_ERROR_NONE;
}

/**
  * @brief  Returns the selected Button state.
  * @param  Button: Specifies the Button to be checked.
  *         This parameter can be one of following parameters:
  *           @arg BUTTON_SW1
  *           @arg BUTTON_SW2
  *           @arg BUTTON_SW3
  * @retval The Button GPIO pin value.
  */
int32_t BSP_PB_GetState(Button_TypeDef Button)
{
  return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
}

/**
  * @brief  This function handles Push-Button interrupt requests.
  * @param  Button Specifies the pin connected EXTI line
  * @retval None
  */
void BSP_PB_IRQHandler(Button_TypeDef Button)
{
  HAL_EXTI_IRQHandler(&hpb_exti[Button]);
}

/**
  * @brief  BSP Push Button callback
  * @param  Button: Specifies the Button to be checked.
  *         This parameter can be one of following parameters:
  *           @arg BUTTON_SW1
  *           @arg BUTTON_SW2
  *           @arg BUTTON_SW3
  * @retval None.
  */
__weak void BSP_PB_Callback(Button_TypeDef Button)
{
  /* Prevent unused argument(s) compilation warning */
  UNUSED(Button);

  /* This function should be implemented by the user application.
     It is called into this driver when an event on Button is triggered. */
}
===================================
===========================================================================================================
sys_sensor.c


Application/User/LoRaWAN/App
===========================================================================================================
LORA_APP.H
===/* Region ------------------------------------*/
//#define ACTIVE_REGION                               LORAMAC_REGION_EU868
#define ACTIVE_REGION                               LORAMAC_REGION_AS923

//#define LORAWAN_USER_APP_PORT                       2
#define LORAWAN_USER_APP_PORT                       11



/*!
 * Defines the application data transmission duty cycle. 10s, value in [ms].
 */
#define APP_TX_DUTYCYCLE                            60000

===========================================================================================================
/LoRaWAN/App/lora_info.c                                    
lorawan_conf.h

===========================================================================================================
/* Region ------------------------------------*/
/* the region listed here will be linked in the MW code */
/* the application (on sys_conf.h) shall just configure one region at the time */
/*#define REGION_AS923*/
/*#define REGION_AU915*/
/*#define REGION_CN470*/
/*#define REGION_CN779*/
/*#define REGION_EU433*/
#define REGION_EU868
/*#define REGION_KR920*/
/*#define REGION_IN865*/
#define REGION_US915
/*#define REGION_RU864*/
===========================================================================================================

/*    SmarToilets Products  */