diff options
author | Fredrik Thulin <fredrik@thulin.net> | 2016-05-16 15:45:02 +0200 |
---|---|---|
committer | Fredrik Thulin <fredrik@thulin.net> | 2016-05-16 15:45:02 +0200 |
commit | 4c1eff0373b7a4a0072fc7515352139cd9d6d02f (patch) | |
tree | 597e448fbce65a3301413f376e9ac08d4023ef10 /stm-uart.c | |
parent | 9b73356f2831800d2328827998e1e5b2a1994b68 (diff) |
Add code to talk with the external RTC chip.
Diffstat (limited to 'stm-uart.c')
-rw-r--r-- | stm-uart.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -165,3 +165,26 @@ HAL_StatusTypeDef uart_send_number2(enum stm_uart_port port, uint32_t num, uint8 return HAL_UART_Transmit(uart, (uint8_t *) where, digits, 0x1); } + +HAL_StatusTypeDef uart_send_hexdump(enum stm_uart_port port, const uint8_t *buf, + const uint8_t start_offset, const uint8_t end_offset) +{ + uint32_t i; + + uart_send_string2(port, "00 -- "); + + for (i = 0; i <= end_offset; i++) { + if (i && (! (i % 16))) { + uart_send_string2(port, "\r\n"); + + if (i != end_offset) { + /* Output new offset unless the last byte is reached */ + uart_send_number2(port, i, 2, 16); + uart_send_string2(port, " -- "); + } + } + + uart_send_number2(port, *(buf + i), 2, 16); + uart_send_string2(port, " "); + } +} |