Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename non-public API #159

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"matepek.vscode-catch2-test-adapter",
"ms-vscode.cpptools",
"shardulm94.trailing-spaces",
"twxs.cmake"
Expand Down
55 changes: 54 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
"isDefault": true
}
},
{
"label": "Note-C: Compile and Run ALL Tests (with coverage)",
"type": "cppbuild",
"command": "./scripts/run_unit_tests.sh",
"args": [
"--coverage",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "Note-C: Compile and Run ALL Tests (with coverage and memory check)",
"type": "cppbuild",
Expand Down Expand Up @@ -51,6 +69,41 @@
"group": {
"kind": "none"
}
},
{
"label": "Note-C: Generate Coverage HTML",
"type": "shell",
"command": "genhtml lcov.info -o tmp",
"args": [],
"options": {
"cwd": "${workspaceFolder}/build/test/coverage",
"env": {
"LC_ALL": "C"
}
},
"problemMatcher": [],
"group": {
"kind": "none"
},
"dependsOn": [
"Note-C: Compile and Run ALL Tests (with coverage)"
]
},
{
"label": "Note-C: Generate Documentation",
"type": "shell",
"command": "./scripts/build_docs.sh",
"args": [],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"LC_ALL": "C"
}
},
"problemMatcher": [],
"group": {
"kind": "none"
}
}
]
}
}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ ARG USER

# Local Argument(s)

# Local Environment Variable(s)
ENV LC_ALL="C.UTF-8"

# Create Non-Root User
RUN ["dash", "-c", "\
addgroup \
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
# Options for HTML output

html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# WARNING: Calling get_html_theme_path is deprecated. If you are calling it to define html_theme_path, you are safe to remove that code.
#html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_logo = str(NOTE_C_BASE / 'assets' / 'blues_logo_no_text.png')
html_theme_options = {
'logo_only': True,
Expand Down
34 changes: 17 additions & 17 deletions docs/library_initialization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ The code below from `Src/main.c <https://github.com/blues/note-stm32l4/blob/mast
.. code-block:: c

#if NOTECARD_USE_I2C
NoteSetFnI2C(NOTE_I2C_ADDR_DEFAULT, NOTE_I2C_MAX_DEFAULT, noteI2CReset, noteI2CTransmit, noteI2CReceive);
NoteSetFnI2C(NOTE_I2C_ADDR_DEFAULT, NOTE_I2C_MAX_DEFAULT, _noteI2CReset, _noteI2CTransmit, _noteI2CReceive);
#else
NoteSetFnSerial(noteSerialReset, noteSerialTransmit, noteSerialAvailable, noteSerialReceive);
NoteSetFnSerial(_noteSerialReset, _noteSerialTransmit, _noteSerialAvailable, _noteSerialReceive);
#endif

``noteSerialReset``
`_noteSerialReset`
^^^^^^^^^^^^^^^^^^^

.. code-block:: c

bool noteSerialReset() {
bool _noteSerialReset() {
MX_USART1_UART_DeInit();
MX_USART1_UART_Init();

Expand All @@ -163,36 +163,36 @@ The code below from `Src/main.c <https://github.com/blues/note-stm32l4/blob/mast

The serial reset hook reinitializes the serial peripheral connected to the Notecard.

``noteSerialTransmit``
`_noteSerialTransmit`
^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: c

void noteSerialTransmit(uint8_t *text, size_t len, bool flush) {
void _noteSerialTransmit(uint8_t *text, size_t len, bool flush) {
HAL_UART_Transmit(&huart1, text, len, 5000);
}

The serial transmit hook uses the HAL to write the data in the buffer to the serial peripheral connected to the Notecard.

``noteSerialAvailable``
`_noteSerialAvailable`
^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: c

bool noteSerialAvailable() {
bool _noteSerialAvailable() {
return (serialFillIndex != serialDrainIndex);
}

For receiving serial data from the Notecard, note-stm32l4 uses a circular buffer. In the receive interrupt handler for the UART peripheral, this buffer gets populated with the received data. ``serialFillIndex`` is the write index into that buffer, and ``serialDrainIndex`` is the read index. If the two indices are equal, there's nothing new to read. If they aren't equal, there is something to read.

``noteSerialReceive``
`_noteSerialReceive`
^^^^^^^^^^^^^^^^^^^^^

.. code-block:: c

char noteSerialReceive() {
char _noteSerialReceive() {
char data;
while (!noteSerialAvailable()) ;
while (!_noteSerialAvailable()) ;
if (serialDrainIndex < sizeof(serialBuffer))
data = serialBuffer[serialDrainIndex++];
else {
Expand All @@ -204,12 +204,12 @@ For receiving serial data from the Notecard, note-stm32l4 uses a circular buffer

The serial receive hook returns the byte from the circular receive buffer at the read index, handling the case where the index wraps around to 0.

``noteI2CReset``
`_noteI2CReset`
^^^^^^^^^^^^^^^^

.. code-block:: c

bool noteI2CReset(uint16_t DevAddress) {
bool _noteI2CReset(uint16_t DevAddress) {
MX_I2C1_DeInit();
MX_I2C1_Init();

Expand All @@ -218,12 +218,12 @@ The serial receive hook returns the byte from the circular receive buffer at the

The I2C reset hook reinitializes the I2C peripheral used to communicate with the Notecard.

``noteI2CTransmit``
`_noteI2CTransmit`
^^^^^^^^^^^^^^^^^^^

.. code-block:: c

const char *noteI2CTransmit(uint16_t DevAddress, uint8_t* pBuffer, uint16_t Size) {
const char *_noteI2CTransmit(uint16_t DevAddress, uint8_t* pBuffer, uint16_t Size) {
char *errstr = NULL;
int writelen = sizeof(uint8_t) + Size;
uint8_t *writebuf = malloc(writelen);
Expand Down Expand Up @@ -255,12 +255,12 @@ Then, it adds on the payload of ``Size`` bytes, which is pointed to by ``pBuffer

Then the host calls the platform-specific method to send those bytes over I2C, which is ``HAL_I2C_Master_Transmit`` in this case.

``noteI2CReceive``
`_noteI2CReceive`
^^^^^^^^^^^^^^^^^^

.. code-block:: c

const char *noteI2CReceive(uint16_t DevAddress, uint8_t* pBuffer, uint16_t Size, uint32_t *available) {
const char *_noteI2CReceive(uint16_t DevAddress, uint8_t* pBuffer, uint16_t Size, uint32_t *available) {
const char *errstr = NULL;
HAL_StatusTypeDef err_code;

Expand Down
Loading
Loading