Refactor some platform dependent logic (#13675)

This commit is contained in:
Joel Challis 2021-07-24 19:56:45 +01:00 committed by GitHub
parent 145d89ab91
commit b5bcd5b0a1
Failed to generate hash of commit
11 changed files with 65 additions and 46 deletions

View file

@ -18,11 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <stdint.h>
#include <stdbool.h>
#if defined(__AVR__)
# include "avr/timer_avr.h"
#endif
#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a)))))
#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX)