fix: adjusted probe function to new revision of TLA2528 (and add status function)

This commit is contained in:
Phil-Engljaehringer
2026-01-29 18:04:25 +01:00
committed by Alexander Lerach
parent 744548e9f2
commit 193a4478ed
3 changed files with 26 additions and 6 deletions
+18 -6
View File
@@ -142,7 +142,7 @@ int TLA2528::poll_reset()
uint8_t send_data[2];
uint8_t recv_data;
send_data[0] = READ;
send_data[0] = GENERAL_CFG;
send_data[1] = GENERAL_CFG;
int ret = transfer(&send_data[0], 2, nullptr, 0);
ret |= transfer(nullptr, 0, &recv_data, 1);
@@ -199,15 +199,27 @@ void TLA2528::adc_get()
int TLA2528::probe()
{
for (int i = 0; i < 3; i++) {
// Set device in debug mode (should respond with 0xA5AX to all reads)
uint8_t send_data[3] = {SET_BIT, DATA_CFG, 0x80};
// Select channel 0
uint8_t send_data[3];
send_data[0] = WRITE;
send_data[1] = CHANNEL_SEL;
send_data[2] = 0x00; // Channel 0
int ret = transfer(&send_data[0], 3, nullptr, 0);
// Put device in in manual mode
send_data[0] = WRITE;
send_data[1] = OPMODE_CFG;
send_data[2] = 0x00;
ret |= transfer(&send_data[0], 3, nullptr, 0);
// Set device in debug mode (should respond with 0xA5AX to all reads)
send_data[0] = SET_BIT;
send_data[1] = DATA_CFG;
send_data[2] = 0x80;
ret |= transfer(&send_data[0], 3, nullptr, 0);
// Read
uint8_t recv_data[2];
send_data[0] = SET_BIT;
send_data[0] = DATA_CFG;
ret |= transfer(&send_data[0], 2, nullptr, 0);
ret |= transfer(nullptr, 0, &recv_data[0], 2);
// Turn debug mode off
+1
View File
@@ -52,6 +52,7 @@ public:
int init() override;
void RunImpl();
int probe() override;
void print_status() override;
private:
static const hrt_abstime SAMPLE_INTERVAL{10_ms};
+7
View File
@@ -43,6 +43,13 @@ void TLA2528::print_usage()
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
}
void TLA2528::print_status()
{
I2CSPIDriverBase::print_status();
perf_print_counter(_cycle_perf);
perf_print_counter(_comms_errors);
}
extern "C" int tla2528_main(int argc, char *argv[])
{
using ThisDriver = TLA2528;