Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mail_driven_task_example
Diff: Task.h
- Revision:
- 1:381a6f6263c7
- Parent:
- 0:0c5255720d77
- Child:
- 2:b12e4c1338db
--- a/Task.h Mon Dec 22 01:06:33 2014 +0000
+++ b/Task.h Thu Dec 25 01:58:14 2014 +0000
@@ -52,18 +52,57 @@
class Task {
public:
+ /** Initialize task config table.
+ @param cfg array of TaskConfig
+ @param num_of_task length of cfg
+ @return void
+ */
static void init(TaskConfig *config, uint32_t num_of_task);
+
+ /** Send mail to task specified by task_id with Any data.
+ @param task_id destination task's id
+ @param message_id mail id
+ @param packet any data pointer
+ @return void
+ */
static void sendMail(TaskID task_id, MessageID message_id, void *packet);
+
+
static int readClock();
Thread *thread;
+
+ /** Wait for mail addressed to itself.
+ @return received MailPacket
+ */
MailPacket *waitMail();
+
+ /** Delete a mail queue block. it's responsible for received task.
+ @param mail received MailPacket
+ @return void
+ */
void deleteMail(MailPacket *mail);
+
+ /** Output log to task's own stream pointer.
+ @param lv loglevel
+ @param format log format
+ @param ... log arguments
+ @return void
+ */
void log(LogLevel lv, const char *format, ...);
class Logger {
public:
+ /** Logger constructor
+ @param task_name For log prefix
+ @param sp Stream pointer for output destination(the default is USB serial).
+ */
Logger(const char *task_name, Stream *sp = Logger::sci);
+
+ /** Log level setter
+ @param lv log level
+ @return void
+ */
static void setLogLevel(LogLevel lv);
void setLogStream(Stream *sp);
static const char *lvSym[];
@@ -75,6 +114,10 @@
};
private:
+ /** Create a new thread with its own logger.
+ @param cfg TaskConfig struct pointer
+ @return void
+ */
Task(TaskConfig *config);
~Task();