Part Number: CC2640R2F
Tool/software: TI-RTOS
Hello everyone,
I am using CC2640R2 Launchpad to develop a BLE application for a custom board. The board will integrate a few I2C and SPI sensors.
I would like to discuss my approach to understand if it's reasonable.
I started from SimpleBlePeripheral application. I added 3 services (one for each sensor) and I can actually see them on my phone, along with all the characteristics. I'm thinking to add one task for each sensor which will be in charge of collecting data and process them. Then, the original SimpleBLEPeripheral task will be in charge of transmitting processed data to the smartphone. Hence, just one task will be registered with ICall.
This choice poses a few problems:
- I need to initialize I2C and SPI drivers and all the pins required for interrupts: I'm currently doing it in the ICall enabled task. Once that's done, I post a semaphore (lets' call it SEM1) to let the pther tasks initialize the sensors.
- I2C and SPI need to be shared among all tasks (except ICALL enabled task). How do I proceed here? My first thought is a semaphore (let's call it SEM2 for I2C and SEM3 for SPI). At this point al the sensors tasks should pend on at least 2 semaphores: is this possible? I haven't found any clue on either TI-RTOS manual or Semaphore API.
- One specific sensor (MAXIM MAX30102, it's a oulso-oxymeter) poses a further problem. It can issue many interrupts on the same pin. In particular I am interested in the fo,llowing: A) when a given threshold is exceeded (meaning the finger is on the sensor and the acquisition can start) and B) when the sensor FIFO is almost FULL and a I2C read must be performed to continue with the acquisition. Here, I am using a fourth semaphore (SEM4) to pend first on the proximity interrupt. Then, after disabling the proximity interrupt and enabling the fifo almost full interrupt, inside a loop I pend again on SEM4 to collect the required number of samples. Again, is this reasonable?
I found the Event module which seems to be appropriate for my situation. However, I am not sure how to proceed with the MAX30102 double interrupt. Is it possible to Event_pend twice in a task?
Best regards,
Jack
