Version 5
Dependencies: BMP280 TextLCD BME280
Diff: Sampler.hpp
- Revision:
- 1:f89c930c6491
- Parent:
- 0:f9a18207d99c
- Child:
- 2:38d31b2e0956
diff -r f9a18207d99c -r f89c930c6491 Sampler.hpp --- a/Sampler.hpp Fri Nov 23 14:42:48 2018 +0000 +++ b/Sampler.hpp Sun Nov 25 16:19:10 2018 +0000 @@ -3,8 +3,8 @@ class Sampler { - friend class Ticker; - +friend class Ticker; // Share the private and protected sections to the non-member function + private: Ticker t; // Time Initialisation Thread t1; // Sample Thread @@ -12,9 +12,8 @@ void start() { - // t.attach(Callback(this,&doISR), 2); // Start the ticker to 0.5 seconds to test - t.attach(Callback<void()>(this, &Sampler::doISR), 2); - post(); // Hardware Testing + t.attach(Callback<void()>(this, &Sampler::doISR), 15); + post(); // Hardware Testing } void doISR() @@ -22,8 +21,11 @@ t1.signal_set(Activate_Flag); // Signal the sampling thread to move from WAITING to READY } + void mailqueuePush() + { + + } - static void samplingThread() { int idx = 0; @@ -35,7 +37,7 @@ printf("\033[H"); // Home Position printf("**********Sample %d**********\n", idx); printf("SW1: %d\tSW2: %d\n\r", SW1.read(), SW2.read()); - printf("LDR: %f\n\r", adcIn.read()*4095); + printf("LDR: %3.5f\n\r", adcIn.read()*4095); float temp = sensor.getTemperature(); float pressure = sensor.getPressure(); #ifdef BME @@ -58,8 +60,9 @@ idMain = osThreadGetId(); // CMSIS RTOS Call idSample = t1.gettid(); // Assign the id to the thread handle (Check this) t1.start(samplingThread); // Start the sampling thread - //NVIC_SetPriority(TIMER0_IRQn,osPriorityHigh); // Uncomment for priority setting in the NVIC + // NVIC_SetPriority(TIMER0_IRQn,osPriorityHigh); // Uncomment for priority setting in the NVIC } + //Destructor - should the instance go out of scope, this is called ~Sampler() {