Skip to content

Commit bb4c27e

Browse files
authored
Merge pull request #14 from sparkfun/feature/sparkfun-toolkit
Move the big refactor and toolkit integration into the development branch
2 parents bc47b6f + 690dea8 commit bb4c27e

File tree

12 files changed

+1330
-1811
lines changed

12 files changed

+1330
-1811
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Cross-compilation Library Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
compile-sketch:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
16+
matrix:
17+
board:
18+
# Uno
19+
# https://github.com/arduino/ArduinoCore-avr/blob/master/boards.txt
20+
- fqbn: arduino:avr:mega
21+
# platforms: |
22+
name: arduino:avr
23+
source-url: https://downloads.arduino.cc/packages/package_index.json
24+
25+
# ESP32
26+
# https://github.com/espressif/arduino-esp32/blob/master/boards.txt
27+
- fqbn: esp32:esp32:esp32
28+
# platforms: |
29+
name: esp32:esp32
30+
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
31+
32+
# ESP32-S2
33+
# https://github.com/espressif/arduino-esp32/blob/master/boards.txt
34+
- fqbn: esp32:esp32:esp32s2
35+
# platforms: |
36+
name: esp32:esp32
37+
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
38+
39+
# ESP32-C3
40+
# https://github.com/espressif/arduino-esp32/blob/master/boards.txt
41+
- fqbn: esp32:esp32:esp32c3
42+
# platforms: |
43+
name: esp32:esp32
44+
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
45+
46+
# Artemis / Apollo3
47+
# https://github.com/sparkfun/Arduino_Apollo3/blob/main/boards.txt
48+
# - fqbn: SparkFun:apollo3:sfe_artemis_atp
49+
# # platforms: |
50+
# name: SparkFun:apollo3
51+
# source-url: https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json
52+
53+
# ESP8266
54+
# https://github.com/esp8266/Arduino/blob/master/boards.txt
55+
- fqbn: esp8266:esp8266:thingdev
56+
# platforms: |
57+
name: esp8266:esp8266
58+
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
59+
60+
# SAMD21
61+
# https://github.com/arduino/ArduinoCore-samd/blob/master/boards.txt
62+
- fqbn: arduino:samd:mkr1000
63+
# platforms: |
64+
name: arduino:samd
65+
source-url: https://downloads.arduino.cc/packages/package_index.json
66+
67+
# Nano BLE 33 / nRF52840
68+
# https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt
69+
- fqbn: arduino:mbed:nano33ble
70+
# platforms: |
71+
name: arduino:mbed
72+
source-url: https://downloads.arduino.cc/packages/package_index.json
73+
74+
# RP2040
75+
# https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt
76+
- fqbn: rp2040:rp2040:sparkfun_promicrorp2040
77+
# platforms: |
78+
name: rp2040:rp2040
79+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
80+
81+
# RP2350
82+
# https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt
83+
- fqbn: rp2040:rp2040:sparkfun_promicrorp2350
84+
# platforms: |
85+
name: rp2040:rp2040
86+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
87+
88+
# STM32
89+
# https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt
90+
- fqbn: STMicroelectronics:stm32:GenF4
91+
# platforms: |
92+
name: STMicroelectronics:stm32
93+
source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
94+
95+
# not using the arduino action to compile everything - it fails to load libraries at a given ref/branch (using toolkit at a specific commit)
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v4
99+
100+
- name: Branch name
101+
run: echo running on branch ${GITHUB_REF##*/}
102+
103+
# Setup Arduino command line - install esp32 and all the libs flux needs
104+
- name: Arduino - Install and setup the Arduino CLI
105+
uses: arduino/setup-arduino-cli@v2
106+
107+
- name: Arduino - Start config file
108+
run: arduino-cli config init --additional-urls ${{ matrix.board.source-url}}
109+
110+
- name: Arduino - Update index
111+
run: arduino-cli core update-index
112+
113+
- name: Arduino - Install platform
114+
run: arduino-cli core install ${{ matrix.board.name}}
115+
116+
- name: Arduino - Install library dependencies
117+
run: arduino-cli lib install "SparkFun Toolkit"
118+
119+
- name: Compile Sketch
120+
run: arduino-cli compile --fqbn ${{ matrix.board.fqbn }} examples/Example1_BasicReadings --library .

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 SparkFun Electronics
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
SparkFun TMAG5273 Arduino Library
2-
========================================
31

2+
![SparkFun Linear 3D Hall-effect Snsor (Qwiic))](docs/images/gh-banner-arduino-tmag5273.png "SparkFun Linear 3D Hall-effect Sensor")
43

5-
This is the SparkFun library for the Texas Instruments TMAG5273 low-power linear 3D Hall-effect sensor with I<sup>2</sup>C interface as used on the [SparkFun IoT Motor Driver (ESP32 WROOM, TMC6300)](https://www.sparkfun.com/products/22132).
4+
# SparkFun TMAG5273 Arduino Library
5+
6+
This is the SparkFun library for the Texas Instruments TMAG5273 low-power linear 3D Hall-effect sensor with I<sup>2</sup>C interface.
7+
8+
![GitHub License](https://img.shields.io/github/license/sparkfun/SparkFun_TMAG5273_Arduino_Library)
9+
![Release](https://img.shields.io/github/v/release/sparkfun/SparkFun_TMAG5273_Arduino_Library)
10+
![Release Date](https://img.shields.io/github/release-date/sparkfun/SparkFun_TMAG5273_Arduino_Library)
11+
![Documentation - build](https://img.shields.io/github/actions/workflow/status/sparkfun/SparkFun_TMAG5273_Arduino_Library/build-deploy-ghpages.yml?label=doc%20build)
12+
[![Compile Test](https://github.com/sparkfun/SparkFun_FPC2534_Arduino_Library/actions/workflows/test-compile-sketch.yml/badge.svg)](https://github.com/sparkfun/SparkFun_TMAG5273_Arduino_Library/actions/workflows/test-compile-sketch.yml)
13+
![GitHub issues](https://img.shields.io/github/issues/sparkfun/SparkFun_TMAG5273_Arduino_Library)
614

715
Repository Contents
816
-------------------
@@ -14,7 +22,6 @@ Repository Contents
1422
* **library.properties** - General library properties for the Arduino package manager.
1523
* **[CONTRIBUTING.md](./CONTRIBUTING.md)** - guidance on how to contribute to this library.
1624

17-
1825
Documentation
1926
--------------
2027

@@ -25,14 +32,14 @@ Documentation
2532
License Information
2633
-------------------
2734

28-
This product is _**open source**_!
35+
This product is _**open source**_!
2936

30-
Please review the LICENSE.md file for license information.
37+
Please review the LICENSE.md file for license information.
3138

3239
If you have any questions or concerns on licensing, please contact technical support on our [SparkFun forums](https://forum.sparkfun.com/viewforum.php?f=152).
3340

3441
Distributed as-is; no warranty is given.
3542

36-
- Your friends at SparkFun.
43+
* Your friends at SparkFun.
3744

3845
_<COLLABORATION CREDIT>_
250 KB
Loading

docs/images/sfe_flame.png

3.74 KB
Loading
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
#include <Wire.h> // Used to establish serial communication on the I2C bus
21
#include "SparkFun_TMAG5273_Arduino_Library.h" // Used to send and recieve specific information from our sensor
2+
#include <Wire.h> // Used to establish serial communication on the I2C bus
33

44
TMAG5273 sensor; // Initialize hall-effect sensor
55

66
// I2C default address
77
uint8_t i2cAddress = TMAG5273_I2C_ADDRESS_INITIAL;
88

9-
void setup()
9+
void setup()
1010
{
11-
Wire.begin();
12-
// Start serial communication at 115200 baud
13-
Serial.begin(115200);
14-
15-
// Begin example of the magnetic sensor code (and add whitespace for easy reading)
16-
Serial.println("TMAG5273 Example 1: Basic Readings");
17-
Serial.println("");
18-
19-
// If begin is successful (0), then start example
20-
if(sensor.begin(i2cAddress, Wire) == 1)
21-
{
22-
Serial.println("Begin");
23-
}
24-
else // Otherwise, infinite loop
25-
{
26-
Serial.println("Device failed to setup - Freezing code.");
27-
while(1); // Runs forever
28-
}
29-
11+
Wire.begin();
12+
// Start serial communication at 115200 baud
13+
Serial.begin(115200);
14+
15+
// Begin example of the magnetic sensor code (and add whitespace for easy reading)
16+
Serial.println("TMAG5273 Example 1: Basic Readings");
17+
Serial.println("");
18+
19+
// If begin is successful (0), then start example
20+
if (sensor.begin(i2cAddress, Wire) == 1)
21+
{
22+
Serial.println("Begin");
23+
}
24+
else // Otherwise, infinite loop
25+
{
26+
Serial.println("Device failed to setup - Freezing code.");
27+
while (1)
28+
; // Runs forever
29+
}
3030
}
3131

32-
33-
void loop()
32+
void loop()
3433
{
35-
// Checks if mag channels are on - turns on in setup
36-
if(sensor.getMagneticChannel() != 0)
37-
{
38-
sensor.setTemperatureEn(true);
39-
40-
float magX = sensor.getXData();
41-
float magY = sensor.getYData();
42-
float magZ = sensor.getZData();
43-
float temp = sensor.getTemp();
44-
45-
Serial.print("(");
46-
Serial.print(magX);
47-
Serial.print(", ");
48-
Serial.print(magY);
49-
Serial.print(", ");
50-
Serial.print(magZ);
51-
Serial.println(") mT");
52-
Serial.print(temp);
53-
Serial.println(" C");
54-
}
55-
else
56-
{
57-
// If there is an issue, stop the magnetic readings and restart sensor/example
58-
Serial.println("Mag Channels disabled, stopping..");
59-
while(1);
60-
}
61-
62-
delay(100);
34+
// Checks if mag channels are on - turns on in setup
35+
if (sensor.getMagneticChannel() != 0)
36+
{
37+
sensor.setTemperatureEn(true);
38+
39+
float magX = sensor.getXData();
40+
float magY = sensor.getYData();
41+
float magZ = sensor.getZData();
42+
float temp = sensor.getTemp();
43+
44+
Serial.print("Data - Magnetic: [ X: ");
45+
Serial.print(magX);
46+
Serial.print(", Y: ");
47+
Serial.print(magY);
48+
Serial.print(", Z: ");
49+
Serial.print(magZ);
50+
Serial.print(" ] mT, Temp: ");
51+
Serial.print(temp);
52+
Serial.println(" C");
53+
}
54+
else
55+
{
56+
// If there is an issue, stop the magnetic readings and restart sensor/example
57+
Serial.println("Mag Channels disabled, stopping..");
58+
while (1)
59+
;
60+
}
61+
62+
delay(300);
6363
}

library.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name=SparkFun TMAG5273 Arduino Library
2-
version=1.0.3
2+
version=1.1.0
33
author=SparkFun Electronics <techsupport@sparkfun.com>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=A library to drive the Texas Instruments hall-effect sensor TMAG5273.
66
paragraph=The TMAG5273 is a low-power linear 3D Hall-effect sensor designed for a wide range of industrial and personal electronics applications
77
category=Sensors
88
url=https://github.com/sparkfun/SparkFun_TMAG5273_Arduino_Library
9-
architectures=*
9+
architectures=*
10+
depends=SparkFun Toolkit (>=1.2.0)

0 commit comments

Comments
 (0)