COSA
An Object-Oriented Platform for Arduino Programming
Fai.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_FAI_HH
22 #define COSA_FAI_HH
23 
24 #include "Cosa/Types.h"
25 #include "Cosa/Pin.hh"
26 #include "Cosa/AnalogPin.hh"
27 #include "Cosa/Event.hh"
28 
29 #include <Ciao.h>
30 
34 class Fai : public Ciao {
35 public:
39  class Descriptor {
40  public:
41  enum {
48  };
49  static const Ciao::Descriptor::user_t analog_pin_t PROGMEM;
52  static const Ciao::Descriptor::user_t event_t PROGMEM;
54  static const Ciao::Descriptor::user_t set_mode_t PROGMEM;
55  };
56 
60  struct analog_pin_t {
61  uint8_t pin;
62  uint16_t value;
63  };
64 
68  struct digital_pin_t {
69  uint8_t pin;
70  uint8_t value;
71  };
72 
76  struct digital_pins_t {
77  uint32_t values;
78  };
79 
84  uint32_t pins;
85  uint16_t period;
86  };
87 
91  struct set_mode_t {
92  uint8_t pin;
93  uint8_t mode;
94  };
95 
100  Fai(IOStream::Device* dev = NULL) : Ciao(dev) {}
101 
105  void begin();
106 
111  void write(uint32_t mask);
112 
117  void write(Pin* pin);
118 
123  void write(AnalogPin* pin);
124 
129  void write(Event* event)
130  {
131  Ciao::write(&Descriptor::event_t, event, 1);
132  }
133 };
134 
135 #endif
uint8_t pin
Definition: Fai.hh:61
void begin()
Definition: Fai.cpp:28
Definition: Pin.hh:35
uint8_t pin
Definition: Fai.hh:92
uint8_t mode
Definition: Fai.hh:93
void write(char *s)
Definition: Ciao.cpp:87
Definition: Ciao.hh:47
#define NULL
Definition: Types.h:101
uint8_t pin
Definition: Fai.hh:69
void write(uint32_t mask)
Definition: Fai.cpp:61
uint16_t value
Definition: Fai.hh:62
uint32_t values
Definition: Fai.hh:77
static const Ciao::Descriptor::user_t event_t
Definition: Fai.hh:52
uint32_t pins
Definition: Fai.hh:84
Cosa Fai descriptors (8-bit, 16-).
Definition: Ciao.hh:100
uint16_t period
Definition: Fai.hh:85
void write(Event *event)
Definition: Fai.hh:129
uint8_t value
Definition: Fai.hh:70
Fai(IOStream::Device *dev=NULL)
Definition: Fai.hh:100
Definition: Event.hh:39
Definition: Fai.hh:34