UART driver tested with STM32L.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3330 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
baabff16e6
commit
278fc39f99
|
@ -63,8 +63,8 @@ int main(void) {
|
|||
* PA9 and PA10 are routed to USART1.
|
||||
*/
|
||||
sdStart(&SD1, NULL);
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_ALT_OUTPUT_PUSHPULL(7));
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_ALT_INPUT(7));
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
|
||||
|
||||
/*
|
||||
* If the user button is pressed after the reset then the test suite is
|
||||
|
|
|
@ -95,32 +95,6 @@
|
|||
#define PAL_MODE_INPUT_PULLDOWN (PAL_STM32_MODE_INPUT | \
|
||||
PAL_STM32_PUDR_PULLDOWN)
|
||||
|
||||
/**
|
||||
* @brief Alternate input high-Z pad.
|
||||
*
|
||||
* @param[in] n alternate function selector
|
||||
*/
|
||||
#define PAL_MODE_ALT_INPUT(n) (PAL_STM32_MODE_INPUT | \
|
||||
PAL_STM32_ALTERNATE(n))
|
||||
|
||||
/**
|
||||
* @brief Alternate input pad with weak pull up resistor.
|
||||
*
|
||||
* @param[in] n alternate function selector
|
||||
*/
|
||||
#define PAL_MODE_ALT_INPUT_PULLUP(n) (PAL_STM32_MODE_INPUT | \
|
||||
PAL_STM32_PUDR_PULLUP | \
|
||||
PAL_STM32_ALTERNATE(n))
|
||||
|
||||
/**
|
||||
* @brief Alternate input pad with weak pull down resistor.
|
||||
*
|
||||
* @param[in] n alternate function selector
|
||||
*/
|
||||
#define PAL_MODE_ALT_INPUT_PULLDOWN(n) (PAL_STM32_MODE_INPUT | \
|
||||
PAL_STM32_PUDR_PULLDOWN | \
|
||||
PAL_STM32_ALTERNATE(n))
|
||||
|
||||
/**
|
||||
* @brief Analog input mode.
|
||||
*/
|
||||
|
@ -139,21 +113,11 @@
|
|||
PAL_STM32_OTYPE_OPENDRAIN)
|
||||
|
||||
/**
|
||||
* @brief Alternate push-pull output.
|
||||
* @brief Alternate function.
|
||||
*
|
||||
* @param[in] n alternate function selector
|
||||
*/
|
||||
#define PAL_MODE_ALT_OUTPUT_PUSHPULL(n) (PAL_STM32_MODE_ALTERNATE | \
|
||||
PAL_STM32_OTYPE_PUSHPULL | \
|
||||
PAL_STM32_ALTERNATE(n))
|
||||
|
||||
/**
|
||||
* @brief Alternate push-pull output.
|
||||
*
|
||||
* @param[in] n alternate function selector
|
||||
*/
|
||||
#define PAL_MODE_ALT_OUTPUT_OPENDRAIN(n) (PAL_STM32_MODE_ALTERNATE | \
|
||||
PAL_STM32_OTYPE_OPENDRAIN | \
|
||||
#define PAL_MODE_ALTERNATE(n) (PAL_STM32_MODE_ALTERNATE | \
|
||||
PAL_STM32_ALTERNATE(n))
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -110,10 +110,10 @@ int main(void) {
|
|||
*/
|
||||
palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL |
|
||||
PAL_STM32_OSPEED_HIGHEST); /* NSS. */
|
||||
palSetPadMode(GPIOB, 13, PAL_MODE_ALT_OUTPUT_PUSHPULL(5) |
|
||||
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) |
|
||||
PAL_STM32_OSPEED_HIGHEST); /* SCK. */
|
||||
palSetPadMode(GPIOB, 14, PAL_MODE_ALT_INPUT(5)); /* MISO. */
|
||||
palSetPadMode(GPIOB, 15, PAL_MODE_ALT_OUTPUT_PUSHPULL(5) |
|
||||
palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5)); /* MISO. */
|
||||
palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) |
|
||||
PAL_STM32_OSPEED_HIGHEST); /* MOSI. */
|
||||
palSetPad(GPIOB, 12);
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ int main(void) {
|
|||
* PA9 and PA10 are routed to USART1.
|
||||
*/
|
||||
uartStart(&UARTD1, &uart_cfg_1);
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_ALT_OUTPUT_PUSHPULL(7));
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_ALT_INPUT(7));
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
|
||||
|
||||
/*
|
||||
* Starts the transmission, it will be handled entirely in background.
|
||||
|
|
Loading…
Reference in New Issue