Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
mbed_globals.h
- Committer:
- Alkorin
- Date:
- 2010-11-09
- Revision:
- 4:afddc4848b6c
- Parent:
- 3:0b94bf95c552
- Child:
- 5:b3aa0a49e21f
File content as of revision 4:afddc4848b6c:
#ifndef __MBED_GLOBALS_H__ #define __MBED_GLOBALS_H__ #include <LPC17xx.h> /* GLOBALS MACRO */ #define GET_REGISTER8(reg) *(volatile uint8_t *)(reg) #define GET_REGISTER16(reg) *(volatile uint16_t *)(reg) #define GET_REGISTER32(reg) *(volatile uint32_t *)(reg) #define SET_REGISTER8(reg, val) *(uint8_t *)(reg)=(val) #define SET_REGISTER16(reg, val) *(uint16_t *)(reg)=(val) #define SET_REGISTER32(reg, val) *(uint32_t *)(reg)=(val) // See 34.3.2.5 p740 #define BIT_BANDING_ADDRESS(reg, bit) (((reg) & 0xF0000000) | (0x02000000) | (((reg) & 0x000FFFFF) << 5) | ((bit) << 2)) #define GET_BIT_VALUE(reg, bit) GET_REGISTER32(BIT_BANDING_ADDRESS(((uint32_t)®), bit)) #define SET_BIT_VALUE(reg, bit, value) SET_REGISTER32(BIT_BANDING_ADDRESS(((uint32_t)®), bit), (value)) #endif