
Here's something encrypted, password is required to continue reading.
Read moreHexo plugin -- hexo-photo-wall
因为觉得hexo post的图片排版太烂了,手打html插入图片又很烦,于是乎决定写一个hexo的插件,能够通过一些关键字,识别图片组,然后再把这些图片以照片墙的方式组合在一起。
顺带可以了解一下hexo的渲染管道和javascript。
初始化阶段:
内容处理阶段:
生成阶段:
部署阶段:
我们需要做的就是在内容处理阶段,重新生成图片墙部分的html代码。
过滤器是通过 hexo.extend.filter.register()
方法来注册的。每个过滤器都绑定在特定的生命周期事件上,当这些事件触发时,Hexo 会依次执行所有注册在该事件上的过滤器。
1 | hexo.extend.filter.register('after_post_render', function(data) { |
after_post_render
过滤器需要返回修改后的文章内容。before_exit
)不需要返回值。首先创建一个存放插件的文件夹,我放在hexo_root/plugins/hexo-photo-wall
文件夹中创建一个js入口文件index.js
文件中注册filter并且实现替换功能
1 | hexo.extend.filter.register('before_generate', () => { |
此处的照片墙的排版和原本应该并没有区别,只是处于同一个class="picture-wall"
的div下。后续需要通过修改css或者直接更改html来实现照片墙的效果。
For this RC, we will go through Lab 4 in detail.
We need to generate PWM signal on PB14
(embeded with an LED D1
, or D2
if you like)
In STM32, Input Capture and Output Compare is configured in Timer channels.
Let’s check which Timer is connected to PB14
Then we configure timer 1.
Prescaler: 7200-1 Counter Period: 200-1 (50Hz) Pulse: 180 (duty cycle of 90%; TIM_CNT 0~179: HIGH, TIM_CNT 180~199: LOW) CHN Polarity: LOW (needed for CHN) > CHxN is the complementary channel of CHx in Timer1. > If the polarity of CHxN and CHx are different, the two channels will follow the same output pattern, otherwise they will be complementaryAlso remember to configure PB12
(SW4
) as GPIO_Input.
1 | /* USER CODE BEGIN 2 */ |
Change PWM duty cycle:
1 | void ChangeDutyCycle(int pulse_width) |
Get the press/release action of the button (PB12
):
1 | int pressed = 0; |
IC is a peripheral that can monitor the input signal change (pos/neg edge) independent of the processor (Core).
You can consider IC as a **timer value recorder**. It will record the timer value each time the capture condition is met.For detailed configuration, please refer to Reference Manual.pdf
on canvas, page 349-359, 382-385.
Some useful documentation on the configuration register:
Datasheet for HD44780: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
+5V
pin will not be 5V, maybe around 2.8V, so remember to use the 5V power supply wire to power the board.From datasheet
In this Lab, we will mainly use the first and third operation
Instruction
DDRAM
CGRAM
Recall the operation:
RS
& R/W
to low.E
to high, preparing for the data transfer.D7-D0
to the desired instruction(8-bit).E
to lowSample code:
1 | void LCD_Write_Command(uchar Com) { |
Recall the operation:
Set the pin of RS
to high and R/W
to low.
Set E
to high, preparing for the data transfer.
Set D7-D0
to the desired address.
Set E
to low
Sample code:
1 | void LCD_Write_Data(uchar dat) { |
1 |
|
First we need to set the cursor position
The cursor position is basically the DDRAM address that you want to write data in, which is corresponding to the display location on LCD screen.
1 | void LCD_Set_Position(uchar x, uchar y) { |
If we want to display a character at first line, first column:
1 | LCD_Set_Position(0,0); |
Then, we need to write data into DDRAM[addr] to tell the LCD which character you want to display, for example “J”.
1 | LCD_Write_Data("J"); // send the ascii code |
Putting them all together:
1 | void LCD_Display_Char(uchar Char, uchar x, uchar y) |
The cursor will shift right (because we set increment
entry mode) after each write_data
operation, so displaying a string is quite simple.
1 | void LCD_Display_Char(uchar Char, uchar x, uchar y) // 显示字符ASCII码 |
…
Copy-Paste in Hyprland across Wayland & XWayland
After a certain upgrade of hyprland, I can no longer copy&paste across Wayland & XWayland apps, which is very annoying.
The relatied issue: https://github.com/hyprwm/Hyprland/issues/6132
Maybe fixed in: https://github.com/hyprwm/Hyprland/pull/6086
According to 6132 issue, some provide a walk around. I tailored it to adapt it to my system.
Create a shell in ~
directory, named clipsync.sh
1 | !/usr/bin/env sh |
alias in ~/.zshrc
:
1 | alias clipsync="~/clipsync.sh" |
enable it by running
1 | clipsync watch |
kill all by running
1 | clipsync kill |
Self-start, configured in ~/.config/hyprland/hyprland.conf
1 | exec-once = clipsync watch |
REMEMBER TO REMOVE ALL THESE STUFF WHEN HYPRLAND HAS FIXED THE ISSUE
Solved in ISSUE 6086
新的Input System:https://gamedevbeginner.com/input-in-unity-made-easy-complete-guide-to-the-new-system/#how_to_manage_input
目前的想法是将unity的physx和mujoco结合在一起,简化physx的对于相对运动很少的刚体间的物理解算。
Mujoco:https://mujoco.readthedocs.io/en/latest/unity.html