RUI3 (RAK Unified Interface 3) - RAK4631
Misc

Modules

 pword
 
 alias
 

Data Structures

class  RAKSystem::atMode
 

Macros

#define CHANGE_ATCMD_PERM(_atcmd_name, _atcmd_perm)
 change AT command permission More...
 
#define RT_INIT(rt)   LABEL_INIT((rt)->label)
 
#define RT_BEGIN(rt)   { char RT_YIELD_FLAG = 1; LABEL_RESUME((rt)->label)
 
#define RT_END(rt)
 
#define RT_WAIT_UNTIL(rt, condition)
 
#define RT_WAIT_WHILE(rt, cond)   RT_WAIT_UNTIL((rt), !(cond))
 
#define RT_WAIT_THREAD(rt, thread)   RT_WAIT_WHILE((rt), RT_SCHEDULE(thread))
 
#define RT_SPAWN(rt, child, thread)
 
#define RT_RESTART(rt)
 
#define RT_EXIT(rt)
 
#define RT_SCHEDULE(f)   ((f) < RT_EXITED)
 
#define RT_YIELD(rt)
 
#define RT_YIELD_UNTIL(rt, cond)
 
#define RT_SLEEP(rt, delay)
 

Functions

void reboot ()
 
void restoreDefault ()
 

Detailed Description

Macro Definition Documentation

◆ CHANGE_ATCMD_PERM

#define CHANGE_ATCMD_PERM (   _atcmd_name,
  _atcmd_perm 
)
Value:
ATCMD_ITEM(atcmd_queue, atcmd_permission_item UNIQUE_NAME(permissions)) = \
{ \
.atcmd_id = _atcmd_name, \
.permission = _atcmd_perm, \
}
#define UNIQUE_NAME(base)
Definition: atcmd_queue.h:61
Definition: atcmd_queue.h:12

change AT command permission

PERMISSION LEVEL:
RAK_ATCMD_PERM_READ,
RAK_ATCMD_PERM_WRITE,
RAK_ATCMD_PERM_WRITEONCEREAD,
RAK_ATCMD_PERM_DISABLE
AT commands' default permission are RAK_ATCMD_PERM_READ | RAK_ATCMD_PERM_WRITE

Example
   CHANGE_ATCMD_PERM("AT+APPKEY", RAK_ATCMD_PERM_READ);
   CHANGE_ATCMD_PERM("AT+APPSKEY", RAK_ATCMD_PERM_WRITE);
   CHANGE_ATCMD_PERM("AT+DEVADDR", RAK_ATCMD_PERM_WRITEONCEREAD);
   CHANGE_ATCMD_PERM("AT+APPEUI", RAK_ATCMD_PERM_DISABLE);
   CHANGE_ATCMD_PERM("AT+NETID", RAK_ATCMD_PERM_READ | RAK_ATCMD_PERM_WRITE);
   CHANGE_ATCMD_PERM("AT+ALIAS", RAK_ATCMD_PERM_READ | RAK_ATCMD_PERM_WRITE);
   CHANGE_ATCMD_PERM("AT+HWID", RAK_ATCMD_PERM_READ | RAK_ATCMD_PERM_WRITE);

   void setup()
   {
   }

   void loop()
   {
   }

◆ RT_INIT

#define RT_INIT (   rt)    LABEL_INIT((rt)->label)
Description
Initialize a RAK thread.
Syntax
RT_INIT(rt)
Parameters
rtthe thread handle
Returns
Examples:
RAK_Thread/src/app.cpp.

◆ RT_BEGIN

#define RT_BEGIN (   rt)    { char RT_YIELD_FLAG = 1; LABEL_RESUME((rt)->label)
Description
Begin a RAK thread.
Syntax
RT_BEGIN(rt)
Parameters
rtthe thread handle
Returns
Examples:
RAK_Thread/src/app.cpp.

◆ RT_END

#define RT_END (   rt)
Value:
LABEL_END((rt)->label); RT_YIELD_FLAG = 0; \
RT_INIT(rt); return RT_ENDED; }
#define LABEL_END(s)
Definition: RAKThread.h:22
Definition: RAKThread.h:24
#define RT_ENDED
Definition: RAKThread.h:31
Description
End a RAK thread.
Syntax
RT_END(rt)
Parameters
rtthe thread handle
Returns
Examples:
RAK_Thread/src/app.cpp.

◆ RT_WAIT_UNTIL

#define RT_WAIT_UNTIL (   rt,
  condition 
)
Value:
do { \
LABEL_SET((rt)->label); \
if(!(condition)) { \
return RT_WAITING; \
} \
} while(0)
Definition: RAKThread.h:24
#define RT_WAITING
Definition: RAKThread.h:28
Description
Yield CPU while the conditon is false.
Syntax
RT_WAIT_UNTIL(rt, condition)
Parameters
rtthe thread handle
conditionwait condition
Returns

◆ RT_WAIT_WHILE

#define RT_WAIT_WHILE (   rt,
  cond 
)    RT_WAIT_UNTIL((rt), !(cond))
Description
Yield CPU while the conditon is true.
Syntax
RT_WAIT_WHILE(rt, condition)
Parameters
rtthe thread handle
conditionwait condition
Returns

◆ RT_WAIT_THREAD

#define RT_WAIT_THREAD (   rt,
  thread 
)    RT_WAIT_WHILE((rt), RT_SCHEDULE(thread))
Description
Yield CPU while a thread yields CPU.
Syntax
RT_WAIT_THREAD(rt, thread)
Parameters
rtthe thread handle
threada RAK thread
Returns

◆ RT_SPAWN

#define RT_SPAWN (   rt,
  child,
  thread 
)
Value:
do { \
RT_INIT((child)); \
RT_WAIT_THREAD((rt), (thread)); \
} while(0)
Definition: RAKThread.h:24
Description
Spawn a new RAK thread.
Syntax
RT_SPAWN(rt, child, thread)
Parameters
rtthe thread handle
childa RAK child thread
threada RAK parent thread
Returns

◆ RT_RESTART

#define RT_RESTART (   rt)
Value:
do { \
RT_INIT(rt); \
return RT_WAITING; \
} while(0)
Definition: RAKThread.h:24
#define RT_WAITING
Definition: RAKThread.h:28
Description
Restart a RAK thread.
Syntax
RT_RESTART(rt)
Parameters
rtthe thread handle
Returns

◆ RT_EXIT

#define RT_EXIT (   rt)
Value:
do { \
RT_INIT(rt); \
return RT_EXITED; \
} while(0)
#define RT_EXITED
Definition: RAKThread.h:30
Definition: RAKThread.h:24
Description
Exit a RAK thread.
Syntax
RT_EXIT(rt)
Parameters
rtthe thread handle
Returns

◆ RT_SCHEDULE

#define RT_SCHEDULE (   f)    ((f) < RT_EXITED)
Description
Schedule a RAK thread to run.
Syntax
RT_SCHEDULE(f)
Parameters
fa thread function
Returns
Examples:
RAK_Thread/src/app.cpp.

◆ RT_YIELD

#define RT_YIELD (   rt)
Value:
do { \
RT_YIELD_FLAG = 0; \
LABEL_SET((rt)->label); \
if(RT_YIELD_FLAG == 0) { \
return RT_YIELDED; \
} \
} while(0)
Definition: RAKThread.h:24
#define RT_YIELDED
Definition: RAKThread.h:29
Description
Yield CPU time.
Syntax
RT_YIELD(rt)
Parameters
rtthe thread handle
Returns
Examples:
RAK_Thread/src/app.cpp.

◆ RT_YIELD_UNTIL

#define RT_YIELD_UNTIL (   rt,
  cond 
)
Value:
do { \
RT_YIELD_FLAG = 0; \
LABEL_SET((rt)->label); \
if((RT_YIELD_FLAG == 0) || !(cond)) { \
return RT_YIELDED; \
} \
} while(0)
Definition: RAKThread.h:24
#define RT_YIELDED
Definition: RAKThread.h:29
Description
Yield CPU time until the condition is false.
Syntax
RT_YIELD_UNTIL(rt, condition)
Parameters
rtthe thread handle
conditionwait condition
Returns

◆ RT_SLEEP

#define RT_SLEEP (   rt,
  delay 
)
Value:
{ \
do { \
static unsigned long protothreads_sleep; \
protothreads_sleep = millis(); \
RT_WAIT_UNTIL(rt, millis() - protothreads_sleep > delay); \
} while(false); \
}
Definition: RAKThread.h:24
#define delay
Definition: wiring_time.h:30
unsigned long millis()
Description
Yield CPU time for a period of time.
Syntax
RT_SLEEP(rt, delay)
Parameters
rtthe thread handle
delaya period of time
Returns
Examples:
RAK_Thread/src/app.cpp.

Function Documentation

◆ reboot()

void reboot ( )
Description
Syntax
api.system.reboot()
Returns
void
Example
int loopCount == 0;

void setup()
{
}

void loop()
{
  loopCount++;

  if(loopCount == 60)
    api.system.reboot();  // Reboot after 60 seconds 

  delay(1000);
}

◆ restoreDefault()

void restoreDefault ( )
Description
Syntax
api.system.restoreDefault()
Returns
void
Example
void setup()
{
  api.system.restoreDefault();
}

void loop()
{
}