Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem app epson mbed msp430 pl tests
utils.h
00001 /* 00002 Plastic Logic EPD project on MSP430 00003 00004 Copyright (C) 2013 Plastic Logic Limited 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef INCLUDE_UTIL_H 00021 #define INCLUDE_UTIL_H 1 00022 00023 //#include "FatFs/ff.h" 00024 #include <stdint.h> 00025 #include <stdlib.h> 00026 #include <stdio.h> 00027 00028 #ifdef LOG_TAG 00029 #define LOG(msg, ...) \ 00030 do { printf("%-16s "msg"\n", LOG_TAG, ##__VA_ARGS__); } while (0) 00031 #else 00032 #define LOG(msg, ...) 00033 #endif 00034 00035 #ifndef ARRAY_SIZE 00036 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 00037 #endif 00038 00039 #ifndef min 00040 #define min(x,y) ( (x) < (y) ? (x) : (y) ) 00041 #endif 00042 #ifndef max 00043 #define max(x,y) ( (x) > (y) ? (x) : (y) ) 00044 #endif 00045 00046 #define DIV_ROUND_CLOSEST(x, divisor)( \ 00047 { \ 00048 (((x) + ((divisor) / 2)) / (divisor)); \ 00049 } \ 00050 ) 00051 00052 #define CPU_CLOCK_SPEED_IN_HZ 20000000L 00053 #if CPU_CLOCK_SPEED_IN_HZ < 1000000L 00054 #error CPU_CLOCK_SPEED_IN_HZ assumed to be more than 1MHz in delay timer calculations 00055 #endif 00056 00057 /* -- Sleep & delay -- */ 00058 00059 extern void udelay(uint16_t us); 00060 extern void mdelay(uint16_t ms); 00061 extern void msleep(uint16_t ms); 00062 00063 00064 /* -- Debug utilities */ 00065 00066 /** Print the contents of a buffer with offsets on stdout */ 00067 extern void dump_hex(const void *data, uint16_t len); 00068 00069 #endif /* INCLUDE_UTIL_H */
Generated on Tue Jul 12 2022 21:14:35 by
