mirror of
https://github.com/YuzuZensai/MCUFRIEND_kbv.git
synced 2026-01-06 04:32:38 +00:00
add defines for MY_BLUEPILL
This commit is contained in:
@@ -13,6 +13,62 @@
|
|||||||
//#warning Using pin_SHIELD_1.h
|
//#warning Using pin_SHIELD_1.h
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
#elif defined(MY_BLUEPILL)
|
||||||
|
#define PIN_MODE2(reg, pin, mode) reg=(reg&~(0x3<<((pin)<<1)))|(mode<<((pin)<<1))
|
||||||
|
#if defined(__CC_ARM)
|
||||||
|
#include <STM32F10X.h>
|
||||||
|
#else
|
||||||
|
#include <STM32F1XX.h>
|
||||||
|
#endif
|
||||||
|
#define D0_PORT GPIOB
|
||||||
|
#define D0_PIN 11
|
||||||
|
#define D1_PORT GPIOB
|
||||||
|
#define D1_PIN 10
|
||||||
|
#define D2_PORT GPIOB
|
||||||
|
#define D2_PIN 6
|
||||||
|
#define D3_PORT GPIOB
|
||||||
|
#define D3_PIN 7
|
||||||
|
#define D4_PORT GPIOA
|
||||||
|
#define D4_PIN 0
|
||||||
|
#define D5_PORT GPIOA
|
||||||
|
#define D5_PIN 1
|
||||||
|
#define D6_PORT GPIOA
|
||||||
|
#define D6_PIN 2
|
||||||
|
#define D7_PORT GPIOA
|
||||||
|
#define D7_PIN 3
|
||||||
|
#define D8_PORT GPIOA
|
||||||
|
#define D8_PIN 9
|
||||||
|
#define D9_PORT GPIOA
|
||||||
|
#define D9_PIN 10
|
||||||
|
#define D10_PORT GPIOB
|
||||||
|
#define D10_PIN 12
|
||||||
|
#define D11_PORT GPIOB
|
||||||
|
#define D11_PIN 15
|
||||||
|
#define D12_PORT GPIOB
|
||||||
|
#define D12_PIN 14
|
||||||
|
#define D13_PORT GPIOB
|
||||||
|
#define D13_PIN 13
|
||||||
|
#define A0_PORT GPIOB
|
||||||
|
#define A0_PIN 1
|
||||||
|
#define A1_PORT GPIOB
|
||||||
|
#define A1_PIN 0
|
||||||
|
#define A2_PORT GPIOA
|
||||||
|
#define A2_PIN 7
|
||||||
|
#define A3_PORT GPIOA
|
||||||
|
#define A3_PIN 6
|
||||||
|
#define A4_PORT GPIOA
|
||||||
|
#define A4_PIN 5
|
||||||
|
#define A5_PORT GPIOB
|
||||||
|
#define A5_PIN 4
|
||||||
|
// Shield Control macros
|
||||||
|
#define PIN_LOW(port, pin) (port)->BSRR = (1<<((pin)+16))
|
||||||
|
#define PIN_HIGH(port, pin) (port)->BSRR = (1<<(pin))
|
||||||
|
#define PIN_READ(port, pin) (port)->IDR & (1<<(pin))
|
||||||
|
#define PIN_MODE4(reg, pin, mode) reg=(reg&~(0xF<<((pin)<<2)))|(mode<<((pin)<<2))
|
||||||
|
#define PIN_OUTPUT(port, pin) {if (pin > 7) PIN_MODE4((port)->CRH, (pin&7), 0x3); else PIN_MODE4((port)->CRL, pin, 0x3); } //50MHz push-pull only 0-7
|
||||||
|
#define PIN_INPUT(port, pin) {if (pin > 7) PIN_MODE4((port)->CRH, (pin&7), 0x4); else PIN_MODE4((port)->CRL, pin, 0x4); } //input
|
||||||
|
|
||||||
|
|
||||||
#elif defined(BLUEPILL)
|
#elif defined(BLUEPILL)
|
||||||
#define PIN_MODE2(reg, pin, mode) reg=(reg&~(0x3<<((pin)<<1)))|(mode<<((pin)<<1))
|
#define PIN_MODE2(reg, pin, mode) reg=(reg&~(0x3<<((pin)<<1)))|(mode<<((pin)<<1))
|
||||||
#if defined(__CC_ARM)
|
#if defined(__CC_ARM)
|
||||||
|
|||||||
@@ -15,6 +15,25 @@
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
#elif defined(MY_BLUEPILL) // Uno Shield on BLUEPILL_ADAPTER
|
||||||
|
#warning Uno Shield on MY_BLUEPILL_ADAPTER
|
||||||
|
|
||||||
|
// configure macros for the data pins
|
||||||
|
#define AMASK 0x060F
|
||||||
|
#define BMASK 0x00C0
|
||||||
|
#define write_8(d) { GPIOA->BSRR = AMASK << 16; GPIOB->BSRR = BMASK << 16; \
|
||||||
|
GPIOA->BSRR = (((d) & 3) << 9) | (((d) & 0xF0) >> 4); \
|
||||||
|
GPIOB->BSRR = (((d) & 0x0C) << 4); \
|
||||||
|
}
|
||||||
|
#define read_8() (((GPIOA->IDR & (3<<9)) >> 9) | ((GPIOA->IDR & (0x0F)) << 4) | ((GPIOB->IDR & (3<<6)) >> 4))
|
||||||
|
|
||||||
|
#define GROUP_MODE(port, reg, mask, val) {port->reg = (port->reg & ~(mask)) | ((mask)&(val)); }
|
||||||
|
#define GP_OUT(port, reg, mask) GROUP_MODE(port, reg, mask, 0x33333333)
|
||||||
|
#define GP_INP(port, reg, mask) GROUP_MODE(port, reg, mask, 0x44444444)
|
||||||
|
// PA10,PA9 PA3-PA0 PB7,PB6
|
||||||
|
#define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFF0); GP_OUT(GPIOA, CRL, 0xFFFF); GP_OUT(GPIOB, CRL, 0xFF000000); }
|
||||||
|
#define setReadDir() {GP_INP(GPIOA, CRH, 0xFF0); GP_INP(GPIOA, CRL, 0xFFFF); GP_INP(GPIOB, CRL, 0xFF000000); }
|
||||||
|
|
||||||
#elif defined(BLUEPILL) // Uno Shield on BLUEPILL_ADAPTER
|
#elif defined(BLUEPILL) // Uno Shield on BLUEPILL_ADAPTER
|
||||||
#warning Uno Shield on BLUEPILL_ADAPTER
|
#warning Uno Shield on BLUEPILL_ADAPTER
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user