Updated STM32 port to work with latest stack demos.
This commit is contained in:
@@ -30,6 +30,7 @@ static struct itimer Off_Delay_Timer_Rx;
|
||||
static struct itimer Off_Delay_Timer_Tx;
|
||||
static bool Rx_State;
|
||||
static bool Tx_State;
|
||||
static bool LD3_State;
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Activate the LED
|
||||
@@ -104,7 +105,7 @@ bool led_tx_state(void)
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Toggle the state of the setup LED
|
||||
* Description: Toggle the state of the LED
|
||||
* Returns: none
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
@@ -118,7 +119,7 @@ void led_tx_toggle(void)
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Toggle the state of the setup LED
|
||||
* Description: Toggle the state of the LED
|
||||
* Returns: none
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
@@ -195,6 +196,76 @@ void led_task(
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Activate the LED
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
**************************************************************************/
|
||||
void led_ld4_on(
|
||||
void)
|
||||
{
|
||||
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Deactivate the LED
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
**************************************************************************/
|
||||
void led_ld4_off(
|
||||
void)
|
||||
{
|
||||
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_RESET);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Activate the LED
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
**************************************************************************/
|
||||
void led_ld3_on(
|
||||
void)
|
||||
{
|
||||
GPIO_WriteBit(GPIOC, GPIO_Pin_9, Bit_SET);
|
||||
LD3_State = true;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Deactivate the LED
|
||||
* Returns: nothing
|
||||
* Notes: none
|
||||
**************************************************************************/
|
||||
void led_ld3_off(
|
||||
void)
|
||||
{
|
||||
GPIO_WriteBit(GPIOC, GPIO_Pin_9, Bit_RESET);
|
||||
LD3_State = false;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Get the state of the LED
|
||||
* Returns: true if on, false if off.
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
bool led_ld3_state(void)
|
||||
{
|
||||
return LD3_State;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Toggle the state of the LED
|
||||
* Returns: none
|
||||
* Notes: none
|
||||
*************************************************************************/
|
||||
void led_ld3_toggle(void)
|
||||
{
|
||||
if (led_ld3_state()) {
|
||||
led_ld3_off();
|
||||
} else {
|
||||
led_ld3_on();
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Description: Initialize the LED hardware
|
||||
* Returns: none
|
||||
@@ -206,19 +277,32 @@ void led_init(
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_StructInit(&GPIO_InitStructure);
|
||||
/* Configure the Receive LED */
|
||||
/* Configure the Receive LED on MS/TP board */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
/* Configure the Transmit LED */
|
||||
/* Configure the Transmit LED on MS/TP board */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
||||
/* Configure the LD4 on Discovery board */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
/* Configure the LD3 on Discovery board */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
/* Enable the GPIO_LED Clock */
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
|
||||
|
||||
led_tx_on_interval(500);
|
||||
led_rx_on_interval(500);
|
||||
led_tx_on();
|
||||
led_rx_on();
|
||||
led_ld3_on();
|
||||
led_ld4_on();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user