Open FFBoard
Open source force feedback firmware
global_callbacks.h
Go to the documentation of this file.
1/*
2 * global_callbacks.h
3 *
4 * Created on: 23.01.2020
5 * Author: Yannick
6 */
7
8#ifndef GLOBAL_CALLBACKS_H_
9#define GLOBAL_CALLBACKS_H_
10
11#include "main.h"
12
13#pragma once
14#ifdef __cplusplus
15
16#include <vector>
17
22template <class C> void addCallbackHandler(std::vector<C>& vec, C instance){
23 for(uint8_t i = 0; i < vec.size(); i++){
24 if( (vec)[i] == instance)
25 return;
26 }
27 vec.push_back(instance);
28}
29
33template <class C> void removeCallbackHandler(std::vector<C>& vec, C instance){
34 for (uint8_t i = 0; i < vec.size(); i++){
35 if( (vec)[i] == instance){
36 vec.erase(vec.begin()+i);
37 break;
38 }
39 }
40}
41
42extern "C" {
43#endif
44
45void startADC();
46volatile uint32_t* getAnalogBuffer(ADC_HandleTypeDef* hadc,uint8_t* chans); // Returns the DMA buffer for a hadc reference
47void CDC_Callback(uint8_t* Buf, uint32_t *Len);
49void USBD_OutEvent_HID(uint8_t* report);
50void USBD_GetEvent_HID(uint8_t id,uint16_t len,uint8_t** return_buf);
51
54
55void HAL_TIM_PeriodElapsedCallback_CPP(TIM_HandleTypeDef* htim);
56
57
58#ifdef __cplusplus
59}
60#endif
61
62
63
64#endif /* GLOBAL_CALLBACKS_H_ */
C
volatile uint32_t * getAnalogBuffer(ADC_HandleTypeDef *hadc, uint8_t *chans)
void USBD_OutEvent_HID(uint8_t *report)
void startADC()
void USBD_Resume()
void USBD_Suspend()
void USBD_GetEvent_HID(uint8_t id, uint16_t len, uint8_t **return_buf)
void addCallbackHandler(std::vector< C > &vec, C instance)
void HAL_TIM_PeriodElapsedCallback_CPP(TIM_HandleTypeDef *htim)
void CDC_Finished()
void CDC_Callback(uint8_t *Buf, uint32_t *Len)
void removeCallbackHandler(std::vector< C > &vec, C instance)