gsmConfig.h
and atcConfig.h
files.gsm_init()
.gsm_loop()
in infinit loop.#define _ATC_DEBUG 0 // use printf debug
#define _ATC_RTOS 0 // 0: no rtos 1: cmsis_os v1 2: cmsis_os v2
#define _ATC_RXSIZE 1024 // at-command rx buffer size
#define _ATC_SEARCH_CMD_MAX 5 // maximum of answer in at-command
#define _ATC_SEARCH_MAX 10 // maximum of always search in buffer
#define _ATC_RXTIMEOUT_MS 50 // rx timeout to get new packet
#include "gsm.h"
int main()
{
gsm_init();
gsm_power(true);
gsm_waitForRegister(30);
gsm_msg_send("+98xxxxxxx", "TEST MSG 1");
while (1)
{
gsm_loop();
}
}
--------------------------------------------------------------------------------
## RTOS example:
* file atcConfig.h
* file main.c
int main()
{
...
}
void task_gsm(void const * argument) {
HAL_GPIO_WritePin(_GSM_PWR_CTRL_GPIO, _GSM_PWR_CTRL_PIN, GPIO_PIN_RESET);
gsm_delay(1000);
gsm_init(); gsm_power(true);
if(HAL_GPIO_ReadPin(_GSM_SIM_DET_GPIO, _GSM_SIM_DET_PIN))
{
gsm_power(false);
#if(_GSM_RTOS != 0)
vTaskSuspend(NULL);
#endif
}
while (1) { gsm_loop(); } }
void task_other(void const * argument)
{
//gsm_waitForRegister(30);
gsm_msg_send("+98xxxxxxx", "TEST MSG 1");
while (1)
{
osDelay(10000);
}
}
void gsm_callback_simDetectorISR() { gsm.status.simDetCangeInterruptFlag = 1;
xTaskResumeFromISR(task_gsm);
}