ArduSat API
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
SAT_Geiger.h
Go to the documentation of this file.
1 
20 #ifndef NANOSATISFI_GEIGER_H_
21 #define NANOSATISFI_GEIGER_H_
22 
23 
24 // status regs on geiger counter
25 #define CPM1 0x01 // count per minute tube 1
26 #define CPM2 0x03 // count per minute tube 2
27 #define USPH1 0x02 // uS/h radiation value tube 1
28 #define USPH2 0x04 // uS/h radiatoin value tube 2
29 
30 // delay after transmission before requesting data
31 #define T_DELAY 100
32 
33 // buffer sizees
34 #define BUF_SIZE 4
35 
36 class SAT_Geiger{
37  public:
39  SAT_Geiger();
40  /*
41  * Initialize the geiger counter
42  * @param node_id The id of the user's arduino on the ArduSat. This allows
43  * the supervisor to know which arduino node to send the data back to.
44  * The id is assigned by NanoSatisfi.
45  */
46  void init(uint8_t node_id);
47 
48  /*
49  * Get's the raw count per minute.
50  * @param tube_handle The number of the geiger counter to poll.
51  * This either '1' or '2'.
52  */
53  long getCPM(byte tube_handle);
54 
55  /*
56  * Get's the value from the geiger counter in microSeiverts/h
57  * @param tube_handle The number of the geiger counter to poll.
58  * This either '1' or '2'.
59  */
60  float getUSPH(byte tube_handle);
61 
62  private:
63  uint8_t _local_address;
64  byte buffer[BUF_SIZE];
65  void send(byte* data, unsigned int len);
66  void receive(byte* data, unsigned int len);
67 };
68 
69 #endif /* NANOSATISFI_GEIGER_H_*/