Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion fw/rbcx-coprocessor/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,55 @@
"spellright.documentTypes": ["markdown", "latex", "plaintext", "cpp"],
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"C_Cpp.default.includePath": ["include/"]
"C_Cpp.default.includePath": [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tohle se mi pokaždé snaží uložit VScode, tak jsem to tam už nechal.

"include/"
],
"files.associations": {
"string_view": "cpp",
"array": "cpp",
"string": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"optional": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp"
}
}
6 changes: 6 additions & 0 deletions fw/rbcx-coprocessor/include/Bsp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ inline const PinDef debugUartTxPin = std::make_pair(GPIOC, GPIO_PIN_10);
inline const PinDef debugUartRxPin = std::make_pair(GPIOC, GPIO_PIN_11);
inline const PinDef servoUartTxRxPin = std::make_pair(GPIOC, GPIO_PIN_12);

inline const PinDef mpuIntPin = std::make_pair(GPIOD, GPIO_PIN_15);

inline const PinDef i2cSda = std::make_pair(GPIOB, GPIO_PIN_9);
inline const PinDef i2cScl = std::make_pair(GPIOB, GPIO_PIN_8);

Expand Down Expand Up @@ -384,6 +386,10 @@ inline void pinsInit() {
HAL_NVIC_SetPriority(EXTI9_5_IRQn, utsIRQPrio, 0); // Ultrasound
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);

// MPU interrupt
pinInit(mpuIntPin, GPIO_MODE_IT_RISING, GPIO_NOPULL, GPIO_SPEED_FREQ_LOW);
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 7, 0);

HAL_NVIC_SetPriority(i2cEvIRQn, i2cIRQnPrio, 0);
HAL_NVIC_SetPriority(i2cErIRQn, i2cIRQnPrio, 0);
HAL_NVIC_EnableIRQ(i2cEvIRQn);
Expand Down
13 changes: 6 additions & 7 deletions fw/rbcx-coprocessor/include/I2cController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ THE SOFTWARE.

enum I2cEvents : uint32_t {
I2C_NONE = 0,
I2C_MPU_TICK = 1,
I2C_MESSAGE = 2,
I2C_MPU_TICK = 1 << 0,
I2C_MESSAGE = 1 << 1,
};

extern TaskHandle_t i2cTaskHandle;
extern EventGroupHandle_t i2cEventGroup;

void i2cDispatch(const CoprocReq_I2cReq& req);
void i2cReset();
void i2cSetEventFlag(I2cEvents flag);
void i2cSetEventFlagFromIsr(I2cEvents flag);

#define I2CDEV_DEFAULT_READ_TIMEOUT 10

Expand Down Expand Up @@ -103,6 +102,6 @@ uint16_t I2Cdev_writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart,
uint16_t I2Cdev_writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data);
uint16_t I2Cdev_writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data);
uint16_t I2Cdev_writeBytes(
uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t* data);
uint8_t devAddr, uint8_t regAddr, uint8_t length, const uint8_t* data);
uint16_t I2Cdev_writeWords(
uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t* data);
uint8_t devAddr, uint8_t regAddr, uint8_t length, const uint16_t* data);
Loading