Comments (2)
from gprs_c_sdk.
Test Code
/*
- @file app_main.c
- @brief An example of SDK's mini system
- @author: Trion
- @Date: 2024-8-7 11:22
- @last Modified by: Trion
- @last Modified time:2024-8-7 august 11:22 AM
*/
#include "stdint.h"
#include "stdbool.h"
#include "api_os.h"
#include "api_event.h"
#include "api_debug.h"
#include "api_hal_pm.h"
#include "api_key.h"
#define AppMain_TASK_STACK_SIZE (1024 * 2)
#define AppMain_TASK_PRIORITY 1
HANDLE mainTaskHandle = NULL;
HANDLE otherTaskHandle = NULL;
uint16_t chargerState ;
uint16_t chargeLevel ;
uint16_t batteryState ;
uint16_t batteryVoltage;
void LoopTask(VOID *pData)
{
uint64_t count = 0;
while(1)
{
++count;
if(count == 3000)
{
count = 0;
Trace(1,"Test Test");
OS_Sleep(1000);
Trace(1,"Test Test2");
}
}
}
void EventDispatch(API_Event_t* pEvent)
{
switch(pEvent->id)
{
case API_EVENT_ID_POWER_ON:
break;
case API_EVENT_ID_NO_SIMCARD:
break;
case API_EVENT_ID_NETWORK_REGISTERED_HOME:
case API_EVENT_ID_NETWORK_REGISTERED_ROAMING:
break;
case API_EVENT_ID_POWER_INFO:
chargerState = (pEvent->param1 >> 16) & 0xFFFF;
chargeLevel = pEvent->param1 & 0xFFFF;
batteryState = (pEvent->param2 >> 16) & 0xFFFF;
batteryVoltage = pEvent->param2 & 0xFFFF;
Trace(1,"Charger State: %d",chargerState);
Trace(1,"Charger Level: %d",chargeLevel);
Trace(1,"battery State: %d",batteryState);
Trace(1,"battery Voltage: %d",batteryVoltage);
switch(chargerState){
case PM_CHARGER_STATE_DISCONNECTED:
Trace(1,"Charger is disconnected");
break;
case PM_CHARGER_STATE_CONNECTED:
Trace(1,"Charger is connected");
break;
case PM_CHARGER_STATE_CHRGING:
Trace(1,"Charging is progress");
break;
case PM_CHARGER_STATE_FINISHED:
Trace(1,"Battery is fully charged");
break;
}
default:
break;
}
}
void AppMainTask(VOID *pData)
{
API_Event_t* event=NULL;
otherTaskHandle = OS_CreateTask(LoopTask ,
NULL, NULL, AppMain_TASK_STACK_SIZE, AppMain_TASK_PRIORITY, 0, 0, "ohter Task");
while(1)
{
if(OS_WaitEvent(mainTaskHandle, &event, OS_TIME_OUT_WAIT_FOREVER))
{
EventDispatch(event);
OS_Free(event->pParam1);
OS_Free(event->pParam2);
OS_Free(event);
}
}
}
void app_Main(void)
{
mainTaskHandle = OS_CreateTask(AppMainTask ,
NULL, NULL, AppMain_TASK_STACK_SIZE, AppMain_TASK_PRIORITY, 0, 0, "init Task");
OS_SetUserMainHandle(&mainTaskHandle);
}
from gprs_c_sdk.
Related Issues (20)
- Power pudding board with TTL vs battery HOT 1
- A9G agps δΈε·₯δ½
- should i left the vusb-det pin(17) of the processor A9G floating?
- Any alternatives to A9G?
- whats the latest gprs c sdk version? HOT 1
- I2C Assert while Reading Slave-Device
- project not compiling , i am a new to this board and i don't know what to do , please help me to resolve this problem HOT 2
- GPS and GPRS is not working at the same time
- I2C on the A9G board
- Resets randomly after successfully publishing
- at+location = 2 in a9g HOT 4
- a9g and esp32 turn on with power key pin HOT 1
- Ring pin
- File Open Error
- A9G got stuck main.py while loop. help in getting it out
- Unable to understand how to read and write to the sd card
- spi flash memory
- MQTT publish rate
- Sim application toolkit A9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gprs_c_sdk.