Error as described in MBs email to MS
Dependencies: SDFileSystem app epson mbed msp430 pl tests
utils.h@1:5874c1a074a7, 2018-01-11 (annotated)
- Committer:
- marcbax
- Date:
- Thu Jan 11 14:12:00 2018 +0000
- Revision:
- 1:5874c1a074a7
- Parent:
- 0:c643d398cdb6
Version 180111a with error as reported to Mark Symonds
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcbax | 0:c643d398cdb6 | 1 | /* |
marcbax | 0:c643d398cdb6 | 2 | Plastic Logic EPD project on MSP430 |
marcbax | 0:c643d398cdb6 | 3 | |
marcbax | 0:c643d398cdb6 | 4 | Copyright (C) 2013 Plastic Logic Limited |
marcbax | 0:c643d398cdb6 | 5 | |
marcbax | 0:c643d398cdb6 | 6 | This program is free software: you can redistribute it and/or modify |
marcbax | 0:c643d398cdb6 | 7 | it under the terms of the GNU General Public License as published by |
marcbax | 0:c643d398cdb6 | 8 | the Free Software Foundation, either version 3 of the License, or |
marcbax | 0:c643d398cdb6 | 9 | (at your option) any later version. |
marcbax | 0:c643d398cdb6 | 10 | |
marcbax | 0:c643d398cdb6 | 11 | This program is distributed in the hope that it will be useful, |
marcbax | 0:c643d398cdb6 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
marcbax | 0:c643d398cdb6 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
marcbax | 0:c643d398cdb6 | 14 | GNU General Public License for more details. |
marcbax | 0:c643d398cdb6 | 15 | |
marcbax | 0:c643d398cdb6 | 16 | You should have received a copy of the GNU General Public License |
marcbax | 0:c643d398cdb6 | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
marcbax | 0:c643d398cdb6 | 18 | */ |
marcbax | 0:c643d398cdb6 | 19 | |
marcbax | 0:c643d398cdb6 | 20 | #ifndef INCLUDE_UTIL_H |
marcbax | 0:c643d398cdb6 | 21 | #define INCLUDE_UTIL_H 1 |
marcbax | 0:c643d398cdb6 | 22 | |
marcbax | 0:c643d398cdb6 | 23 | //#include "FatFs/ff.h" |
marcbax | 0:c643d398cdb6 | 24 | #include <stdint.h> |
marcbax | 0:c643d398cdb6 | 25 | #include <stdlib.h> |
marcbax | 0:c643d398cdb6 | 26 | #include <stdio.h> |
marcbax | 0:c643d398cdb6 | 27 | |
marcbax | 0:c643d398cdb6 | 28 | #ifdef LOG_TAG |
marcbax | 0:c643d398cdb6 | 29 | #define LOG(msg, ...) \ |
marcbax | 0:c643d398cdb6 | 30 | do { printf("%-16s "msg"\n", LOG_TAG, ##__VA_ARGS__); } while (0) |
marcbax | 0:c643d398cdb6 | 31 | #else |
marcbax | 0:c643d398cdb6 | 32 | #define LOG(msg, ...) |
marcbax | 0:c643d398cdb6 | 33 | #endif |
marcbax | 0:c643d398cdb6 | 34 | |
marcbax | 0:c643d398cdb6 | 35 | #ifndef ARRAY_SIZE |
marcbax | 0:c643d398cdb6 | 36 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
marcbax | 0:c643d398cdb6 | 37 | #endif |
marcbax | 0:c643d398cdb6 | 38 | |
marcbax | 0:c643d398cdb6 | 39 | #ifndef min |
marcbax | 0:c643d398cdb6 | 40 | #define min(x,y) ( (x) < (y) ? (x) : (y) ) |
marcbax | 0:c643d398cdb6 | 41 | #endif |
marcbax | 0:c643d398cdb6 | 42 | #ifndef max |
marcbax | 0:c643d398cdb6 | 43 | #define max(x,y) ( (x) > (y) ? (x) : (y) ) |
marcbax | 0:c643d398cdb6 | 44 | #endif |
marcbax | 0:c643d398cdb6 | 45 | |
marcbax | 0:c643d398cdb6 | 46 | #define DIV_ROUND_CLOSEST(x, divisor)( \ |
marcbax | 0:c643d398cdb6 | 47 | { \ |
marcbax | 0:c643d398cdb6 | 48 | (((x) + ((divisor) / 2)) / (divisor)); \ |
marcbax | 0:c643d398cdb6 | 49 | } \ |
marcbax | 0:c643d398cdb6 | 50 | ) |
marcbax | 0:c643d398cdb6 | 51 | |
marcbax | 0:c643d398cdb6 | 52 | #define CPU_CLOCK_SPEED_IN_HZ 20000000L |
marcbax | 0:c643d398cdb6 | 53 | #if CPU_CLOCK_SPEED_IN_HZ < 1000000L |
marcbax | 0:c643d398cdb6 | 54 | #error CPU_CLOCK_SPEED_IN_HZ assumed to be more than 1MHz in delay timer calculations |
marcbax | 0:c643d398cdb6 | 55 | #endif |
marcbax | 0:c643d398cdb6 | 56 | |
marcbax | 0:c643d398cdb6 | 57 | /* -- Sleep & delay -- */ |
marcbax | 0:c643d398cdb6 | 58 | |
marcbax | 0:c643d398cdb6 | 59 | extern void udelay(uint16_t us); |
marcbax | 0:c643d398cdb6 | 60 | extern void mdelay(uint16_t ms); |
marcbax | 0:c643d398cdb6 | 61 | extern void msleep(uint16_t ms); |
marcbax | 0:c643d398cdb6 | 62 | |
marcbax | 0:c643d398cdb6 | 63 | |
marcbax | 0:c643d398cdb6 | 64 | /* -- Debug utilities */ |
marcbax | 0:c643d398cdb6 | 65 | |
marcbax | 0:c643d398cdb6 | 66 | /** Print the contents of a buffer with offsets on stdout */ |
marcbax | 0:c643d398cdb6 | 67 | extern void dump_hex(const void *data, uint16_t len); |
marcbax | 0:c643d398cdb6 | 68 | |
marcbax | 0:c643d398cdb6 | 69 | #endif /* INCLUDE_UTIL_H */ |