commit
966b21c3e1
|
@ -41,6 +41,7 @@ static void setup_vbus_irq(void);
|
|||
/* Pins PB[7:5] are used to detect hardware revision.
|
||||
* 000 - Original production build.
|
||||
* 001 - Mini production build.
|
||||
* 010 - Mini V2.0e and later.
|
||||
*/
|
||||
int platform_hwversion(void)
|
||||
{
|
||||
|
@ -57,6 +58,10 @@ int platform_hwversion(void)
|
|||
|
||||
/* Enable the weak pull up. */
|
||||
gpio_set(GPIOB, hwversion_pins);
|
||||
|
||||
/* Wait a little to make sure the pull up is in effect... */
|
||||
for(int i = 0; i < 100; i++) asm("nop");
|
||||
|
||||
/* Get all pins that are pulled low in hardware.
|
||||
* This also sets all the "unused" pins to 1.
|
||||
*/
|
||||
|
@ -64,10 +69,13 @@ int platform_hwversion(void)
|
|||
|
||||
/* Enable the weak pull down. */
|
||||
gpio_clear(GPIOB, hwversion_pins);
|
||||
|
||||
/* Wait a little to make sure the pull down is in effect... */
|
||||
for(int i = 0; i < 100; i++) asm("nop");
|
||||
|
||||
/* Get all the pins that are pulled high in hardware. */
|
||||
uint16_t pins_positive = gpio_get(GPIOB, hwversion_pins);
|
||||
|
||||
|
||||
/* Hardware version is the id defined by the pins that are
|
||||
* asserted low or high by the hardware. This means that pins
|
||||
* that are left floating are 0 and those that are either
|
||||
|
|
|
@ -93,9 +93,9 @@
|
|||
#define LED_0 GPIO2
|
||||
#define LED_1 GPIO10
|
||||
#define LED_2 GPIO11
|
||||
#define LED_UART LED_2
|
||||
#define LED_UART (platform_hwversion() < 2 ? LED_2 : LED_0)
|
||||
#define LED_IDLE_RUN LED_1
|
||||
#define LED_ERROR LED_0
|
||||
#define LED_ERROR (platform_hwversion() < 2 ? LED_0 : LED_2)
|
||||
|
||||
#define TMS_SET_MODE() \
|
||||
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
|
||||
|
|
Loading…
Reference in New Issue