void  BSP_Init (void)
{
		// Interrupt initialization
    BSP_IntInit();
		
		// Initailize system services, clocks, etc.
    BSP_SysInit();             

		// RGB LED initialization
    BSP_LED_Init();
	
		// Push Button initialization
		BSP_SWITCH_Init();
	
		// PIR sensor initialization
		BSP_PIR_Init();
	
		// UART initialization
		BSP_UART_Init();
	
		// Semaphore Create
		sharedDataSem = OSSemCreate(1);
		
		// semaphore Create
		sharedDataSemUart = OSSemCreate(1);
		
		// Mailbox Create
		MailBox1 = OSMboxCreate(&global_pir_val);
	
}
Esempio n. 2
0
void BSP_Init(void) {
	BSP_RCC_Init();
	BSP_UART_Init();
	BSP_SW_Init();
	BSP_ADC_Init();
	BSP_LEDS_Init();
}
Esempio n. 3
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */

  /* Initialize VCP */
  BSP_UART_Init(115200);
  uprintf("First LED is blinking in normal mode...\n\r");
  uprintf("Press '1' to enter system in sleep mode.\n\r");
  uprintf("If you want to wake-up the system,\n\r");
  uprintf("press INT/WAKE-UP button (High to Low transition on P2.10).\n\r");
  uprintf("OR Press any key on keyboard (UART Interrupt will be triggered).\n\r");

  /* Initialize On Board LEDs */
  BSP_LED_Init(LED5);
  BSP_LED_Init(LED6);
  BSP_PB_Init(BUTTON_KEY,BUTTON_MODE_EXTI);
  while(ugetche(NONE_BLOCKING) !='1')
  {
    /* Blink LED P0.10 */
    BSP_LED_Toggle(LED5);
    HAL_Delay(500);
  }
  uprintf("\n\n\rSleeping...");
  BSP_Sleepmode_PB();
  /* MCU will be here after waking up */
  uprintf("\n\n\rSystem wake-up! Second LED is blinking...");
  /* Turn off LED */
  BSP_LED_Off(LED5);

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    BSP_LED_Toggle(LED6);
    HAL_Delay(500);
  }
  /* USER CODE END 3 */

}
Esempio n. 4
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t Buf[0x10],Buf1[0x10];
  uint16_t i;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  trace_printf("Hello\n");
  BSP_UART_Init(115200);

  /* Initialize I2C */
  ASK25_I2C1_Init();

  /* Initialize virtual com port */
  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected

  for(i=0;i<sizeof(Buf);i++)
  {
    Buf[i] = i;
  }

  /* Write Array to EEPROM */
  ASK25_AT24C16_Write(0x106,Buf,sizeof(Buf));

  /* Read from EEPROM */
  ASK25_AT24C16_Read(0x106,Buf1,sizeof(Buf1));

  /* Print to virtual Com port */
  ASK25_AT24C16_Display_Array(Buf1,sizeof(Buf1));

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 5
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t data1[0x10],data2[0x10],i;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  trace_printf("Hello\n");
  BSP_UART_Init(115200);

  /* Initialize SPI */
  ASK25_SPI1_Init();

  /* Initialize virtual com port */
  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected
  ASK25_25AA160A_Write_Status_Reg(0x00);
  for(i=0;i<sizeof(data1);i++)
  {
    data1[i] = i;
  }
  /* Write Array to EEPROM */
  ASK25_25AA160A_Write(0x0000,data1,sizeof(data1));

  /* Read from EEPROM */
  ASK25_25AA160A_Read(0x0000,data2,sizeof(data2));

  /* Print to virtual Com port */
  ASK25_25AA160A_Display_Array(data2,sizeof(data2));

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 6
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint32_t test;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Initialize on board LED4 */
  BSP_LED_Init(LED4);

  trace_printf("Hello\n");

  /* Configure MPU region */
  MPU_Config();

  /* Try to access memory region 1 */
  uprintf("Trying to read memory from region 1\n\r");
  test = (*(unsigned int *)0x08000010);
  uprintf("some value at location 0x08000010: %08x \n\r",test );
  uprintf("Read successful!!!\n\r");

  /* Try to access memory region 2 */
  uprintf("Trying to read memory from region 2\n\r");
  uprintf("Memory management fault occur: LED4 will Glow");
  test = (*(unsigned int *)0x20002001);
  uprintf("some value at location 0x20002001: %08x \n\r",test );

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 7
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(9600);
  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected
  /* display string */
  vuprintf("AT\n\r");
  HAL_Delay(500);
  if(BSP_GSM_ConnectTest()==1)
  {
    /* display string */
    vuprintf("Connecting... \n\r");
    HAL_Delay(500);

    vuprintf("Successful! \n\r");
    HAL_Delay(500);
  }
  else
  {
    vuprintf("Fail \n\r");
    while(1);
  }
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 8
0
static  void  App_TaskStart (void *p_arg)
{
    OS_ERR  os_err;

    (void)p_arg;                                                /* See Note #1.                                         */

    BSP_Init();                                                 /* Start BSP and tick initialization.                   */

    BSP_Tick_Init();                                            /* Start Tick Initialization.                           */
	
    BSP_UART_Init(BSP_UART_DEFAULT,                             /* Start UART Initialization                            */
	                BSP_BUSCLK,
	                9600);

    BSP_LCD_Init();                                             /* Initialize the seven-segment display panel.          */

#if OS_CFG_STAT_TASK_EN > 0u
    OSStatTaskCPUUsageInit(&os_err);                            /* Compute CPU capacity with no task running            */
#endif

#ifdef  CPU_CFG_INT_DIS_MEAS_EN
    CPU_IntDisMeasMaxCurReset();
#endif

    APP_TRACE_INFO(("Creating Application Events...\n\r"));
    App_ObjCreate();                                            /* Create Applicaton kernel objects.                    */

    APP_TRACE_INFO(("Creating Application Tasks...\n\r"));
    App_TaskCreate();                                           /* Create Application tasks.                            */

    while (DEF_TRUE) {                                          /* Task body, always written as an infinite loop.       */

        OSTimeDlyHMSM(0, 0, 2, 0,
                      OS_OPT_TIME_HMSM_STRICT, &os_err);
//		  BSP_UART_Send_String(BSP_UART_1,
//				             "Hello\n");
        uart_printf("Hello world\n");
        OSTimeDly(10, OS_OPT_TIME_HMSM_STRICT, &os_err);
        uart_printf("os_err = %d\n", os_err);
			  
//			  while (BSP_SW_Read (BSP_SW_1) != DEF_ON) {
//					  OSTimeDly(1, OS_OPT_TIME_HMSM_STRICT, &os_err);
//				}
//				BSP_LED_Toggle(BSP_LED_RED);
//				
//				BSP_UART_Send_String(BSP_UART_1,
//				                     "Hello\n");
//				
//				while (BSP_SW_Read (BSP_SW_1) == DEF_OFF) {
//			      OSTimeDly(1, OS_OPT_TIME_HMSM_STRICT, &os_err);
//				}
    }
}
Esempio n. 9
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  RTC_TimeTypeDef Tim;
  RTC_DateTypeDef Dat;

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  /* Initialize LED 4 */
  BSP_LED_Init(LED4);
  /* Initialize RTC */
  BSP_RTC_Init();

  BSP_RTC_Alarm_Init(AlarmA,0,0,5,RTC_ALARMDATEWEEKDAYSEL_DATE); //Generate alarm interrupt
  /* Initialize UART with 115200 baud rate */
  BSP_UART_Init(115200);

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    __HAL_RTC_ALARM_CLEAR_FLAG(&hrtc_bsp,RTC_ISR_ALRAF);
    __HAL_RTC_ALARM_CLEAR_FLAG(&hrtc_bsp,RTC_ISR_ALRBF);
    HAL_RTC_GetTime(&hrtc_bsp,&Tim,FORMAT_BIN);
    HAL_RTC_GetDate(&hrtc_bsp,&Dat,FORMAT_BIN);
    Tim.SubSeconds = 1000 - ((hrtc_bsp.Instance->SSR*1000)/hrtc_bsp.Init.SynchPrediv);                // Count msec
    uprintf("\x1b[3;1H %d02 : %d02 : %d02 : %d04",Tim.Hours,Tim.Minutes,Tim.Seconds,Tim.SubSeconds);
//    uprintf("\x1b[4;1H %d02 / %d02 / %d04", Dat.Date,Dat.Month,Dat.Year);

  }
  /* USER CODE END 3 */

}
Esempio n. 10
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t i;

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Initialize GPIOE.8 to 15 as data pin and GPIOB.4 - 5 as Segment selection and gate pin */
  ASK25_7Segment_Init();

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    for(i=9;i>=0;i--)
    {
      /* Select Segment 1 and display digit 2 */
      ASK25_7Segment_Display_Digit(i,ASEGMENT2);
      HAL_Delay(1000);
      if(i == 0)
      {
        i = 10;
      }
    }

  /* USER CODE END 3 */
  }

}
Esempio n. 11
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t Data,Read[10];
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  uprintf("Write single Character:\t");

  /* Receive data on UART 6 */
  Data = ugetche(BLOCKING);
  uprintf("\r\n character in hex %x03 in dec %d03 in char %c in uhex %u and %b\n\r",Data,Data,Data,Data,23);
  uprintf("Write 10 Character:\t");

  /* Receive string on UART 6 */
  uget_line(Read,sizeof(Read));
  uprintf("\n\rPrinted Line: %s",Read);

  trace_printf("Hello\n");

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 12
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);
  /* initialization of port GPIOD pin 12 13 14 15 */
  BSP_LED_Init(LED4);
  BSP_LED_Init(LED3);
  BSP_LED_Init(LED5);
  BSP_LED_Init(LED6);

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

      BSP_LED_Toggle(LED4);
      BSP_LED_Toggle(LED3);
      BSP_LED_Toggle(LED5);
      BSP_LED_Toggle(LED6);

      HAL_Delay(500); // .5 msec delay
  }
  /* USER CODE END 3 */

}
Esempio n. 13
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  RTC_TimeTypeDef Tim;
  RTC_DateTypeDef Dat;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */

  /* Initialize RTC */
  BSP_RTC_Init();
  /* Initialize UART with 115200 baud rate */
  BSP_UART_Init(115200);
  uprintf("Set Time: ");
  BSP_RTC_Change_Time();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    HAL_RTC_GetTime(&hrtc_bsp,&Tim,FORMAT_BIN);
    HAL_RTC_GetDate(&hrtc_bsp,&Dat,FORMAT_BIN);
    Tim.SubSeconds = 1000 - ((hrtc_bsp.Instance->SSR*1000)/hrtc_bsp.Init.SynchPrediv);                // Count msec
    uprintf("\x1b[3;1H %d02 : %d02 : %d02 : %d04",Tim.Hours,Tim.Minutes,Tim.Seconds,Tim.SubSeconds);


  }
  /* USER CODE END 3 */

}
Esempio n. 14
0
int main(void)
{

  /* USER CODE BEGIN 1 */


  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Initialize GPIOE.4 to 7 as Switches */
  ASK25_PB_Init(ABUTTON_KEY1, ABUTTON_MODE_GPIO);

  /* Initialize GPIO B.0 as output pin */
   ASK25_Relay_Init();

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    if(ASK25_PB_GetState(ABUTTON_KEY1) == RESET)
    {
      HAL_GPIO_TogglePin(RELAY_PORT, RELAY_PIN);
      HAL_Delay(500);
    }
  /* USER CODE END 3 */
  }

}
Esempio n. 15
0
int main(void)
{

    /* USER CODE BEGIN 1 */

    /* USER CODE END 1 */

    /* MCU Configuration----------------------------------------------------------*/

    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();

    /* Configure the system clock */
    SystemClock_Config();

    /* Initialize all configured peripherals */
    MX_GPIO_Init();

    /* USER CODE BEGIN 2 */
    BSP_UART_Init(115200);

    /* initialize LCD */
    ASK25_LCD_Init(Inc, DispShiftOff);


    trace_printf("Hello\n");
    /* USER CODE END 2 */

    /* Infinite loop */
    /* USER CODE BEGIN WHILE */
    while (1)
    {
        /* USER CODE END WHILE */

        /* USER CODE BEGIN 3 */
        /* display blinking message */
        ASK25_LCD_Display_String("EDUTECH",1,1,Off);
        ASK25_LCD_Display_String("SYSTEMS",2,3,Off);
        HAL_Delay(500);
        ASK25_LCD_Display_String("       ",1,1,Off);
        ASK25_LCD_Display_String("       ",2,3,Off);
        HAL_Delay(500);
    }
    /* USER CODE END 3 */

}
Esempio n. 16
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  char byte, read[10];
  int check;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);



  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

    vuprintf("Hello %d02 %x02 %s %c",50,50,"world",'A');
    HAL_Delay(500);
    vget_line(read, 10);
    vuprintf(read);
  }
  /* USER CODE END 3 */

}
Esempio n. 17
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t Data;
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Receive data on UART 6 */

  HAL_UART_Receive_DMA(&huart6,&Data,1);
  trace_printf("Hello\n");

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    if(UartReady == 1)
    {
      HAL_UART_Transmit_DMA(&huart6,&Data,1);
      UartReady = 0;
    }
  }
  /* USER CODE END 3 */

}
Esempio n. 18
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Initialize Stepper Motor pins */
  ASK25_SM_Init();

  /* rotate stepper motor fix 90 degree with delay 60 */
  ASK25_SM_Rotate(MotorClockwise,90,60);

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 19
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

 /* Initialize DCMotor pin */
  ASK25_DCMotor_Init();

  /* Rotate motor  clockwise direction */
  ASK25_DCMotor_Rotate(MotorClockwise);

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 20
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* initialize LCD */
  ASK25_LCD_Init(Inc, DispShiftOff);

  /* display single character */
  ASK25_LCD_Write_Data('A');

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 21
0
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* initialize GPIOE.8 as output pin to blink LED on ASK25 */
  ASK25_LED_Init(ALEDALL);
  ASK25_LED_Off(ALEDALL);

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    ASK25_LED_Toggle(ALED1);
    HAL_Delay(500);     //0.5 msec delay
  }
  /* USER CODE END 3 */

}
Esempio n. 22
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t key=0;

  trace_printf("%d",c);
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* Initialize LCD Display */
  ASK25_LCD_Init(Inc,DispShiftOff);

  /* Initialize MAT-KEY */
  ASK25_MatKey_Init();

  /* Display key code */
  ASK25_LCD_Display_String("Key Code:",1,1,Off);


  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    /* Display pressed key number */
    key = ASK25_MatKey_Detect_Key();
    if (key == 11)
    {
      ASK25_LCD_Display_Character('1',2,1,Off);
    }
    else if (key == 12)
    {
      ASK25_LCD_Display_Character('2',2,1,Off);
    }
    else if (key == 21)
    {
      ASK25_LCD_Display_Character('3',2,1,Off);
    }
    else if (key == 22)
    {
      ASK25_LCD_Display_Character('4',2,1,Off);
    }
  }
  /* USER CODE END 3 */

}
Esempio n. 23
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  uint8_t ch;
  uint32_t DBGU_RxBufferTail = 0;
  uint32_t DBGU_RxBufferHead = 0;
  uint8_t DBGU_RxBuffer[DBGU_RX_BUFFER_SIZE];
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);
  SN8200_HAL_Init(921600);
  uprintf("\n\rHello!\n\r");
  uprintf("\n\r");

  WifiOn(seqNo++);
  uprintf("\n\r");

  ShowMenu();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */
  /* USER CODE BEGIN 3 */
    if(HAL_UART_Receive(&huart6,&ch,1,100) == HAL_OK)
    {
      switch (ch)
      {
       case 0x7F:
         if(DBGU_RxBufferHead != DBGU_RxBufferTail)
         {
           DBGU_RxBufferHead = (DBGU_RxBufferHead - 1) % DBGU_RX_BUFFER_SIZE;
           HAL_UART_Transmit_IT(&huart6,0x7F,1);
         }
         break;

       case 0x0D:
         DBGU_RxBuffer[DBGU_RxBufferHead] = ch;
         DBGU_RxBufferHead = (DBGU_RxBufferHead + 1) % DBGU_RX_BUFFER_SIZE;
         DBGU_InputReady = 1;
         break;

       case In_BACKSPACE:
         HAL_UART_Transmit_IT(&huart6,&ch,1);
         break;

       default:
         DBGU_RxBuffer[DBGU_RxBufferHead] = ch;
         HAL_UART_Transmit_IT(&huart6,&ch,1);
         DBGU_RxBufferHead = (DBGU_RxBufferHead + 1) % DBGU_RX_BUFFER_SIZE;
         key = ch;
         break;
      }
    }
    if(DBGU_InputReady)
    {
      ProcessUserInput();
    }
    if(SN8200_API_HasInput())
    {
      ProcessSN8200Input();
    }
    if(quit_flag)
    {
      break;
    }
  }
  uprintf("Goodbye\n\r");
  /* USER CODE END 3 */
}
Esempio n. 24
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  uint8_t Character1[8] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1};
  uint8_t Character2[8] = {0x0, 0x0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x1f};
  uint8_t Character3[8] = {0x7, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
  uint8_t Character4[8] = {0x18, 0x1c, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};

  uint8_t Character5[8] = {0x3, 0x7, 0xf, 0xf, 0x1f, 0x1f, 0x1f, 0x1e};
  uint8_t Character6[8] = {0x1e, 0x1f, 0x1b, 0x03, 0x1b, 0x1f, 0x1e,0x00};
  uint8_t Character7[8] = {0x13, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x18,0x1c};
  uint8_t Character8[8] = {0x07, 0x0f, 0x0f, 0x0e, 0x0e, 0x0c, 0x0c,0x18};
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(115200);

  /* initialize LCD */
  ASK25_LCD_Init(Inc, DispShiftOff);

  /* Generate Logo */
  ASK25_LCD_CGRAM_CharGen(0, Character1);
  ASK25_LCD_CGRAM_CharGen(1, Character2);
  ASK25_LCD_CGRAM_CharGen(2, Character3);
  ASK25_LCD_CGRAM_CharGen(3, Character4);
  ASK25_LCD_CGRAM_CharGen(4, Character5);
  ASK25_LCD_CGRAM_CharGen(5, Character6);
  ASK25_LCD_CGRAM_CharGen(6, Character7);
  ASK25_LCD_CGRAM_CharGen(7, Character8);

  /* Display EDUTECH Logo */
  ASK25_LCD_Display_Character(0x00,1,1,Off);
  ASK25_LCD_Display_Character(0x01,1,2,Off);
  ASK25_LCD_Display_Character(0x02,1,3,Off);
  ASK25_LCD_Display_Character(0x03,1,4,Off);

  ASK25_LCD_Display_Character(0x04,2,1,Off);
  ASK25_LCD_Display_Character(0x05,2,2,Off);
  ASK25_LCD_Display_Character(0x06,2,3,Off);
  ASK25_LCD_Display_Character(0x07,2,4,Off);

  ASK25_LCD_Display_String("TECH",2,5,Off);

  trace_printf("Hello\n");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    /* shifting function */
    ASK25_LCD_Display_Shift(Right,Off);
    HAL_Delay(500);

  }
  /* USER CODE END 3 */

}
Esempio n. 25
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_LED_Init(LED6);
  BSP_LED_Init(LED5);

  /* Checks if reset was because of wakeup from standby */
  if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
  {
    /* Clear Standby and wakeup flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB | PWR_FLAG_WU);
    BSP_LED_On(LED5);
   /* Reset was from wakeup from standy */
  }
  else
  {
    BSP_LED_Off(LED5);
  }

  BSP_UART_Init(115200);
  uprintf("First LED is blinking in normal mode...\n\r");
  uprintf("Press '1' to enter system in standby mode.\n\r");
  uprintf("Wait 5s, RTC will wake-up system...\n\r");
  // BSP_RTC_Init();

  while(ugetche(NONE_BLOCKING) !='1')
  {
    BSP_LED_Toggle(LED6);
    HAL_Delay(500);
  }
  uprintf("\n\nEnter Deep PowerDown mode...\n\r");
  BSP_StandbyMode_PB();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
    BSP_LED_Toggle(LED6);
    HAL_Delay(500);
  }
  /* USER CODE END 3 */


}
Esempio n. 26
0
int main(void)
{

    /* USER CODE BEGIN 1 */
    uint8_t pressed = 1;
    /* USER CODE END 1 */

    /* MCU Configuration----------------------------------------------------------*/

    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();

    /* Configure the system clock */
    SystemClock_Config();

    /* Initialize all configured peripherals */
    MX_GPIO_Init();

    /* USER CODE BEGIN 2 */
    BSP_UART_Init(115200);

    /* initialization of port GPIOD pin 12 13 */
    BSP_LED_Init(LED4);
    BSP_LED_Init(LED3);

    /* Initialize GPIO.4 to 7 as Switches */
    ASK25_PB_Init(ABUTTON_KEY1, ABUTTON_MODE_GPIO);

    trace_printf("Hello\n");
    /* USER CODE END 2 */

    /* Infinite loop */
    /* USER CODE BEGIN WHILE */
    while (1)
    {
        /* USER CODE END WHILE */

        /* USER CODE BEGIN 3 */
        if (ASK25_PB_GetState(ABUTTON_KEY1) == RESET)  // problem of Debouncing
        {
            if(pressed)
            {
                BSP_LED_Toggle(LED4);
                pressed = 0;
            }
            else
            {
                pressed = 1;
            }
        }

        if (ASK25_PB_GetState(ABUTTON_KEY2) == RESET)
        {
            if(pressed)
            {
                BSP_LED_Toggle(LED3);
                HAL_Delay(250);      //one of the solution of Debouncing
                pressed = 0;
            }
            else
            {
                pressed = 1;
            }
        }
    }
    /* USER CODE END 3 */

}
Esempio n. 27
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  uint8_t *SMS_DEL="AT+CMGD=1\r";
  uint16_t j;
  uint8_t *get="ATE0\r";
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(9600);
  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected

  BSP_GSM_Cmd(get);
  if(BSP_GSM_TMODE()==1)
  {
    vuprintf("Text Mode Selected\n\r");
  }
  else
  {
    vuprintf("Text Mode Not Selected\n\r");
    while(1);
  }
  SMS_Read();
  for(j=4; j<=500; j++)
  {
    vuprintf("%c",gsmBuf[j]);
    if((gsmBuf[j-1]=='\r')&&(gsmBuf[j]=='\0'))
    {
      vuprintf("\n\r");
    }
    if((gsmBuf[j-1]=='O')&&(gsmBuf[j]=='K'))
    {
      vuprintf("\n\r");
      break;
    }
  }
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
Esempio n. 28
0
int main(void)
{

  /* USER CODE BEGIN 1 */
  trace_printf("Hello\n");
  uint8_t *name="RCare";
  uint8_t *get="ATE0\r";
  uint8_t i,gsmBuf[250]={'\0'};
  uint8_t *cmd0="AT+CPBR=?\r";
  uint8_t *cmd1 ="AT+CPBS=\"SM\"\r";
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();

  /* USER CODE BEGIN 2 */
  BSP_UART_Init(9600);
  BSP_VCP_Init();

  vgetche(BLOCKING); // Dummy read to get the VCP Connected

  BSP_GSM_Cmd(get);
  vuprintf("Select the SIM Phonebook\n\r");
  BSP_GSM_Cmd(cmd1);
  BSP_GSM_ReadADV2(gsmBuf,45);
  for(i=0;i<=50;i++)
  {
    vuprintf("%c",gsmBuf[i]);
  }
  vuprintf("\n\r");
   vuprintf("Location range supported by the current Storage\n\r");
   BSP_GSM_Cmd(cmd0);
   BSP_GSM_ReadADV2(gsmBuf,45);
   for(i=0;i<=50;i++)
   {
     vuprintf("%c",gsmBuf[i]);
     if((gsmBuf[i-1]=='\r')&&(gsmBuf[i]=='\0'))
     {
       vuprintf("\n\r");
     }
     if((gsmBuf[i-1]=='O')&&(gsmBuf[i]=='K'))
     {
       vuprintf("\n\r");
       break;
     }
   }
   vuprintf("Finding Name: %s\n\r",name);
   BSP_GSM_FindPB(name,gsmBuf);
   for(i=0;i<=250;i++)
   {
     vuprintf("%c",gsmBuf[i]);
     if((gsmBuf[i-1]=='\r')&&(gsmBuf[i]=='\0'))
     {
       vuprintf("\n\r");
     }
     if((gsmBuf[i-1]=='O')&&(gsmBuf[i]=='K'))
     {
       vuprintf("\n\r");
       break;
     }
   }
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}