Allow writing uint32_t to UART
This commit is contained in:
parent
2e9bb3fd76
commit
557d5dfa75
2 changed files with 9 additions and 0 deletions
|
@ -58,6 +58,14 @@ void UART::write_mem_u8(uint8_t* src, size_t addr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UART::write_mem_u32(uint32_t* src, size_t addr) {
|
||||||
|
uint8_t* s = (uint8_t*)src;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 4; i++) {
|
||||||
|
write_mem_u8(s + i, addr + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Timer::update() {
|
void Timer::update() {
|
||||||
using Clock = std::chrono::high_resolution_clock;
|
using Clock = std::chrono::high_resolution_clock;
|
||||||
constexpr auto den = Clock::period::den;
|
constexpr auto den = Clock::period::den;
|
||||||
|
|
|
@ -75,6 +75,7 @@ class UART final : public Device {
|
||||||
UART() : Device(UART_ADDR, 8) {}
|
UART() : Device(UART_ADDR, 8) {}
|
||||||
|
|
||||||
virtual void write_mem_u8(uint8_t *src, size_t addr);
|
virtual void write_mem_u8(uint8_t *src, size_t addr);
|
||||||
|
virtual void write_mem_u32(uint32_t *src, size_t addr);
|
||||||
|
|
||||||
virtual void read_mem_u8(uint8_t *dst, size_t addr);
|
virtual void read_mem_u8(uint8_t *dst, size_t addr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue