kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Added MP address printout for supported breakouts
rodzic
8cbc290de2
commit
09fc7ca4a7
|
@ -359,6 +359,10 @@ namespace pimoroni {
|
|||
return i2c;
|
||||
}
|
||||
|
||||
int IOExpander::get_address() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
int IOExpander::get_sda() const {
|
||||
return sda;
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ namespace pimoroni {
|
|||
|
||||
// For print access in micropython
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -78,6 +78,10 @@ namespace pimoroni {
|
|||
return i2c;
|
||||
}
|
||||
|
||||
int IS31FL3731::get_address() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
int IS31FL3731::get_sda() const {
|
||||
return sda;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace pimoroni {
|
|||
bool init();
|
||||
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ namespace pimoroni {
|
|||
return i2c;
|
||||
}
|
||||
|
||||
int LTP305::get_address() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
int LTP305::get_sda() const {
|
||||
return sda;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ namespace pimoroni {
|
|||
bool init();
|
||||
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@ namespace pimoroni {
|
|||
return i2c;
|
||||
}
|
||||
|
||||
int LTR559::get_address() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
int LTR559::get_sda() const {
|
||||
return sda;
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ namespace pimoroni {
|
|||
void reset();
|
||||
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -68,6 +68,10 @@ namespace pimoroni {
|
|||
return i2c;
|
||||
}
|
||||
|
||||
int Trackball::get_address() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
int Trackball::get_sda() const {
|
||||
return sda;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace pimoroni {
|
|||
bool init();
|
||||
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -32,6 +32,10 @@ namespace pimoroni {
|
|||
return ioe.get_i2c();
|
||||
}
|
||||
|
||||
int BreakoutEncoder::get_address() const {
|
||||
return ioe.get_address();
|
||||
}
|
||||
|
||||
int BreakoutEncoder::get_sda() const {
|
||||
return ioe.get_sda();
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace pimoroni {
|
|||
|
||||
// For print access in micropython
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -35,6 +35,10 @@ namespace pimoroni {
|
|||
return ioe.get_i2c();
|
||||
}
|
||||
|
||||
int BreakoutMICS6814::get_address() const {
|
||||
return ioe.get_address();
|
||||
}
|
||||
|
||||
int BreakoutMICS6814::get_sda() const {
|
||||
return ioe.get_sda();
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace pimoroni {
|
|||
|
||||
// For print access in micropython
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -42,6 +42,10 @@ namespace pimoroni {
|
|||
return ioe.get_i2c();
|
||||
}
|
||||
|
||||
int BreakoutPotentiometer::get_address() const {
|
||||
return ioe.get_address();
|
||||
}
|
||||
|
||||
int BreakoutPotentiometer::get_sda() const {
|
||||
return ioe.get_sda();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace pimoroni {
|
|||
|
||||
// For print access in micropython
|
||||
i2c_inst_t* get_i2c() const;
|
||||
int get_address() const;
|
||||
int get_sda() const;
|
||||
int get_scl() const;
|
||||
int get_int() const;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_dotmatrix/breakout_dotmatrix.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutDotMatrix_print(const mp_print_t *print, mp_obj_t self_in, mp_print
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_encoder/breakout_encoder.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutEncoder_print(const mp_print_t *print, mp_obj_t self_in, mp_print_k
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_ioexpander/breakout_ioexpander.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutIOExpander_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_ltr559/breakout_ltr559.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutLTR559_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_matrix11x7/breakout_matrix11x7.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutMatrix11x7_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_mics6814/breakout_mics6814.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutMICS6814_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_potentiometer/breakout_potentiometer.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutPotentiometer_print(const mp_print_t *print, mp_obj_t self_in, mp_p
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutRGBMatrix5x5_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "libraries/breakout_trackball/breakout_trackball.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#define MP_OBJ_TO_PTR2(o, t) ((t *)(uintptr_t)(o))
|
||||
|
||||
|
@ -28,6 +29,11 @@ void BreakoutTrackball_print(const mp_print_t *print, mp_obj_t self_in, mp_print
|
|||
mp_print_str(print, "i2c = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int((breakout->get_i2c() == i2c0) ? 0 : 1), PRINT_REPR);
|
||||
|
||||
mp_print_str(print, ", address = 0x");
|
||||
char buf[3];
|
||||
sprintf(buf, "%02X", breakout->get_address());
|
||||
mp_print_str(print, buf);
|
||||
|
||||
mp_print_str(print, ", sda = ");
|
||||
mp_obj_print_helper(print, mp_obj_new_int(breakout->get_sda()), PRINT_REPR);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue