Statistics
| Branch: | Tag: | Revision:

amiro-os / devices / LightRing / LightRing.h @ ba75ee1d

History | View | Annotate | Download (1.198 KB)

1
#ifndef _AMIRO_LIGTH_RING_H_
2
#define _AMIRO_LIGTH_RING_H_
3

    
4
#include <amiro/Constants.h>
5

    
6
#include <amiro/ControllerAreaNetworkRx.h>
7
#include <amiro/ControllerAreaNetworkTx.h>
8
#include <amiro/leds/tlc5947.hpp>
9
#include <amiro/FileSystemInputOutput/FSIOLightRing.hpp>
10

    
11
using namespace chibios_rt;
12

    
13
namespace amiro {
14

    
15
  class LightRing : public ControllerAreaNetworkTx, public ControllerAreaNetworkRx {
16
  public:
17
    LightRing(CANDriver *can, TLC5947 *tlc5947, fileSystemIo::FSIOLightRing *memory);
18
    void setLightBrightness(int brightness);
19
    void setLightColor(int index, Color color);
20

    
21
    /** \brief Handle the termination of ControllerAreaNetworkTx and ControllerAreaNetworkRx threads
22
     *         This includes waiting until the threads have terminated, thus this function might block a relatively long time.
23
     */
24
    msg_t terminate(void);
25

    
26
    /** \brief Handle the start of ControllerAreaNetworkTx and ControllerAreaNetworkRx threads */
27
    ThreadReference start(tprio_t PRIO);
28

    
29
  protected:
30
    virtual msg_t receiveMessage(CANRxFrame *frame);
31
    virtual void periodicBroadcast();
32

    
33
  private:
34
    TLC5947 *tlc5947;
35
    fileSystemIo::FSIOLightRing *memory;
36
  };
37

    
38
}
39

    
40
#endif /* _AMIRO_LIGTH_RING_H_ */
41

    
42
/** @} */