This is an alternative way to control which channel is active. is saves only the channels that are active in a vector.

Dependencies:   mbed

Fork of programmingtest by RespiratorySensor Team

Committer:
Jamess
Date:
Sun Feb 28 15:54:13 2016 +0000
Revision:
0:5ab9f1abaf4d
An alternative way to control which channels are active;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jamess 0:5ab9f1abaf4d 1 #include "Controler.h"
Jamess 0:5ab9f1abaf4d 2
Jamess 0:5ab9f1abaf4d 3 std::vector<uint32_t> checkActivity(Canal newChannel[]){
Jamess 0:5ab9f1abaf4d 4
Jamess 0:5ab9f1abaf4d 5 vector<uint32_t> activeChannelVector;
Jamess 0:5ab9f1abaf4d 6
Jamess 0:5ab9f1abaf4d 7 for(int count = 1; count<30;count++){
Jamess 0:5ab9f1abaf4d 8
Jamess 0:5ab9f1abaf4d 9 if(newChannel[count].getState() == 0){
Jamess 0:5ab9f1abaf4d 10
Jamess 0:5ab9f1abaf4d 11 //the chanel is not active
Jamess 0:5ab9f1abaf4d 12
Jamess 0:5ab9f1abaf4d 13
Jamess 0:5ab9f1abaf4d 14 }else if(newChannel[count].getState() == 1){
Jamess 0:5ab9f1abaf4d 15 //the chanel is active
Jamess 0:5ab9f1abaf4d 16
Jamess 0:5ab9f1abaf4d 17 activeChannelVector.push_back(count);
Jamess 0:5ab9f1abaf4d 18
Jamess 0:5ab9f1abaf4d 19 }else{
Jamess 0:5ab9f1abaf4d 20 //error here
Jamess 0:5ab9f1abaf4d 21 }
Jamess 0:5ab9f1abaf4d 22 }
Jamess 0:5ab9f1abaf4d 23
Jamess 0:5ab9f1abaf4d 24
Jamess 0:5ab9f1abaf4d 25
Jamess 0:5ab9f1abaf4d 26 return activeChannelVector;
Jamess 0:5ab9f1abaf4d 27
Jamess 0:5ab9f1abaf4d 28 }