Use new IO Port related types and further improvements of readability #1
|
@ -21,9 +21,17 @@ namespace JabyEngine {
|
|||
#define __declare_io_type(name, type, ...) \
|
||||
template<template<typename> typename T> \
|
||||
struct name##_io_base { \
|
||||
T<type>::Value value; \
|
||||
T<type>::Value raw_value; \
|
||||
\
|
||||
name##_io_base(type value) : raw_value(value) {} \
|
||||
__VA_ARGS__ \
|
||||
\
|
||||
void operator=(type value) { \
|
||||
this->raw_value = value; \
|
||||
} \
|
||||
type operator*() const { \
|
||||
return this->raw_value; \
|
||||
} \
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -6,13 +6,13 @@ namespace JabyEngine {
|
|||
namespace Memory_IO {
|
||||
__declare_io_type(COM_DELAY, uint32_t,
|
||||
void setup() {
|
||||
this->value = 0x1325;
|
||||
this->raw_value = 0x1325;
|
||||
}
|
||||
);
|
||||
|
||||
__declare_io_type(CD_DELAY, uint32_t,
|
||||
void setup() {
|
||||
this->value = 0x20943;
|
||||
this->raw_value = 0x20943;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue