Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
geier99 committed Feb 20, 2016
1 parent 8cf4d27 commit b68cb24
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ STM32-Test/MDK-ARM/STM32-Test Configuration/ExtDll.iex
*.dep
*.Andreas
STM32-Test/MDK-ARM/STM32-Test/STM32-Test.axf
STM32-Test/MDK-ARM/STM32-Test/ExtDll.iex
22 changes: 20 additions & 2 deletions STM32-Test/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,31 @@ typedef volatile struct timeoutticks_st {
uint32_t ledTicks; // ticks für led blinken
} timeoutticks_t;

//! Status Flags from STM32-CAN device
typedef volatile struct stm32Status_st {
uint32_t usbConnected ; // set to 1 then stm32 is connected to usb and initialized

} stm32Status_t;;


static timeoutticks_t TimeoutTicks = {
CAN_TRANSMIT_DELAY // this have to be always the first entry
, LED_TICKS
};

static timeoutticks_t * const pTicks = &TimeoutTicks; // I like pointers, so I use pointers :-)

static stm32Status_t stm32Status;
static stm32Status_t * const pStatus = &stm32Status;


static CanTxMsgTypeDef myTxMessage;
static CanRxMsgTypeDef myRxMessage;
static CAN_FilterConfTypeDef myFilter;

unsigned char usbHelloMsg[]= "\nGreetings from USB device";
unsigned char usbHelloMsg[]= "\nGreetings from USB device";

unsigned char usbLine[50];


/* USER CODE END PV */
Expand All @@ -88,6 +99,8 @@ static void MX_WWDG_Init(void);
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan);
void HAL_SYSTICK_Callback(void); // handle own additional systicks



/* USER CODE END PFP */

/* USER CODE BEGIN 0 */
Expand Down Expand Up @@ -176,6 +189,10 @@ int main(void)

HAL_CAN_Receive_IT(&hcan1,CAN_FIFO0);





if(!pTicks->ledTicks) {
pTicks->ledTicks = LED_TICKS;

Expand All @@ -186,7 +203,8 @@ int main(void)
pTicks->canTransmitDelay = CAN_TRANSMIT_DELAY;

HAL_CAN_Transmit_IT(&hcan1);
CDC_Transmit_FS(usbHelloMsg,strlen(usbHelloMsg));

CDC_Transmit_FS(usbHelloMsg,strlen((const char *)usbHelloMsg));

}

Expand Down
1 change: 1 addition & 0 deletions STM32-Test/Src/usbd_cdc_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static int8_t CDC_Init_FS(void)
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(hUsbDevice_0, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(hUsbDevice_0, UserRxBufferFS);
USBD_CDC_ReceivePacket(hUsbDevice_0);
return (USBD_OK);
/* USER CODE END 3 */
}
Expand Down

0 comments on commit b68cb24

Please sign in to comment.