Jens Altenburg
/
Fachbuch_Initialisierungen
Initialisation Nucleo-F446 by Jens Altenburg
main.h@0:9b6fbe273511, 2021-03-17 (annotated)
- Committer:
- prof_al
- Date:
- Wed Mar 17 13:55:03 2021 +0000
- Revision:
- 0:9b6fbe273511
Hardware Abstraction Layer (HAL) Nucleo-F446
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
prof_al | 0:9b6fbe273511 | 1 | /******************************************************************** |
prof_al | 0:9b6fbe273511 | 2 | * |
prof_al | 0:9b6fbe273511 | 3 | * Name: main.h |
prof_al | 0:9b6fbe273511 | 4 | * Beschreibung: grundlegende Typdefinitionen |
prof_al | 0:9b6fbe273511 | 5 | * Autor: |
prof_al | 0:9b6fbe273511 | 6 | * Erstellung: 29.05.2020 |
prof_al | 0:9b6fbe273511 | 7 | * |
prof_al | 0:9b6fbe273511 | 8 | * Revisionsliste |
prof_al | 0:9b6fbe273511 | 9 | * Datum | Autor | Änderung |
prof_al | 0:9b6fbe273511 | 10 | * ------------+---------------+-------------------------- |
prof_al | 0:9b6fbe273511 | 11 | * 29.05.2020 | Altenburg | Ersterstellung |
prof_al | 0:9b6fbe273511 | 12 | * ------------+---------------+-------------------------- |
prof_al | 0:9b6fbe273511 | 13 | * |
prof_al | 0:9b6fbe273511 | 14 | ********************************************************************/ |
prof_al | 0:9b6fbe273511 | 15 | #ifndef MAIN_H |
prof_al | 0:9b6fbe273511 | 16 | #define MAIN_H |
prof_al | 0:9b6fbe273511 | 17 | |
prof_al | 0:9b6fbe273511 | 18 | /**************************************************************************/ |
prof_al | 0:9b6fbe273511 | 19 | /* Definitions */ |
prof_al | 0:9b6fbe273511 | 20 | /**************************************************************************/ |
prof_al | 0:9b6fbe273511 | 21 | typedef unsigned char byte; /* vorzeichenlose 8-Bit-Zahl */ |
prof_al | 0:9b6fbe273511 | 22 | typedef unsigned short word; /* vorzeichenlose 16-Bit-Zahl */ |
prof_al | 0:9b6fbe273511 | 23 | typedef signed char int8; /* vorzeichenbehaftete 8-Bit-Zahl */ |
prof_al | 0:9b6fbe273511 | 24 | typedef signed short int16; /* vorzeichenbehaftete 16-Bit-Zahl */ |
prof_al | 0:9b6fbe273511 | 25 | //typedef byte bool; /* True/False Aussage */ |
prof_al | 0:9b6fbe273511 | 26 | typedef unsigned long dword; /* Long-Zahl */ |
prof_al | 0:9b6fbe273511 | 27 | typedef signed long int32; |
prof_al | 0:9b6fbe273511 | 28 | |
prof_al | 0:9b6fbe273511 | 29 | typedef void (* Def_fFunc)( void );/* Prototyp eines Funktionspointers */ |
prof_al | 0:9b6fbe273511 | 30 | |
prof_al | 0:9b6fbe273511 | 31 | typedef struct { |
prof_al | 0:9b6fbe273511 | 32 | byte abData[8]; |
prof_al | 0:9b6fbe273511 | 33 | }Def_stValue; |
prof_al | 0:9b6fbe273511 | 34 | |
prof_al | 0:9b6fbe273511 | 35 | |
prof_al | 0:9b6fbe273511 | 36 | #define True 1 |
prof_al | 0:9b6fbe273511 | 37 | #define False 0 |
prof_al | 0:9b6fbe273511 | 38 | #define true 1 |
prof_al | 0:9b6fbe273511 | 39 | #define false 0 |
prof_al | 0:9b6fbe273511 | 40 | #define On 1 |
prof_al | 0:9b6fbe273511 | 41 | #define Off 0 |
prof_al | 0:9b6fbe273511 | 42 | #define Yes 1 |
prof_al | 0:9b6fbe273511 | 43 | #define No 0 |
prof_al | 0:9b6fbe273511 | 44 | |
prof_al | 0:9b6fbe273511 | 45 | #define Bit0 0x01 /* Bit-Definitionen */ |
prof_al | 0:9b6fbe273511 | 46 | #define Bit1 0x02 |
prof_al | 0:9b6fbe273511 | 47 | #define Bit2 0x04 |
prof_al | 0:9b6fbe273511 | 48 | #define Bit3 0x08 |
prof_al | 0:9b6fbe273511 | 49 | #define Bit4 0x10 |
prof_al | 0:9b6fbe273511 | 50 | #define Bit5 0x20 |
prof_al | 0:9b6fbe273511 | 51 | #define Bit6 0x40 |
prof_al | 0:9b6fbe273511 | 52 | #define Bit7 0x80 |
prof_al | 0:9b6fbe273511 | 53 | #define Bit8 (unsigned long)(1 << 8) /* Bit-Definitionen */ |
prof_al | 0:9b6fbe273511 | 54 | #define Bit9 (unsigned long)(1 << 9) |
prof_al | 0:9b6fbe273511 | 55 | #define Bit10 (1 << 10) |
prof_al | 0:9b6fbe273511 | 56 | #define Bit11 (unsigned long)(1 << 11) |
prof_al | 0:9b6fbe273511 | 57 | #define Bit12 (1 << 12) |
prof_al | 0:9b6fbe273511 | 58 | #define Bit13 (unsigned long)(1 << 13) |
prof_al | 0:9b6fbe273511 | 59 | #define Bit14 (1 << 14) |
prof_al | 0:9b6fbe273511 | 60 | #define Bit15 (unsigned long)(1 << 15) |
prof_al | 0:9b6fbe273511 | 61 | #define Bit16 (unsigned long)(1 << 16) /* Bit-Definitionen */ |
prof_al | 0:9b6fbe273511 | 62 | #define Bit17 (unsigned long)(1 << 17) |
prof_al | 0:9b6fbe273511 | 63 | #define Bit18 (unsigned long)(1 << 18) |
prof_al | 0:9b6fbe273511 | 64 | #define Bit19 (unsigned long)(1 << 19) |
prof_al | 0:9b6fbe273511 | 65 | #define Bit20 (unsigned long)(1 << 20) |
prof_al | 0:9b6fbe273511 | 66 | #define Bit21 (unsigned long)(1 << 21) |
prof_al | 0:9b6fbe273511 | 67 | #define Bit22 (unsigned long)(1 << 22) |
prof_al | 0:9b6fbe273511 | 68 | #define Bit23 (unsigned long)(1 << 23) |
prof_al | 0:9b6fbe273511 | 69 | #define Bit24 (unsigned long)(1 << 24) /* Bit-Definitionen */ |
prof_al | 0:9b6fbe273511 | 70 | #define Bit25 (unsigned long)(1 << 25) |
prof_al | 0:9b6fbe273511 | 71 | #define Bit26 (unsigned long)(1 << 26) |
prof_al | 0:9b6fbe273511 | 72 | #define Bit27 (unsigned long)(1 << 27) |
prof_al | 0:9b6fbe273511 | 73 | #define Bit28 (unsigned long)(1 << 28) |
prof_al | 0:9b6fbe273511 | 74 | #define Bit29 (unsigned long)(1 << 29) |
prof_al | 0:9b6fbe273511 | 75 | #define Bit30 (unsigned long)(1 << 30) |
prof_al | 0:9b6fbe273511 | 76 | #define Bit31 (unsigned long)(1 << 31) |
prof_al | 0:9b6fbe273511 | 77 | |
prof_al | 0:9b6fbe273511 | 78 | /************************************************************************** |
prof_al | 0:9b6fbe273511 | 79 | * I2C - Zugriff auf HAL |
prof_al | 0:9b6fbe273511 | 80 | **************************************************************************/ |
prof_al | 0:9b6fbe273511 | 81 | void vSDAOutput ( void ); /* SDA-Datenrichtung -> Output */ |
prof_al | 0:9b6fbe273511 | 82 | void vSDAInput ( void ); /* SDA-Datenrichtung -> Input */ |
prof_al | 0:9b6fbe273511 | 83 | |
prof_al | 0:9b6fbe273511 | 84 | void vSDA_H ( void ); /* SDA setzen */ |
prof_al | 0:9b6fbe273511 | 85 | void vSDA_L ( void ); /* SDA löschen */ |
prof_al | 0:9b6fbe273511 | 86 | void vSCL_H ( void ); /* SCL setzen */ |
prof_al | 0:9b6fbe273511 | 87 | void vSCL_L ( void ); /* SCL löschen */ |
prof_al | 0:9b6fbe273511 | 88 | |
prof_al | 0:9b6fbe273511 | 89 | void vI2CDelay ( void ); /* Warteschleife für SCL-Takt */ |
prof_al | 0:9b6fbe273511 | 90 | void vI2CShort ( void ); /* Warteschleife für set-up-Zeiten */ |
prof_al | 0:9b6fbe273511 | 91 | |
prof_al | 0:9b6fbe273511 | 92 | #endif |
prof_al | 0:9b6fbe273511 | 93 | /********************************************************************/ |
prof_al | 0:9b6fbe273511 | 94 |