36 lines
665 B
C++
36 lines
665 B
C++
/*
|
|
* peripherals_serial.hpp
|
|
*
|
|
* Created on: Mar 22, 2021
|
|
* Author: erki
|
|
*/
|
|
|
|
#ifndef SKULLC_PERIPHERALS_SERIAL_HPP_
|
|
#define SKULLC_PERIPHERALS_SERIAL_HPP_
|
|
|
|
#include <cstdint>
|
|
|
|
namespace Peripherals
|
|
{
|
|
|
|
template<typename HT, HT* Handle,
|
|
void (*tx_function)(HT*, char*, std::uint32_t),
|
|
void (*rx_function)(HT*, char*, std::uint32_t)>
|
|
struct SerialPeripheral
|
|
{
|
|
void transmit(char* data, const std::uint32_t data_length)
|
|
{
|
|
tx_function(handle, data, data_length);
|
|
}
|
|
|
|
void receive(char* output, const std::uint32_t data_length)
|
|
{
|
|
rx_function(handle, data, data_length);
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif /* SKULLC_PERIPHERALS_SERIAL_HPP_ */
|