/***************************************************************************** * Interrupt pin 40 - make a call to phone number +7xxxxxxxxxx *****************************************************************************/ #ifdef __EXAMPLE_HELLOWORLD__ #include "neoway_openplatform.h" U8 AT_MAKE_CALL[] = "ATD+7xxxxxxxxxx;\r"; // AT- +7xxxxxxxxxx void Neoway_UserInit(void) { Neoway_StopWatchdog(); // watchdog Neoway_InterruptInit(44,NEOWAY_INT_10); // GPIO 44 (pin 40) 10 Neoway_InterruptSetDebounceTime(NEOWAY_INT_10,40); // (40 ) Neoway_InterruptSetPolarity(NEOWAY_INT_10,NEOWAY_TRUE); // – Neoway_InterruptSetTriggerMode(NEOWAY_INT_10,NEOWAY_FALSE); // } void Neoway_UserTask1(NeowayMsgTypeStruct msg_type,NeowayModuleTypeEnum mod_type) { switch(msg_type.msg_id) { case NEOWAY_MSG_ID_INT_NOTIFY10: Neoway_VirtualUartSend(NEOWAY_MOD_USER1, AT_MAKE_CALL, strlen(AT_MAKE_CALL)); // break; default : break; } } void Neoway_IntResponse(NeowayIntNumEnum int_no,NeowayModuleTypeEnum mod_id) { if(int_no==NEOWAY_INT_10) { Neoway_SendMsgTask(mod_id,NEOWAY_MOD_USER1,NEOWAY_MSG_ID_INT_NOTIFY10,NULL,0); // NEOWAY_MSG_ID_INT_NOTIFY10 task1 } } void Neoway_RegisterCallbackFunction(void) { Neoway_RegisterCallBack(NEOWAY_KB_ID_USER_TASK_1,(U32)Neoway_UserTask1); // Neoway_UserTask1 Neoway_RegisterCallBack(NEOWAY_KB_ID_INT_RESPONSE,(U32)Neoway_IntResponse); // Neoway_IntResponse } #endif
U8 AT_MAKE_CALL[] = "ATD+7xxxxxxxxxx;\r";
U8 AT_SMS_TEXT_MODE[] = "AT+CMGF=1\r"; U8 AT_SEND_SMS[] = "AT+CMGS=\"+7xxxxxxxxxx\"\r"; U8 AT_MESSAGE[] = "Hello_HABR!\x1A";
Neoway_VirtualUartSend(NEOWAY_MOD_USER1, AT_MAKE_CALL, strlen(AT_MAKE_CALL));
Neoway_VirtualUartSend(NEOWAY_MOD_USER1, AT_SMS_TEXT_MODE, strlen(AT_SMS_TEXT_MODE)); Neoway_VirtualUartSend(NEOWAY_MOD_USER1, AT_SEND_SMS, strlen(AT_SEND_SMS)); Neoway_VirtualUartSend(NEOWAY_MOD_USER1, AT_MESSAGE, strlen(AT_MESSAGE));
Source: https://habr.com/ru/post/367745/
All Articles