注册完之后,点选I want to install Disqus on my site网站会提示你输入Website
Name。
后续我们会用到一个Shortname,区别于Website
Name,Shortname是用来确保后续hexo部署的时候能够准确跟你的账户连接上的。(我当时好像没填Shortname,应该是自动生成的吧~)
找到Disqus右上角头像处,Install on Site选项。然后在左侧SITE栏目中找到General选项。从这里可以看到要找到Shortname。(下图中被圈中的马赛克部分就是你的Shortname)
/** * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/ /* var disqus_config = function () { this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable }; */ (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); s.src = 'https://blog-liewzheng-cn.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
Task is used to process a serial of things. A task must be declared
as void type and have a void-type pointer parameter , like:
void BLE_TASK(void * pvParameters);
And when used, it’s used in the function xTaskCreate() with 6
parameters, like:
xTaskCreate(BLE_TASK, “BEL_TASK”,4000, NULL, 5, NULL);
The 1st parameter should be the task you defined, and it only need
the name of your task function.
The 2nd parameter is the custom string you made in order to
recognize it in the tasks list.
The 3rd parameter is task stack memory it need.
MEMORY = STACK DEPTH * STACK WIDTH
The 4th parameter is passed to the the task when it need, and it
used to be NULL.
The 5th parameter is the priority of the task, the lowest priority
is 0, the highest priority is 32. But it always advisable to keep it at
the minimum necessary.
The 6th parameter is the return value: pdPASS or pdFAIL.
2. Scheduler
Scheduler is used to manage the tasks. It runs in the tick interrupt
and select the highest priority task and bring it into
RUNNING-STATE.
3. IDLE Task
IDLE Task is automatically created by the scheduler when
vTaskStartScheduler() is called and it is always able to run.
4. Task State
All the task has two big states: RUNNING-STATE or
NOT-RUNNING-STATE. BLOCKED-STATE, SUSPENDED-STATE and
SUSPENDED-STATE are NON-RUNNING-STATE.
4.1 RUNNING-STATE
When the task is running, it is in the RUNNING-STATE.
4.2 BLOCKED-STATE
BLOCKED-STATE is a sub-state of NOT-RUNNING STATE. Tasks can enter
the BLOCKED-STATE to wait for two different types of event: Temporal
Event & Synchronization Events. While in this state, tasks are not
able to run, so cannot be selected by the scheduler.
4.3 SUSPENDED-STATE
SUSPENDED-STATE is a sub-state of NOT-RUNNING STATE.
4.4 READY-STATE
READY-STATE is a sub-state of NOT-RUNNING STATE.
5. Event
Event is also called Interrupt. It is originated by the environment
and force the embedded system to take action in response to it.
6. Event-drive task
Event-drive task has work after the event that triggers it, and is
not able to enter the RUNNING-STATE before that event has occurred.
7. Semaphore(s)
Binary Semaphore
Counting Semaphore
8. Queue(s)
Queue provides a task-to-task, task-to-interrupt, interrupt-to-task
communication mechanism.
9. Event Group(s)
Event groups are another feature of FreeRTOS that allow events to be
communicated to tasks.
10. ISR
Interrupt Service Routine. It is a software process invoked by an
interrupt request from a hardware device. It handles the request and
sends it to the CPU, interrupting the active process. When the ISR is
complete, the process is resumed.
11. Task & Event(Interrupt)
A task is a software feature that is unrelated to the hardware on
which FreeRTOS is running. The priority of a task is assigned in
software by the application writer, and a software algorithm (the
scheduler) decides which task will be in the Running state.
Although written in software, an interrupt service routine is a
hardware feature because the hardware controls which interrupt service
routine will run, and when it will run. Tasks will only run when there
are no ISRs running, so the lowest priority interrupt will interrupt the
highest priority task, and there is no way for a task to pre-empt an
ISR.
esptool.py v2.0-beta2 Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)... esptool.py v2.0-beta2 Connecting........___ Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Attaching SPI flash... Configuring flash size... Auto-detected Flash size: 4MB Flash params set to 0x0220 Compressed 11616 bytes to 6695... Wrote 11616 bytes (6695 compressed) at 0x00001000 in 0.1 seconds (effective 920.5 kbit/s)... Hash of data verified. Compressed 408096 bytes to 171625... Wrote 408096 bytes (171625 compressed) at 0x00010000 in 3.9 seconds (effective 847.3 kbit/s)... Hash of data verified. Compressed 3072 bytes to 82... Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 8297.4 kbit/s)... Hash of data verified.
Leaving... Hard resetting...
4.2 端口监控
如果要查看 “hello_world” 程序是否真的在运行,输入命令 make
monitor。这个命令会启动 IDF Monitor
程序(ESP-IDF自带工具),也可以使用其他串口助手进行查看。
1
make monitor
串口启动时,在终端显示如下:
1 2 3 4 5 6 7 8 9
$ make monitor MONITOR --- idf_monitor on /dev/ttyUSB0 115200 --- --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 ...
开发板输出到串口的信息,在终端显示如下:
1 2 3 4 5 6 7
... Hello world! Restarting in 10 seconds... I (211) cpu_start: Starting scheduler on APP CPU. Restarting in 9 seconds... Restarting in 8 seconds... Restarting in 7 seconds...
前往 C/C++ General -> Indexer
属性页面,选择 Enable project specific settings
以启用本页上的其他设置。然后去除 Allow heuristic resolution of
includes 勾选,因为启用此选项时,Eclipse
有时无法找到正确的头文件目录。
BLE
Beacons利用GAP广告模式以定期的,特殊格式的广告包广播数据。每种类型的信标都使用自定义规范来对广告数据进行分区,从而赋予其意义。我将看看三种现有类型的信标,URI
Beacons,iBeacons和AltBeacons。mbed
BLE团队页面支持所有信标类型,如果您想尝试它们,请提供包含文档的示例项目。