add defines for MY_BLUEPILL

This commit is contained in:
prenticedavid
2017-04-19 22:16:58 +01:00
parent 58db867f45
commit 3d3750e661
2 changed files with 75 additions and 0 deletions

View File

@@ -15,6 +15,25 @@
#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
#warning Uno Shield on BLUEPILL_ADAPTER