remove LED, and add display control including USB D+ pull-up
This commit is contained in:
parent
dd509c3d8f
commit
2e9ad46a76
|
@ -932,6 +932,18 @@ static void process_command(char* str)
|
|||
}
|
||||
}
|
||||
|
||||
/** switch on power to display */
|
||||
inline static void display_on(void)
|
||||
{
|
||||
gpio_clear(GPIO_PORT(DISPLAY_POWER_PIN), GPIO_PIN(DISPLAY_POWER_PIN));
|
||||
}
|
||||
|
||||
/** switch off power to display */
|
||||
inline static void display_off(void)
|
||||
{
|
||||
gpio_set(GPIO_PORT(DISPLAY_POWER_PIN), GPIO_PIN(DISPLAY_POWER_PIN));
|
||||
}
|
||||
|
||||
/** program entry point
|
||||
* this is the firmware function started by the micro-controller
|
||||
*/
|
||||
|
@ -954,6 +966,10 @@ void main(void)
|
|||
#endif
|
||||
|
||||
board_setup(); // setup board
|
||||
// setup power to display an pull-up D+ to indicate USB connect
|
||||
rcc_periph_clock_enable(GPIO_RCC(DISPLAY_POWER_PIN)); // enable clock for GPIO peripheral
|
||||
gpio_set_mode(GPIO_PORT(DISPLAY_POWER_PIN), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO_PIN(DISPLAY_POWER_PIN)); // set pin to output open-drain since it is controlled by pMOS
|
||||
display_on();
|
||||
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
|
||||
printf("\nwelcome to the CuVoodoo USB cable tester\n"); // print welcome message
|
||||
|
||||
|
|
|
@ -96,6 +96,10 @@ void main(void)
|
|||
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz(); // start main clock
|
||||
board_setup(); // setup board to control LED
|
||||
// setup USB D+ pull-up to indicate USB connect
|
||||
rcc_periph_clock_enable(GPIO_RCC(DISPLAY_POWER_PIN)); // enable clock for GPIO peripheral
|
||||
gpio_set_mode(GPIO_PORT(DISPLAY_POWER_PIN), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO_PIN(DISPLAY_POWER_PIN)); // set pin to output open-drain since it is controlled by pMOS
|
||||
gpio_clear(GPIO_PORT(DISPLAY_POWER_PIN), GPIO_PIN(DISPLAY_POWER_PIN)); // enable USB D+ pull-up to indicate connection
|
||||
led_on(); // indicate bootloader started
|
||||
#if defined(BUSVOODOO)
|
||||
led_toggle(); // switch from blue to red LED
|
||||
|
|
7
global.h
7
global.h
|
@ -614,6 +614,7 @@
|
|||
/** @} */
|
||||
|
||||
/** @defgroup board_led board LED GPIO
|
||||
* @note the onboard LED of the USB cable tester is controlled along the display power and USB pull-up
|
||||
* @{
|
||||
*/
|
||||
#if defined(SYSTEM_BOARD) || defined(CORE_BOARD)
|
||||
|
@ -653,6 +654,9 @@
|
|||
#define BUTTON_PIN PA8 /**< GPIO pin (pin PA8) */
|
||||
#define BUTTON_PRESSED 0 /**< pin is low when button is pressed */
|
||||
#endif
|
||||
|
||||
// #define LED_PIN PD13 /**< GPIO pin */
|
||||
// #define LED_ON 0 /**< LED is on when pin is low */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup input to force DFU mode on low, even if application is valid
|
||||
|
@ -690,6 +694,9 @@
|
|||
#endif
|
||||
/** @} */
|
||||
|
||||
/** GPIO pin for display power, onboard LED, and USB D+ pull-up control (using a pMOS) */
|
||||
#define DISPLAY_POWER_PIN PD13
|
||||
|
||||
/** symbol for beginning of the application
|
||||
* @note this symbol will be provided by the linker script
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue