gex zero support, also nrf remapping based on platform and optional disable

This commit is contained in:
2018-05-04 22:18:52 +02:00
parent 30d1762710
commit 0bce53403f
12 changed files with 160 additions and 28 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
#define DEBUG_USART_BAUD 115200
#if GEX_PLAT_F072_DISCOVERY || GEX_PLAT_F072_HUB
#if GEX_PLAT_F072_DISCOVERY || GEX_PLAT_F072_HUB || GEX_PLAT_F072_ZERO
#define DEBUG_USART USART1
#define DEBUG_USART_RSC R_USART1
+6 -1
View File
@@ -246,7 +246,12 @@ void* irqd_detach(void *periph, IrqCallback callback)
return oldArg;
} else {
trap("Detach IRQ %p() from %p but %p() bound instead", callback, periph, slot->callback);
// catch bugs, but ignore an attempt to unbind when not bound
if (slot->callback != NULL) {
trap("Detach IRQ %p() from %p but %p() bound instead", callback, periph, slot->callback);
} else {
return NULL; // the arg - none
}
}
}
+19
View File
@@ -72,6 +72,8 @@
// PLAT_NO_AFNUM - legacy platform without numbered AF alternatives
// PLAT_FULL_XTAL - use two-wire xtal attachment
// SUPPORT_NRF
#if defined(GEX_PLAT_F103_BLUEPILL)
// platform name for the version string
@@ -189,6 +191,23 @@
// Status LED config
#define STATUS_LED_PORT 'A'
#define STATUS_LED_PIN 15 // RED LED "UP"
#elif defined(GEX_PLAT_F072_ZERO)
// platform name for the version string
#define GEX_PLATFORM "STM32F072-ZERO"
#define PLAT_FULL_XTAL 1
// Lock jumper config
#define LOCK_JUMPER_PORT 'D'
#define LOCK_JUMPER_PIN 2
#define PLAT_LOCK_BTN 1 // toggle button instead of a jumper
#define PLAT_LOCK_1CLOSED 1 // toggle button active in log. 1
// Status LED config
#define STATUS_LED_PORT 'A'
#define STATUS_LED_PIN 15 // RED LED "UP"
#define SUPPORT_NRF 1
#else
#error Bad platform
#endif
+9 -1
View File
@@ -27,9 +27,11 @@
void plat_init_resources(void)
{
// we use |= here, even though return values are not booleans - success is 0,
// thus any problem results in nonzero and the assert will trip.
uint32_t rv = 0;
// enable clock for units we use
// periphs available everywhere - enable clock
hw_periph_clock_enable(DMA1);
#ifdef DMA2
hw_periph_clock_enable(DMA2);
@@ -142,6 +144,12 @@ void plat_init_resources(void)
// USB
rv |= rsc_claim(&UNIT_SYSTEM, R_PA11);
rv |= rsc_claim(&UNIT_SYSTEM, R_PA12);
#if defined(GEX_PLAT_F072_ZERO)
// unconnected pins
rv |= rsc_claim_range(&UNIT_PLATFORM, R_PC0, R_PC1);
rv |= rsc_claim_range(&UNIT_PLATFORM, R_PC4, R_PC9);
#endif
}
#elif defined(GEX_PLAT_F303_DISCOVERY)
// Platform STM32F303VCT