$ docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************** | |
* | |
* This simple library is used to redirect | |
* functions like printf(), scanf(), putchar() | |
* among other to the UART output on the STM32 | |
* using HAL. | |
* | |
* Credits to the book Mastering STM32 | |
* File by Benjamin Calderon 2017 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function hex_dump(buf) | |
for byte=1, #buf, 16 do | |
local chunk = buf:sub(byte, byte + 15) | |
io.write(string.format('%08X ', byte - 1)) | |
chunk:gsub('.', function (c) io.write(string.format('%02X ', string.byte(c))) end) | |
io.write(string.rep(' ', 3 * (16 - #chunk))) | |
io.write(' ', chunk:gsub('%c', '.'), "\n") | |
end | |
end |
OlderNewer