Skip to content

Commit

Permalink
extend platform mockup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingmar Splitt committed Jan 16, 2017
1 parent 0261987 commit ba5b01a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/platform.h
Expand Up @@ -258,7 +258,7 @@ class
} Serial;

template <typename T1, typename T2>
void memset(T1 address[], T1 initValue, T2 size)
void memset(T1 address[], T1 initValue[], T2 size)
{
size = size / sizeof(T2);
for (T2 counter = 0; counter < size; ++counter)
Expand All @@ -268,14 +268,30 @@ void memset(T1 address[], T1 initValue, T2 size)
};

template <typename T1, typename T2>
void memcpy(T1 destination[], const T1 source[], T2 bytes)
void memcpy(T1 destination[], const T1 source[], T2 bytes)
{
for (T2 counter = 0; counter < bytes; ++counter)
for (T2 counter = 0; counter < bytes; ++counter) // TODO: loop is not bytebased (others too)
{
destination[counter] = source[counter];
};
};

template <typename T1, typename T2>
bool memcmp(T1 destination[], T1 source[], T2 bytes) // return true if string is different
{
for (T2 counter = 0; counter < bytes; ++counter)
{
if (destination[counter] != source[counter]) return true;
};
return false;
};

void delay(uint32_t time_millis);
uint32_t millis(void);

void wdt_reset(void);
void wdt_enable(...);

#endif

#endif //ONEWIREHUB_PLATFORM_H

0 comments on commit ba5b01a

Please sign in to comment.