@@ -38,7 +38,7 @@ apt-get install libi2c-dev
38
38
#define IOADDRESS 0x20
39
39
#define IODIRA 0x00 // IO direction A - 1= input 0 = output
40
40
#define IODIRB 0x01 // IO direction B - 1= input 0 = output
41
- #define IPOLA 0x02 // Input polarity A
41
+ #define IPOLA 0x02 // Input polarity A
42
42
#define IPOLB 0x03 // Input polarity B
43
43
#define GPINTENA 0x04 // The GPINTEN register controls the interrupt-onchange feature for each pin on port A.
44
44
#define GPINTENB 0x05 // The GPINTEN register controls the interrupt-onchange feature for each pin on port B.
@@ -80,7 +80,7 @@ using namespace ABElectronics_CPP_Libraries;
80
80
ExpanderPi::ExpanderPi (){
81
81
// SPI Bus Variables
82
82
mode = SPI_MODE_0; // SPI_MODE_0
83
- speed = 2500000 ; // SPI bus speed
83
+ speed = 200000 ; // SPI bus speed
84
84
85
85
// ADC Variables
86
86
@@ -174,11 +174,11 @@ int ExpanderPi::adc_read_raw(int channel, int mode) {
174
174
struct spi_ioc_transfer spi;
175
175
memset (&spi,0 ,sizeof (spi));
176
176
177
- spi.tx_buf = (unsigned long )adctx;
177
+ spi.tx_buf = (unsigned long )adctx;
178
178
spi.rx_buf = (unsigned long )adcrx;
179
179
spi.len = 3 ;
180
180
spi.speed_hz = 1800000 ; // 1.8MHz Clock Speed
181
- spi.delay_usecs = 0 ;
181
+ spi.delay_usecs = 0 ;
182
182
spi.bits_per_word = 8 ;
183
183
184
184
@@ -254,7 +254,7 @@ void ExpanderPi::dac_set_raw(uint16_t raw, int channel, int gain) {
254
254
tr.rx_buf = (unsigned long )NULL ;
255
255
tr.len = 2 ;
256
256
tr.speed_hz = 20000000 ; // 20MHz clock speed
257
- tr.delay_usecs = 0 ;
257
+ tr.delay_usecs = 0 ;
258
258
tr.bits_per_word = 8 ;
259
259
tr.cs_change = 0 ;
260
260
@@ -277,7 +277,7 @@ void ExpanderPi::dac_set_voltage(double voltage, int channel, int gain) {
277
277
if (gain == 2 ) {
278
278
dacvoltage = 4.096 ;
279
279
}
280
-
280
+
281
281
if ((voltage >= 0.0 ) && (voltage < dacvoltage)) {
282
282
uint16_t rawval = ((voltage / 2.048 ) * 4096 ) / gain;
283
283
dac_set_raw (rawval, channel, gain);
@@ -850,7 +850,7 @@ unsigned char *ExpanderPi::rtc_read_memory(unsigned char address, int length) {
850
850
else {
851
851
throw std::out_of_range (" address out of range" );
852
852
return NULL ;
853
- }
853
+ }
854
854
}
855
855
856
856
/* ===================RTC Methods End ===================*/
0 commit comments