mirror of
https://github.com/YuzuZensai/MCUFRIEND_kbv.git
synced 2026-01-06 04:32:38 +00:00
add pin macros for FRDM-KL26Z
This commit is contained in:
@@ -240,6 +240,57 @@
|
|||||||
#define PIN_INPUT(port, pin) (port)->PDDR &= ~(1u<<(pin))
|
#define PIN_INPUT(port, pin) (port)->PDDR &= ~(1u<<(pin))
|
||||||
#define PIN_READ(port, pin) (port)->PDIR & (1u<<(pin))
|
#define PIN_READ(port, pin) (port)->PDIR & (1u<<(pin))
|
||||||
|
|
||||||
|
#elif defined(MKL26Z4)
|
||||||
|
#include <MKL26Z4.h>
|
||||||
|
#define D0_PORT PTA
|
||||||
|
#define D0_PIN 1
|
||||||
|
#define D1_PORT PTA
|
||||||
|
#define D1_PIN 2
|
||||||
|
#define D2_PORT PTD
|
||||||
|
#define D2_PIN 3 //PTD4 on KL25
|
||||||
|
#define D3_PORT PTA
|
||||||
|
#define D3_PIN 12
|
||||||
|
#define D4_PORT PTA
|
||||||
|
#define D4_PIN 4
|
||||||
|
#define D5_PORT PTA
|
||||||
|
#define D5_PIN 5
|
||||||
|
#define D6_PORT PTC
|
||||||
|
#define D6_PIN 8
|
||||||
|
#define D7_PORT PTC
|
||||||
|
#define D7_PIN 9
|
||||||
|
#define D8_PORT PTA
|
||||||
|
#define D8_PIN 13
|
||||||
|
#define D9_PORT PTD
|
||||||
|
#define D9_PIN 2 //PTD5 on KL25
|
||||||
|
#define D10_PORT PTD
|
||||||
|
#define D10_PIN 4 //PTD0
|
||||||
|
#define D11_PORT PTD
|
||||||
|
#define D11_PIN 6 //PTD2
|
||||||
|
#define D12_PORT PTD
|
||||||
|
#define D12_PIN 7 //PTD3
|
||||||
|
#define D13_PORT PTD
|
||||||
|
#define D13_PIN 5 //PTD1
|
||||||
|
#define A0_PORT PTB
|
||||||
|
#define A0_PIN 0
|
||||||
|
#define A1_PORT PTB
|
||||||
|
#define A1_PIN 1
|
||||||
|
#define A2_PORT PTB
|
||||||
|
#define A2_PIN 2
|
||||||
|
#define A3_PORT PTB
|
||||||
|
#define A3_PIN 3
|
||||||
|
#define A4_PORT PTC
|
||||||
|
#define A4_PIN 2
|
||||||
|
#define A5_PORT PTC
|
||||||
|
#define A5_PIN 1
|
||||||
|
// Shield Control macros. Deliberately avoid the IOSET registers
|
||||||
|
#define PIN_LOW(port, pin) (port)->PCOR = (1<<(pin))
|
||||||
|
#define PIN_HIGH(port, pin) (port)->PSOR = (1<<(pin))
|
||||||
|
//#define PIN_LOW(port, pin) (port)->PDOR &= ~(1<<(pin))
|
||||||
|
//#define PIN_HIGH(port, pin) (port)->PDOR |= (1<<(pin))
|
||||||
|
#define PIN_OUTPUT(port, pin) (port)->PDDR |= (1<<(pin))
|
||||||
|
#define PIN_INPUT(port, pin) (port)->PDDR &= ~(1u<<(pin))
|
||||||
|
#define PIN_READ(port, pin) (port)->PDIR & (1u<<(pin))
|
||||||
|
|
||||||
#elif defined(MKL05Z4)
|
#elif defined(MKL05Z4)
|
||||||
#include <MKL05Z4.h>
|
#include <MKL05Z4.h>
|
||||||
#define D0_PORT PTB
|
#define D0_PORT PTB
|
||||||
|
|||||||
@@ -142,6 +142,32 @@
|
|||||||
#define setReadDir() {PTA->PDDR &= ~0x3030;PTC->PDDR &= ~0x0300;PTD->PDDR &= ~0x0030; }
|
#define setReadDir() {PTA->PDDR &= ~0x3030;PTC->PDDR &= ~0x0300;PTD->PDDR &= ~0x0030; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(MKL26Z4)
|
||||||
|
#include <MKL26Z4.h>
|
||||||
|
// configure macros for the data pins
|
||||||
|
#define AMASK ((1<<13)|(1<<12)|(1<<5)|(1<<4))
|
||||||
|
#define CMASK ((1<<9)|(1<<8))
|
||||||
|
#define DMASK ((1<<3)|(1<<2)) //PTD5, PTD4 on KL25Z
|
||||||
|
#define write_8(d) { \
|
||||||
|
PTA->PCOR = AMASK; PTC->PCOR = CMASK; PTD->PCOR = DMASK; \
|
||||||
|
PTA->PSOR = (((d) & (1<<0)) << 13) \
|
||||||
|
| (((d) & (1<<3)) << 9) \
|
||||||
|
| (((d) & (1<<4)) >> 0) \
|
||||||
|
| (((d) & (1<<5)) >> 0); \
|
||||||
|
PTC->PSOR = (((d) & (1<<6)) << 2) \
|
||||||
|
| (((d) & (1<<7)) << 2); \
|
||||||
|
PTD->PSOR = (((d) & (1<<1)) << 1) \
|
||||||
|
| (((d) & (1<<2)) << 1); \
|
||||||
|
}
|
||||||
|
#define read_8() ( (((PTA->PDIR & (1<<13)) >> 13) \
|
||||||
|
| ((PTA->PDIR & (1<<12)) >> 9) \
|
||||||
|
| ((PTA->PDIR & (3<<4)) >> 0) \
|
||||||
|
| ((PTC->PDIR & (3<<8)) >> 2) \
|
||||||
|
| ((PTD->PDIR & (1<<3)) >> 1) \
|
||||||
|
| ((PTD->PDIR & (1<<2)) >> 1)))
|
||||||
|
#define setWriteDir() {PTA->PDDR |= AMASK;PTC->PDDR |= CMASK;PTD->PDDR |= DMASK; }
|
||||||
|
#define setReadDir() {PTA->PDDR &= ~AMASK;PTC->PDDR &= ~CMASK;PTD->PDDR &= ~DMASK; }
|
||||||
|
|
||||||
#elif defined(MKL05Z4) || defined(TARGET_KL05Z)
|
#elif defined(MKL05Z4) || defined(TARGET_KL05Z)
|
||||||
#include <MKL05Z4.h>
|
#include <MKL05Z4.h>
|
||||||
// configure macros for the data pins
|
// configure macros for the data pins
|
||||||
|
|||||||
Reference in New Issue
Block a user