File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 33#include "py/obj.h"
44#include "py/runtime.h"
55
6+ #include "freertos/FreeRTOS.h"
7+ #include "freertos/task.h"
8+ #include "freertos/semphr.h"
9+
610#ifndef __MP_I2C_COMMON_H__
711 #define __MP_I2C_COMMON_H__
812
1115 typedef struct _mp_machine_hw_i2c_bus_obj_t mp_machine_hw_i2c_bus_obj_t ;
1216 typedef struct _mp_machine_hw_i2c_device_obj_t mp_machine_hw_i2c_device_obj_t ;
1317
14- typedef struct _i2c_bus_lock_t i2c_bus_lock_t ;
18+ typedef struct _i2c_bus_lock_t {
19+ SemaphoreHandle_t handle ;
20+ StaticSemaphore_t buffer ;
21+ } i2c_bus_lock_t ;
22+
1523
1624 struct _mp_machine_hw_i2c_bus_obj_t {
1725 mp_obj_base_t base ;
Original file line number Diff line number Diff line change 7272 static mp_machine_hw_i2c_bus_obj_t machine_hw_i2c_obj [I2C_NUM_MAX ];
7373
7474
75- struct _i2c_bus_lock_t {
76- SemaphoreHandle_t handle ;
77- StaticSemaphore_t buffer ;
78- };
79-
80-
8175 #define I2C_BUS_LOCK_ACQUIRE (self ) xSemaphoreTake(self->lock.handle, portMAX_DELAY)
8276 #define I2C_BUS_LOCK_DELETE (self ) vSemaphoreDelete(self->lock.handle)
8377 #define I2C_BUS_LOCK_RELEASE (self ) xSemaphoreGive(self->lock.handle)
You can’t perform that action at this time.
0 commit comments