/* ** =================================================================== ** Event : Remote_com_task (module mqx_tasks) ** ** Component : Task2 [MQXLite_task] ** Description : ** MQX task routine. The routine is generated into mqx_tasks.c ** file. ** Parameters : ** NAME - DESCRIPTION ** task_init_data - ** Returns : Nothing ** =================================================================== */ void Remote_com_task(uint32_t task_init_data) { int counter = 0; DEBUG("initializing...\n"); RCOM_set_uart(&SIM900_uart); RCOM_set_rx_buf(rcom_rx_buffer, RCOM_RX_BUFF_MAX_CHAR); RCOM_init(get_systick_period_in_ms()); sim900_init(&sim900_pins); sync_buffer_init(&rcom_to_controller_sync_buffer, (uint8_t*) rcom_to_controller_buffer, RCOM_TO_CONTROLLER_BUFFER_SIZE); DEBUG("routing pin setting\n"); /* route desired pins into peripherals */ Pin_Settings_Init(); /* create RI_process task to processing incoming call and received SMS */ if (_task_create_at(0, RI_PROCCESS_TASK, 0, RI_proccess_task_stack, RI_PROCCESS_TASK_STACK_SIZE) == MQX_NULL_TASK_ID ) { NOTIFY("Error on creating RI_process task\n"); } while (1) { counter++; /* Write your code here ... */ remote_com_app((pointer) rcom_msg_queue, (pointer) controller_msg_queue, &rcom_to_controller_sync_buffer); } }
GPRS::GPRS(PIN_T tx, PIN_T rx, uint32_t baudRate, const char* apn, const char* userName, const char* passWord):gprsSerial(tx,rx) { inst = this; _apn = apn; _userName = userName; _passWord = passWord; sim900_init(&gprsSerial, -1, baudRate); }
GPRS::GPRS(Stream& serial, uint8_t pkPin, uint8_t stPin) { _stPin = stPin; _pkPin = pkPin; inst = this; stream = &serial; sim900_init(stream); }
int main(void){ //DDRA = 0xff; //ENCODER_DDR &= ~(_BV(ENCODER_PIN)); //ENCODER_PORT |= (_BV(ENCODER_PIN)); sim900_init(); //ntp_decode_UTC(3580318410); sim900_data_connect(); while(1) {} if (sim900_poweron()) { for (uint8_t i=0; i < 20; i++) { sim900_cmd_wait_response("AT+CCALR?"); if (sim900_test_last_response("1")) { sim900_send_sms(send_to_number, "How are you today?"); break; } _delay_ms(500); } /* if (sim900_cmd_wait_response("AT+CCALR?")) { if (sim900_test_last_response("1")) { sim900_send_sms(send_to_number, "How are you today?"); } }*/ } sim900_cmd_wait_response("AT+CPOWD=1"); while(1) { } while(1) { _delay_ms(2000); //read_dials(); } }
GPRS::GPRS(uint8_t tx, uint8_t rx, uint32_t baudRate):gprsSerial(tx,rx) { inst = this; sim900_init(&gprsSerial, baudRate); }
GPRS::GPRS(PIN_T tx, PIN_T rx, uint32_t baudRate):gprsSerial(tx,rx) { inst = this; sim900_init(&gprsSerial, -1, baudRate); }