Skip to content

Commit 19f3963

Browse files
author
dave
committed
#9 a few small fixes to pages
1 parent fde06b5 commit 19f3963

File tree

7 files changed

+70
-108
lines changed

7 files changed

+70
-108
lines changed

content/arduino-libraries/io-abstraction.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ Need help with a commercial design, or want a customised version for your hardwa
6262

6363
* [Seamless EEPROM implementations, AVR, Arduino, I2C]({{< relref "eeprom-impl-seamless-8-and-32-bit.md">}})
6464

65-
## Logging, text utilities and unit testing
65+
## Logging, text utilities and unit testing helper classes
6666

6767
* [Arduino logging with IoAbstraction]({{< relref "arduino-logging-with-io-logging.md">}})
6868
* [Text Utilities and helpers]({{< relref "text-utilities-and-helpers.md" >}})
6969
* [Troubleshooting, IoAbstraction mock implementations]({{< relref "ioabstraction-troubleshooting-unit-testing.md">}})
70-
* [Simple Test - simple no frills unit test framework for Arduino and mbed]({{< relref "simple-test-unit-test-arduino-mbed.md">}})

content/arduino-libraries/io-abstraction/arduino-logging-with-io-logging.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ toc_needed = true
1414
weight = 5
1515
+++
1616

17-
Logging is part of the IoAbstraction offering, it has a moderately complete logging framework that is still lightweight enough to work on small boards. It can easily be turned off completely for very small boards too. Both IoAbstraction and tcMenu use this logging to provide information about internal state and operations.
17+
Logging is part of the TcMenu offering provided by library `TcMenuLog`, it has a moderately complete logging framework that is still lightweight enough to work on small boards. It can easily be turned off completely for very small boards too. TaskManagerIO, IoAbstraction and tcMenu use this logging to provide information about internal state and operations.
1818

19-
The logging is fully integrated into both IoAbstraction and TcMenu, and this change is backward compatible at a code level.
19+
You can also use this logging framework in your own project code, regardless if you're using any other of our libraries.
2020

2121
{{< blockClear "left" >}}
2222

@@ -26,11 +26,15 @@ To use the logging in your project you first include the logging header file:
2626

2727
#include <IoLogging.h>
2828

29-
Secondly you define the following build switch to turn on logging: `IO_LOGGING_DEBUG`. For example on platformIO that would be:
29+
Should an older version of Arduino need the library header match the library name, you can also include:
30+
31+
#include <TcMenuLog.h>
32+
33+
Next, you define the following build switch to turn on logging: `IO_LOGGING_DEBUG`. For example on platformIO that would be:
3034

3135
build_flags = -DIO_LOGGING_DEBUG=1
3236

33-
If you are using the original Arduino IDE, it does not support build flags, you can in this case open IoLogging.h in the IoAbstraction library and uncomment the entry to define it in there. This would need to be done after each upgrade and is not recommended.
37+
If you are using the original Arduino IDE, it does not support build flags, you can in this case open `IoLogging.h` in the TcMenuLog library and uncomment the entry to define it in there. This would need to be done after each upgrade and is not recommended.
3438

3539
You can set the logging levels at compile time using `IO_LOGGING_DEFAULT_LEVEL` by ORing together entries from `SerLoggingLevel`. An is shown below for only warning and error logs:
3640

@@ -107,6 +111,14 @@ On mbed proper (IE using mbed without Arduino), **we must define the print inter
107111
BufferedSerial serPort(USBTX, USBRX);
108112
MBedLogger LoggingPort(serPort);
109113

114+
Instead of the above, you can use the following macro that always work, on any platform.
115+
116+
IOLOG_MBED_PORT_IF_NEEDED(txPin, rxPin)
117+
118+
You should always start the serial port. For example on Arduino you may need to start the serial port youre using with something like `Serial.begin(115200);`, and there is also a macro for that:
119+
120+
IOLOG_START_SERIAL
121+
110122
In summary, the logging framework is a compromise between functionality and size, biased slightly toward size.
111123

112124
## Example of the logging format on device

content/arduino-libraries/io-abstraction/i2c-wire-calls-over-arduino-mbed.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "IOA I2C/Wire abstraction that works Across Arduino and mbed"
2+
title = "SPI and I2C/Wire abstraction that works on Arduino, mbed, PicoSDK"
33
description = ""
44
tags = [ "arduino", "digital-io", "library" ]
55
type = "blog"
@@ -13,9 +13,13 @@ titleimg = "/products/arduino-libraries/images/electronics/arduino/power/io-abst
1313
weight = 2
1414
+++
1515

16-
IoAbstraction 2.0 onwards has core I2C/Wire functionality provided by several functions, these abstract the use of I2C over Arduino and mbed, and over time the implementation of these will be improved, such that asynchronous behaviour will be possible on certain boards.
16+
IoAbstraction has core I2C/Wire and SPI functionality provided by several functions, these abstract the use of I2C and SPI over Arduino, mbed, PicoSDK and other supported platforms. Over time the implementation of these will be improved, such that asynchronous behaviour will be possible on certain boards.
1717

18-
Prior to 2.0, we had conditional I2C code scattered around the project, but now nearly all such functionality is separated out by platform, and sometimes even by board, we've made this available through the API, so you can use it too.
18+
Prior to 2.0, we had conditional I2C code scattered around the project, but now nearly all such functionality is separated out by platform, and sometimes even by board simplifying access.
19+
20+
{{< blockClear "left" >}}
21+
22+
## Wire/I2C abstraction
1923

2024
We wrap up the wire object with `WireType`; which on Arduino it is a TwoWire pointer and on mbed it is an I2C pointer. For example the default wire type on Arduino would be `&Wire`. Be aware that this is not a complete replacement for Wire/I2C, it is a simple set of calls for reading and write from I2C where the device is master. It works on a very wide range of boards without needing code changes.
2125

@@ -41,7 +45,7 @@ On all boards there is a lock around the i2c bus, this ensures that only one thr
4145

4246
extern SimpleSpinLock i2cLock;
4347

44-
## Reading bytes from the bus
48+
### Reading bytes from the bus
4549

4650
To read bytes from the bus:
4751

@@ -55,7 +59,7 @@ Where:
5559
* len is the number of bytes to read
5660
* returns true if the read is fully successful, otherwise false.
5761

58-
## Writing bytes to the bus
62+
### Writing bytes to the bus
5963

6064
bool ioaWireWriteWithRetry(WireType pI2c, int address, const uint8_t* buffer,
6165
size_t len, int retriesAllowed = 0, bool sendStop = true);
@@ -69,6 +73,39 @@ Where:
6973
* retriesAllowed is the number of times to attempt the operation, 0 = only once.
7074
* sendStop allows you to keep the bus open ready for a repeated start, use with care.
7175

76+
## The SPI abstraction
77+
78+
You can use SPI regardless of platform using the SPI abstraction. This is used in a few places within IoAbstraction so is already quite stable.
79+
80+
### Construction of SPI abstraction
81+
82+
In order to create an instance, you first need to create an `SPIWithSettings` object:
83+
84+
SPIWithSettings spiObj(&SPIBus, csPin);
85+
86+
Then in your code somewhere:
87+
88+
spiObj.init();
89+
90+
Where:
91+
92+
* SPIBus is the SPI bus on your hardware, for example on Arduino this may be `&SPI` for example.
93+
* csPin is the chip select pin, doing any transfers automatically selects the pin first.
94+
95+
The class is quite small and has copy constructors, so you can safely copy it over by value, and this is often how its used within IoAbstraction.
96+
97+
### Transferring data over SPI
98+
99+
Normally on SPI you read and write data at the same time, therefore to `transfer` data call the following method that will first select the chip, do the transfer, and then deselect the chip:
100+
101+
uint8_t readWriteData[dataSize];
102+
bool ok = spiObj.transferSPI(readWriteData, dataSize);
103+
104+
Where
105+
106+
* readWriteData is a uint8_t array of at least dataSize, the read data is put into the array after calling.
107+
* dataSize is the number of bytes to transfer
108+
72109
{{< refdocs title="You can read more about this in the reference documentation" src="/ioabstraction/html/index.html" >}}
73110

74111
[Go back to the IoAbstraction page]({{< relref "io-abstraction.md" >}})

content/arduino-libraries/io-abstraction/ioabstraction-troubleshooting-unit-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Within the MockIoAbstraction.h header there is an implementation of BasicIoAbstr
2424

2525
## Mock objects for use with Unit testing
2626

27-
This library itself is quite well tested using our simple test facilities, and further it makes unit testing your code easier. There is a MockIoAbstraction that provides very easy support for mocking out an IoAbstraction. You just provide how many `sync()` calls to store in the internal buffer:
27+
This library itself is quite well tested, and further it makes unit testing your code easier. There is a MockIoAbstraction that provides very easy support for mocking out an IoAbstraction. You just provide how many `sync()` calls to store in the internal buffer:
2828

2929
MockedIoAbstraction mockIo(numberOfCycles = 6);
3030

content/arduino-libraries/io-abstraction/simple-test-unit-test-arduino-mbed.md

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

content/arduino-libraries/tc-menu/themes/rendering-with-themes-icons-grids.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Here is an example series of settings from one of our themes, let's discuss what
6969
.withNativeFont(itemFont.fontData, itemFont.fontMag)
7070
.withSpacing(1);
7171

72-
Firstly the dimensions are configured automatically by calling `dimensionsFromRenderer` this sets the display sizes by querying the display plugin. Then the selected colors are chosen using the RGB macro for each color. Read more about `color_t` and the `RGB` macro below.
72+
Firstly the dimensions are configured automatically by calling `dimensionsFromRenderer` this sets the display sizes by querying the display plugin. Then the selected colors are chosen using the `RGB` macro for each color. As you'd probably expect by convention the `RGB` macro takes red, green and blue parameters between `0` and `255`.
7373

7474
After that the item and title padding are configured, you can see we demonstrate both ways to construct a padding object (either all sides same, or separate value for each). The padding is within the rectangle of a menu item, and "pads out" the rectangle's size. You configure the title and item spacing separately (as they are usually different).
7575

@@ -123,11 +123,13 @@ You can also change the font, color, padding, size and default justification at
123123
* Default settings when no others match
124124
* Last chance item that's compiled in just in-case there is a severe mis-configuration to avoid returning `nullptr`.
125125

126-
To change the default settings use `setDrawingPropertiesDefault` on the factory, providing the component type and the drawing settings. This will take effect when there are no other overrides
126+
To change the default settings use `themeBuilder.defaultActionProperties()`, `themeBuilder.defaultItemProperties()` or `themeBuilder.defaultTitleProperties()` on a theme builder. This will take effect when there are no other overrides
127127

128-
To change the properties for all items that belong to a submenu use `setDrawingPropertiesForItem` on the factory, providing the component type and drawing settings. This will take effect when there are no item level overrides.
128+
To change the settings for all items that belong to a submenu use `themeBuilder.submenuPropertiesActionOverride(subMenuItem)`, `themeBuilder.submenuPropertiesActionOverride(subMenuItem)` on theme builder, providing the menu to apply these settings to. This will take effect when there are no item level overrides.
129129

130-
To change the properties for a single item use `setDrawingPropertiesAllInSub` on the factory, providing the component type and drawing settings. This item will always have priority over anything else.
130+
To change the properties for a single item use `themeBuilder.menuItemOverride(menuItem)` on theme builder, providing the menu item. This item will always have priority over anything else. Important note that if you apply changes at the item level, it is normally best to manually set the `row(..)` to keep control of the ordering.
131+
132+
These all use chained builder syntax as described elsewhere in this guide. You adjust the settings as desired, and finally you must call the `apply()` method. See below for examples.
131133

132134
### Creating two icon menu items on the same row
133135

@@ -147,14 +149,16 @@ Here we present an example theme builder layout to show how to override two menu
147149

148150
In the above, the row and column upon which the item should appear in configured with `onRowCol(row, col, columnsOnRow)` and then the renderer is told to draw as an icon. Lastly, and very importantly we call `apply()`.
149151

150-
### Overriding a single item's palette or border
152+
### Overriding a single item's palette, border or font
151153

152154
Let's say we want an item to have a different palette, border, and justify differently:
153155

154156
themeBuilder.menuItemOverride(menuSpecial)
155157
.withJustification(GridPosition::JUSTIFY_LEFT_NO_VALUE)
156158
.withBorder(MenuBorder(1))
157159
.withPalette(specialPalette)
160+
.withAdaFont(myAdafruitFontPtr)
161+
.onRow(1) // on the first row
158162
.apply();
159163

160164
### Advanced - Overriding submenu drawing

themes/belter/layouts/partials/widgets/sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h3 class="panel-title">Share on social sites</h3>
1515
{{ end }}
1616

1717
{{ if .File }}
18-
<a class="github-link" title='{{T "Edit-this-page"}}' href="{{ .Site.Params.gitEditURL }}{{ replace .File.Dir "\\" "/" }}{{ .File.LogicalName }}" target="blank">
18+
<a class="github-link" title='{{T "Edit-this-page"}}' href="{{ .Site.Params.gitEditURL }}/{{ replace .File.Dir "\\" "/" }}{{ .File.LogicalName }}" target="blank">
1919
<span id="top-github-link-text">Correct or Improve this page</span>
2020
</a>
2121
{{ else }}

0 commit comments

Comments
 (0)