Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ADS1232.h
00001 /* 00002 ADS1232.h - Library for reading from a ADS1232 24-bit ADC. 00003 Created by Jeffrey M. Kubascik, June 28, 2016. 00004 Released into the public domain. 00005 */ 00006 #ifndef ADS1232_h 00007 #define ADS1232_h 00008 00009 #include <mbed.h> 00010 00011 00012 typedef void (*cbptr_t)(void); 00013 00014 typedef enum 00015 { 00016 IDLE, // No operation currently ongoing 00017 CLEARING, // In the process of clearing the display 00018 WRITING, // In the process of sending a display update 00019 WAIT_CLEAR, // Going to clear after CS pin timeout 00020 WAIT_WRITE, // Going to write after CS pin timeout 00021 TRANSFERS_DONE, // Last transfer in progress 00022 DONE // Done with transmission, waiting for CS pin to become high 00023 } ADS1232_state_t; 00024 00025 typedef enum 00026 { 00027 GAIN1 = 1, 00028 GAIN2, 00029 GAIN64, 00030 GAIN128 00031 } Gain; 00032 00033 typedef enum 00034 { 00035 SLOW = 0, 00036 FAST 00037 } Speed; 00038 00039 typedef enum 00040 { 00041 AIN1 = 0, 00042 AIN2, 00043 TEMP 00044 } Channel; 00045 00046 //namespace twtg { 00047 00048 class ADS1232 00049 { 00050 public: 00051 00052 //ADS1232(PinName pin_sck, PinName pin_din_rdy, PinName pin_pdwn, PinName pin_gain0, PinName pin_gain1, PinName pin_speed, PinName pin_a0, PinName pin_temp); 00053 ADS1232(PinName pin_sck, PinName pin_din_rdy, PinName pin_pdwn); 00054 00055 void attach(void); 00056 void detach(void); 00057 00058 // void setGain(Gain gain); 00059 // void setSpeed(Speed speed); 00060 // void setChannel(Channel channel); 00061 00062 int32_t read(void); 00063 00064 private: 00065 void waitDataReady(void); 00066 00067 PinName _pin_sck; 00068 PinName _pin_din_rdy; 00069 PinName _pin_pdwn; 00070 // PinName _pin_gain0; 00071 // PinName _pin_gain1; 00072 // PinName _pin_speed; 00073 // PinName _pin_a0; 00074 // PinName _pin_temp; 00075 00076 Channel currentChannel; 00077 Gain currentGain; 00078 Speed currentSpeed; 00079 00080 bool configChanged; 00081 }; 00082 00083 //} // namespace twtg 00084 00085 #endif /* #ifndef ADS1232_h */
Generated on Tue Jul 12 2022 20:25:42 by
