Add UART ACCEL_READ command for on-demand BMA456 samples.

Expose MessageType 24 with protobuf response (success, x, y, z in raw LSB),
firmware handler with mutex-safe I2C read, goTool `accel` CLI, and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-28 19:55:02 +02:00
co-authored by Cursor
parent 16c521f71c
commit ba20544762
16 changed files with 479 additions and 99 deletions
+19
View File
@@ -101,6 +101,25 @@ func decodeClientsPayload(payload []byte) ([]*pb.ClientInfo, error) {
return info.GetClients(), nil
}
func (s *serialPort) readAccel() (*pb.AccelReadResponse, error) {
payload, err := s.exchange(byte(pb.MessageType_ACCEL_READ), "ACCEL_READ")
if err != nil {
return nil, err
}
var msg pb.UartMessage
if err := proto.Unmarshal(payload[1:], &msg); err != nil {
return nil, fmt.Errorf("decode: %w", err)
}
if msg.GetType() != pb.MessageType_ACCEL_READ {
return nil, fmt.Errorf("unexpected type %v", msg.GetType())
}
r := msg.GetAccelReadResponse()
if r == nil {
return nil, fmt.Errorf("missing accel_read_response")
}
return r, nil
}
func (s *serialPort) getVersion() (*pb.VersionResponse, error) {
payload, err := s.exchange(byte(pb.MessageType_VERSION), "VERSION")
if err != nil {