16FXlib
util.h
Go to the documentation of this file.
1 
2 //*****************************************************************************
3 // Author : Christian Illy
4 // Created : 19.04.2009
5 // Revised : 05.07.2009
6 // Version : 0.1
7 // Target MCU : Fujitsu MB96300 series
8 //
9 // This program is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 //
28 //*****************************************************************************
30 #ifndef ROUTINES_H_
31 #define ROUTINES_H_
32 
33 #include "inttypes.h"
34 
39 #define _BV(bit) (1l << (bit))
40 
46 #define RETURN_ERROR(value, max) if ((value) > (max)) return 0;
47 
52 extern void delay(uint16_t del);
53 
59 extern void delay_us(uint16_t us);
60 
65 extern void delay_ms(uint16_t ms);
66 
71 extern void delay_s(uint16_t s);
72 
78 extern int sgn(int x);
79 
88 extern void intToStr(uint32_t val, uint8_t digits, uint8_t fuellChar, char* dest);
89 
98 extern void intToHex(uint32_t val, uint8_t digits, uint8_t fuellchar, char* dest);
99 
100 
104 extern void random_init(void);
105 
112 extern uint32_t random(void);
113 
117 #define RANDOM_INIT_PIN_COUNT 5
118 
122 #define RANDOM_INIT_PIN_START 3
123 
127 #define PRESCALER_MS 1993l
128 
129 #endif /* ROUTINES_H_ */
130 
int sgn(int x)
Definition: util.c:51
unsigned long uint32_t
Definition: inttypes.h:60
unsigned int uint16_t
Definition: inttypes.h:50
void delay_us(uint16_t us)
Definition: util.c:34
unsigned char uint8_t
Definition: inttypes.h:35
void delay_s(uint16_t s)
Definition: util.c:46
uint32_t random(void)
Definition: util.c:120
void delay_ms(uint16_t ms)
Definition: util.c:41
void random_init(void)
Definition: util.c:107
void delay(uint16_t del)
Definition: util.c:28
void intToHex(uint32_t val, uint8_t digits, uint8_t fuellchar, char *dest)
Definition: util.c:78
void intToStr(uint32_t val, uint8_t digits, uint8_t fuellChar, char *dest)
Definition: util.c:55