Esempio n. 1
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. 2
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. 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 */
  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. 4
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. 5
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 */

}
Esempio n. 6
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 */

}