Skip to content

Commit 1e6e440

Browse files
0.3.1
- Typos fixed in `aoosp_send.cpp`. - In `aoosp_send.h` cleaned up `AOOSP_ADDR_xxx`. - Typos fixed in `readme.md`, `aoosp.cpp`, `aoosp_crc.cpp`, `aoosp_exec.h`. - Typos fixed in `aoosp_i2c.ino`, `aoosp_sync.ino`, `aoosp_topo.ino`. - Typos fixed in `aoosp_exec.cpp`.
1 parent 010af24 commit 1e6e440

File tree

13 files changed

+318
-101
lines changed

13 files changed

+318
-101
lines changed

examples/aoosp_i2c/aoosp_i2c.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/*
2626
DESCRIPTION
2727
This demo first performs an I2C scan using the I2C bridge in a SAID.
28-
Then it issues I2C read and write transactions to an EEPROM memory.
28+
Then it issues I2C read and write transactions to an EEPROM memory,
2929
assumed to have I2C device address 0x50 connected to the first SAID.
3030
Finally it polls the INT line and shows its status on SAID1.RGB0.
3131

examples/aoosp_otp/aoosp_otp.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
/*
2626
DESCRIPTION
27-
This demo reads and writes from/to the OTP of a SAID.
27+
This demo reads and writes from/to the OTP (one time programmable memory)
28+
of a SAID.
2829
Note that this accesses the OTP mirror in RAM, not the actual OTP ("ROM").
2930
The mirror is persistent over RESET, but not over POR (power on reset).
3031
The latter requires the CUST, BURN, IDLE steps, which are beyond the scope

examples/aoosp_sync/aoosp_sync.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PWM settings.
3333
3434
Instead of sending a SYNC telegram, there is also the option to use the
3535
SYNC pin of the SAID (pin B1). To demonstrate that, define USE_HARDWARE_SYNC
36-
and on the OSP32 board have jummper J8 connect SAID2.B2 to the ESP32 GPIO9
36+
and on the OSP32 board have jumper J8 connect SAID2.B2 to the ESP32 GPIO9
3737
(instead of LED L2.1_B). Only SAID2 is wired for hardware sync on OSP32.
3838
3939
HARDWARE

examples/aoosp_topo/aoosp_topo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/*
2626
DESCRIPTION
2727
This demo scans all nodes and prints out the chain configuration:
28-
comms for both SIOs, dir, state, number of RGBs and I2C.
28+
comms for both SIOs, direction, power state, number of RGBs and I2Cs.
2929
3030
HARDWARE
3131
The demo should run on the OSP32 board. Either have a terminator in the

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=OSP Telegrams aoosp
2-
version=0.3.0
2+
version=0.3.1
33
author=ams-OSRAM
44
maintainer=ams-OSRAM
55
sentence=A library that constructs OSP telegrams to send, and destructs received OSP telegrams.

readme.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ Library _aoosp_ is at the heart of the dependency graph.
1414

1515
It contains functions to construct telegrams (byte arrays) to be send to OSP nodes.
1616
It also contains functions to destruct response telegrams received back from OSP nodes.
17-
Both functions are hidden behind the API; the API allows sending and receiving telegrams.
17+
Both functions are hidden behind the API; the API allows sending and receiving telegrams,
18+
which involves constructing, transmit-out, transmit-in and destructing.
1819

19-
For telegram transmit this library relies on a communications layer, typically _aospi_.
20-
That library expects a board like **OSP32**.
20+
For telegram transmission this library relies on a communications layer, typically _aospi_.
21+
That library expects a board like the **OSP32** board in the evaluation kit.
2122

2223
![aoosp in context](extras/aolibs-aoosp.drawio.png)
2324

@@ -40,7 +41,7 @@ File > Examples > OSP Telegrams aoosp > ...
4041

4142
- **aoosp_topo**
4243
This demo scans all nodes and prints out the chain configuration:
43-
comms for both SIOs, dir, state, number of RGBs and I2C.
44+
comms for both SIOs, direction, power state, number of RGBs and I2Cs.
4445

4546
- **aoosp_error**
4647
This demo shows how error handling works in SAID. The STAT register has
@@ -56,22 +57,23 @@ File > Examples > OSP Telegrams aoosp > ...
5657

5758
- **aoosp_i2c**
5859
This demo first performs an I2C scan using the I2C bridge in a SAID.
59-
Then it issues I2C read and write transactions to an EEPROM memory.
60+
Then it issues I2C read and write transactions to an EEPROM memory,
6061
assumed to have I2C device address 0x50 connected to the first SAID.
6162
Finally it polls the INT line and shows its status on SAID1.RGB0.
6263

6364
- **aoosp_otp**
64-
This demo reads and writes from/to the OTP of a SAID.
65+
This demo reads and writes from/to the OTP (one time programmable
66+
memory) of a SAID.
6567

6668
- **aoosp-sync**
6769
This demo shows how to use the SYNC feature; a feature that switches on all
6870
LEDs at the same time. We first enable (channels) of nodes for SYNC
6971
(AOOSP_CURCHN_FLAGS_SYNCEN). Next, set those channels to some PWM value.
7072
Finally we issue a SYNC by broadcasting the SYNC telegram. This makes
7173
all (channels) of all nodes that are configured for SYNC to activate their
72-
PWM settings.
74+
PWM settings. It is also possible to pulse a pin as hardware SYNC.
7375

74-
- **aoosp_time**
76+
- **aoosp_time**
7577
This demo sends a series of telegrams. The series originally comes from
7678
`aomw_topo_build`. We measure how long it takes to run that series.
7779
Once we use the high level aoosp API, and once we use low level aospi API.
@@ -89,10 +91,10 @@ This library contains 4 modules, see figure below (arrows indicate #include).
8991

9092
- **aoosp_prt** (`aoosp_prt.cpp` and `aoosp_prt.h`) is a slightly bigger module that implements
9193
several functions to pretty print telegrams. It is normally not used in production code.
92-
It is extensively used by the logging feature of module aoosp_send.
94+
It is extensively used by the logging feature of module `aoosp_send`.
9395

9496
- **aoosp_send** (`aoosp_send.cpp` and `aoosp_send.h`) is the _core_ module of the library.
95-
It contains functions the send commands and receive the responses if there is any.
97+
It contains functions that send commands and receive the responses if there is any.
9698
The module supports both RGBi's and SAIDs. Not all telegrams are implemented yet.
9799
The module is stateless, with one exception: it records if logging is enabled or disabled.
98100

@@ -117,7 +119,7 @@ The headers contain little documentation; for that see the module source files.
117119

118120
### aoosp
119121

120-
- `aoosp_init()` not really needed, but added for forward compatibility.
122+
- `aoosp_init()` not really needed (aoosp has no state to init), but added for forward compatibility.
121123
- `AOOSP_VERSION` identifies the version of the library.
122124

123125

@@ -131,16 +133,18 @@ The headers contain little documentation; for that see the module source files.
131133
Contains several functions to print telegram fields more user friendly. Examples are:
132134

133135
- `aoosp_prt_temp_said()` to convert a SAID raw temperature to Celsius.
134-
- `aoosp_prt_stat_state()` to convert a node state to a string.
136+
- `aoosp_prt_stat_state()` to convert a node stat to a string describing the power state.
135137
- `aoosp_prt_bytes()` to convert a byte array (like a telegram) to a string.
138+
- ...
136139

137140
These functions are publicly accessible, but are intended for logging in this library.
138141

139142
Warning: pretty print functions that return a `char *` all use the same global
140143
character buffer for returning the string. This means that only _one_ such function
141-
can be used at a time. For example this will not work:
144+
can be used at a time. For example this will _not_ work:
145+
142146
```
143-
printf("%s-%s", aoosp_prt_stat_rgbi(x), aoosp_prt_stat_said(x) )
147+
printf("%s-%s", aoosp_prt_stat_rgbi(x), aoosp_prt_stat_said(x) ); // ERROR: double prt
144148
```
145149

146150

@@ -152,11 +156,12 @@ Examples are
152156
- `aoosp_send_reset()` resets all nodes in the chain (all "off"; they also lose their address).
153157
- `aoosp_send_initloop()` assigns an address to each node; also configures all nodes for Loop.
154158
- `aoosp_send_clrerror()` clears the error flags of the addressed node.
155-
- `aoosp_send_goactive()` switches the state of the addressed node to active.
156-
- `aoosp_send_readpwmchn()` asks the addressed node to respond with its PWM settings of one of its channel.
159+
- `aoosp_send_goactive()` switches the power state of the addressed node to active ("on").
160+
- `aoosp_send_setpwmchn()` configures the PWM settings of one channel of the addressed node ("lit").
161+
- ...
157162

158163
This module supports logging.
159-
Via `aoosp_loglevel_set()` and `aoosp_loglevel_get()` the log level can be manipulated:
164+
Via `aoosp_loglevel_set()` and `aoosp_loglevel_get()` the log level can be managed:
160165

161166
- `aoosp_loglevel_none` nothing is logged (default).
162167
- `aoosp_loglevel_args` logging of sent and received telegram arguments.
@@ -169,8 +174,8 @@ Some operations on OSP nodes require multiple telegrams.
169174
Some frequent ones have been abstracted in this module.
170175

171176
- `aoosp_exec_resetinit()` sends RESET and INIT telegrams, auto detecting BiDir or Loop.
172-
- `aoosp_exec_otpdump()` reads the entire OTP and prints details requested in flags.
173-
- `aoosp_exec_setotp()` updates one bye in OTP.
177+
- `aoosp_exec_otpdump()` reads the entire OTP (mirror) and prints details requested in flags.
178+
- `aoosp_exec_setotp()` updates one byte in the OTP (mirror).
174179
- `aoosp_exec_i2cenable_get()` reads the I2C_BRIDGE_EN bit in OTP (mirror).
175180
- `aoosp_exec_i2cenable_set()` writes the I2C_BRIDGE_EN bit in OTP (mirror).
176181
- `aoosp_exec_i2cpower()` checks if the SAID has an I2C bridge, if so, powers the I2C bus.
@@ -182,9 +187,16 @@ Some frequent ones have been abstracted in this module.
182187

183188
## Version history _aoosp_
184189

190+
- **2024 aug 9, 0.3.1**
191+
- Typos fixed in `aoosp_send.cpp`.
192+
- In `aoosp_send.h` cleaned up `AOOSP_ADDR_xxx`.
193+
- Typos fixed in `readme.md`, `aoosp.cpp`, `aoosp_crc.cpp`, `aoosp_exec.h`.
194+
- Typos fixed in `aoosp_i2c.ino`, `aoosp_sync.ino`, `aoosp_topo.ino`.
195+
- Typos fixed in `aoosp_exec.cpp`.
196+
185197
- **2024 August 5, 0.3.0**
186-
- In `aoosp_send.h` all non-implemented TID tagged as not-yet-implemented or reserved.
187-
- Corrected link to GitHub from aotop to OSP_aotop.
198+
- In `aoosp_send.h` all non-implemented TIDs tagged as not-yet-implemented or reserved.
199+
- Corrected link to GitHub from aotop to `OSP_aotop`.
188200
- Remove "oalib" from `sentence=` in `library.properties`.
189201
- Added `#include "../../said-password.h"`.
190202
- Added `aoosp_exec_syncpinenable_get()` and `aoosp_exec_syncpinenable_set()` and hw sync in `aoosp_sync.ino`.

src/aoosp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626

2727
/*!
2828
@brief Initializes the aoosp library.
29-
@note At this moment, the aoosp lib has no state to (initialize).
30-
Present for future extensions that do need initialization
29+
@note At this moment, the aoosp lib has no state (to initialize).
30+
Present for future extensions that do need initialization.
3131
*/
3232
void aoosp_init() {
33-
// No init is needed, but placed for future extensions.
33+
// No init is needed, but already present for future extensions.
3434
Serial.printf("osp: init\n");
3535
}

src/aoosp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
// Identifies lib version
26-
#define AOOSP_VERSION "0.3.0"
26+
#define AOOSP_VERSION "0.3.1"
2727

2828

2929
// Include the (headers of the) modules of this app

src/aoosp_crc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
/*!
27-
@brief Computes the OSP CRC for a sequence of bytes
27+
@brief Computes the OSP CRC for a sequence of bytes.
2828
@param buf
2929
A pointer to a sequence of bytes.
3030
@param size

src/aoosp_exec.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ aoresult_t aoosp_exec_resetinit(uint16_t *last, int *loop) {
6666

6767
// Try INITLOOP (recall to set mux)
6868
aospi_dirmux_set_loop();
69-
result= aoosp_send_initloop(1,&last2,&temp,&stat);
69+
result= aoosp_send_initloop(0x001,&last2,&temp,&stat);
7070
if( result==aoresult_ok ) {
7171
*last=last2;
7272
*loop=1;
@@ -81,7 +81,7 @@ aoresult_t aoosp_exec_resetinit(uint16_t *last, int *loop) {
8181

8282
// Try INITBIDIR (recall to set mux)
8383
aospi_dirmux_set_bidir();
84-
result= aoosp_send_initbidir(1,&last2,&temp,&stat);
84+
result= aoosp_send_initbidir(0x001,&last2,&temp,&stat);
8585
if( result==aoresult_ok ) {
8686
*last=last2;
8787
*loop=0;
@@ -165,11 +165,11 @@ aoresult_t aoosp_exec_otpdump(uint16_t addr, int flags) {
165165

166166

167167
/*!
168-
@brief Reads the OTP (mirror) updates location otpaddr
168+
@brief Reads the OTP (mirror) and updates location otpaddr
169169
by and-ing it with `andmask` then or-ing it with `ormask`,
170170
then writing the value back to the OTP (mirror).
171171
@param addr
172-
The address to send the telegram to
172+
The address to send the telegram to (unicast).
173173
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
174174
@param otpaddr
175175
The address of the OTP memory.
@@ -225,7 +225,7 @@ aoresult_t aoosp_exec_setotp(uint16_t addr, uint8_t otpaddr, uint8_t ormask, uin
225225
/*!
226226
@brief Reads the I2C_BRIDGE_EN bit from OTP (mirror).
227227
@param addr
228-
The address to send the telegram to
228+
The address to send the telegram to (unicast).
229229
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
230230
@param enable
231231
Output parameter returning the value of I2C_BRIDGE_EN.
@@ -241,16 +241,17 @@ aoresult_t aoosp_exec_i2cenable_get(uint16_t addr, int * enable) {
241241
// Read current OTP row
242242
uint8_t buf[8];
243243
aoresult_t result = aoosp_send_readotp(addr,otp_addr,buf,8);
244+
if( result!=aoresult_ok ) return result;
244245
// Check the OTP bit
245246
*enable = (buf[0] & otp_bit) != 0;
246-
return result;
247+
return aoresult_ok;
247248
}
248249

249250

250251
/*!
251252
@brief Writes the I2C_BRIDGE_EN bit to OTP (mirror).
252253
@param addr
253-
The address to send the telegram to
254+
The address to send the telegram to (unicast).
254255
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
255256
@param enable
256257
The new value for I2C_BRIDGE_EN.
@@ -279,7 +280,7 @@ aoresult_t aoosp_exec_i2cenable_set(uint16_t addr, int enable) {
279280
@brief Checks the address SAID if its OTP has the I2C bridge feature
280281
enabled, if so, powers the I2C bus.
281282
@param addr
282-
The address to send the telegram to
283+
The address to send the telegram to (unicast).
283284
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
284285
@return aoresult_ok if all ok, otherwise an error code.
285286
*/
@@ -302,7 +303,7 @@ aoresult_t aoosp_exec_i2cpower(uint16_t addr) {
302303
/*!
303304
@brief Reads the SYNC_PIN_EN bit from OTP (mirror).
304305
@param addr
305-
The address to send the telegram to
306+
The address to send the telegram to (unicast).
306307
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
307308
@param enable
308309
Output parameter returning the value of SYNC_PIN_EN.
@@ -317,16 +318,17 @@ aoresult_t aoosp_exec_syncpinenable_get(uint16_t addr, int * enable) {
317318
// Read current OTP row
318319
uint8_t buf[8];
319320
aoresult_t result = aoosp_send_readotp(addr,otp_addr,buf,8);
321+
if( result!=aoresult_ok ) return result;
320322
// Check the OTP bit
321323
*enable = (buf[0] & otp_bit) != 0;
322-
return result;
324+
return aoresult_ok;
323325
}
324326

325327

326328
/*!
327329
@brief Writes the SYNC_PIN_EN bit to OTP (mirror).
328330
@param addr
329-
The address to send the telegram to
331+
The address to send the telegram to (unicast).
330332
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
331333
@param enable
332334
The new value for SYNC_PIN_EN.
@@ -352,10 +354,10 @@ aoresult_t aoosp_exec_syncpinenable_set(uint16_t addr, int enable) {
352354

353355

354356
/*!
355-
@brief Writes count bytes from buf, into register raddr in I2C device
356-
daddr7, attached to OSP node addr.
357+
@brief Writes `count` bytes from `buf`, into register `raddr` in I2C
358+
device `daddr7`, attached to OSP node `addr`.
357359
@param addr
358-
The address to send the telegram to.
360+
The address to send the telegram to (unicast).
359361
(theoretically, use 0 for broadcast, or 3F0..3FE for group).
360362
@param daddr7
361363
The 7 bits I2C device address used in mastering the write.
@@ -393,8 +395,8 @@ aoresult_t aoosp_exec_i2cwrite8(uint16_t addr, uint8_t daddr7, uint8_t raddr, co
393395

394396

395397
/*!
396-
@brief Reads count bytes into buf, from register raddr in I2C device
397-
daddr7, attached to OSP node addr.
398+
@brief Reads `count` bytes into `buf`, from register `raddr` in I2C
399+
device `daddr7`, attached to OSP node `addr`.
398400
@param addr
399401
The address to send the telegram to (unicast).
400402
@param daddr7
@@ -433,5 +435,3 @@ aoresult_t aoosp_exec_i2cread8(uint16_t addr, uint8_t daddr7, uint8_t raddr, uin
433435
result = aoosp_send_readlast(addr,buf,count);
434436
return result;
435437
}
436-
437-

0 commit comments

Comments
 (0)