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.
Fork of FastIO by
FastIO_K20D50M_KPSDK.h
00001 #if defined(TARGET_K20D50M) | defined(TARGET_KPSDK_MCUS) 00002 00003 #include "mbed.h" 00004 #include "pinmap.h" 00005 00006 typedef struct { 00007 uint32_t mask; 00008 } fastio_vars; 00009 00010 //K20D50M and KPSDK use slightly different pinnames, shifted 2 00011 #ifdef TARGET_KPSDK_MCUS 00012 #define PORT_SHIFT GPIO_PORT_SHIFT 00013 #define PINMASK (1 << (pin & 0x1F)) 00014 #define PCR ((__IO uint32_t*)(PORTA_BASE + ((pin & 0x1F) << 2) + ((pin >> PORT_SHIFT) << PORT_SHIFT) )) 00015 #else 00016 #define PINMASK (1 << ((pin & 0x7F) >> 2)) 00017 #define PCR ((__IO uint32_t*)(PORTA_BASE + pin)) 00018 #endif 00019 00020 #define PORT_BASE ((GPIO_Type *)(PTA_BASE + ((unsigned int)pin >> PORT_SHIFT) * 0x40)) 00021 00022 #define INIT_PIN container.mask = PINMASK; pin_function(pin, 1) 00023 #define DESTROY_PIN 00024 00025 #define SET_DIR_INPUT (PORT_BASE->PDDR &= ~PINMASK) 00026 #define SET_DIR_OUTPUT (PORT_BASE->PDDR |= PINMASK) 00027 #define SET_MODE(pull) (*PCR = (*PCR & ~0x3) | pull) 00028 00029 #define WRITE_PIN_SET (PORT_BASE->PSOR |= container.mask) 00030 #define WRITE_PIN_CLR (PORT_BASE->PCOR |= container.mask) 00031 00032 #define READ_PIN ((PORT_BASE->PDIR & container.mask) ? 1 : 0) 00033 00034 #endif
Generated on Wed Jul 13 2022 05:20:08 by
1.7.2
