diff --git a/0x0001_hello-world/0x0001_hello-world.c b/0x0001_hello-world/0x0001_hello-world.c index 096aba7..7f7b062 100644 --- a/0x0001_hello-world/0x0001_hello-world.c +++ b/0x0001_hello-world/0x0001_hello-world.c @@ -1,9 +1,46 @@ +/** + * @file 0x0001_hello-world.c + * @brief Hello World: print a greeting over UART in an infinite loop + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates the minimal "hello, world" program on the Raspberry Pi Pico 2. + * Initializes stdio over UART and prints a greeting in an infinite loop. + * + * Wiring: + * No external wiring required (USB serial). + */ + #include #include "pico/stdlib.h" int main(void) { stdio_init_all(); - - while (true) + while (true) { printf("hello, world\r\n"); + } } diff --git a/0x0005_intro-to-variables/0x0005_intro-to-variables.c b/0x0005_intro-to-variables/0x0005_intro-to-variables.c index 7b2b3ae..29f6b2d 100644 --- a/0x0005_intro-to-variables/0x0005_intro-to-variables.c +++ b/0x0005_intro-to-variables/0x0005_intro-to-variables.c @@ -1,13 +1,48 @@ +/** + * @file 0x0005_intro-to-variables.c + * @brief Introduction to variables: declare, assign, and print a uint8_t + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates declaring, initializing, and reassigning a uint8_t variable. + * Prints the variable value over UART in an infinite loop. + * + * Wiring: + * No external wiring required (USB serial). + */ + #include #include "pico/stdlib.h" int main(void) { uint8_t age = 42; - age = 43; - stdio_init_all(); - - while (true) + while (true) { printf("age: %d\r\n", age); + } } diff --git a/0x0008_unitialized-variables-a/0x0008_unitialized-variables-a.c b/0x0008_unitialized-variables-a/0x0008_unitialized-variables-a.c index 656a992..ba02410 100644 --- a/0x0008_unitialized-variables-a/0x0008_unitialized-variables-a.c +++ b/0x0008_unitialized-variables-a/0x0008_unitialized-variables-a.c @@ -1,17 +1,52 @@ +/** + * @file 0x0008_unitialized-variables-a.c + * @brief Blink LED using SDK gpio functions (no UART) + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Blinks an LED on GPIO16 using the standard Pico SDK gpio_init / gpio_put + * functions. No UART output; pure GPIO blink demonstration. + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -#define LED_PIN 16 +/** @brief GPIO pin number for the LED */ +#define LED_PIN 16 -int main(void) -{ +int main(void) { gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); - while (true) { gpio_put(LED_PIN, 1); sleep_ms(500); - gpio_put(LED_PIN, 0); sleep_ms(500); } diff --git a/0x0008_unitialized-variables-b/0x0008_unitialized-variables-b.c b/0x0008_unitialized-variables-b/0x0008_unitialized-variables-b.c index 365d7eb..ba676e4 100644 --- a/0x0008_unitialized-variables-b/0x0008_unitialized-variables-b.c +++ b/0x0008_unitialized-variables-b/0x0008_unitialized-variables-b.c @@ -1,27 +1,80 @@ +/** + * @file 0x0008_unitialized-variables-b.c + * @brief Blink LED using gpioc coprocessor bit-level functions + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Blinks an LED on GPIO16 using the RP2350 gpioc coprocessor bit-level + * functions (gpioc_bit_oe_put / gpioc_bit_out_put) instead of the standard + * gpio_init / gpio_put SDK calls. + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -#define LED_PIN 16 +/** @brief GPIO pin number for the LED */ +#define LED_PIN 16 -int main(void) -{ - // gpio_init(LED_PIN); +/** + * @brief Initialize GPIO16 for output using coprocessor bit functions + * + * @details Configures the pad for SIO, sets direction to input first, + * clears the output, selects SIO function, then enables output. + * + * @retval None + */ +static void gpio_coprocessor_init(void) { gpio_set_dir(LED_PIN, GPIO_IN); gpio_put(LED_PIN, 0); gpio_set_function(LED_PIN, GPIO_FUNC_SIO); - - // gpio_set_dir(LED_PIN, GPIO_OUT); gpioc_bit_oe_put(LED_PIN, GPIO_OUT); +} +/** + * @brief Blink LED using coprocessor bit output functions + * + * @details Toggles the LED on and off with 500ms delays using + * gpioc_bit_out_put and sleep_us. + * + * @retval None + */ +static void blink_cycle(void) { + gpioc_bit_out_put(LED_PIN, 1); + sleep_us(500 * 1000ull); + gpioc_bit_out_put(LED_PIN, 0); + sleep_us(500 * 1000ull); +} + +int main(void) { + gpio_coprocessor_init(); while (true) { - // gpio_put(LED_PIN, 1); - gpioc_bit_out_put(LED_PIN, 1); - // sleep_ms(500); - sleep_us(500 * 1000ull); - - // gpio_put(LED_PIN, 0); - gpioc_bit_out_put(LED_PIN, 0); - // sleep_ms(500); - sleep_us(500 * 1000ull); + blink_cycle(); } } diff --git a/0x0008_unitialized-variables-c/0x0008_unitialized-variables-c.c b/0x0008_unitialized-variables-c/0x0008_unitialized-variables-c.c index 5136c35..4c71b5b 100644 --- a/0x0008_unitialized-variables-c/0x0008_unitialized-variables-c.c +++ b/0x0008_unitialized-variables-c/0x0008_unitialized-variables-c.c @@ -1,35 +1,85 @@ +/** + * @file 0x0008_unitialized-variables-c.c + * @brief Blink LED using direct register-level pad and IO bank configuration + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Blinks an LED on GPIO16 using direct register writes to PADS_BANK0 and + * IO_BANK0 for pad configuration, plus gpioc coprocessor bit-level functions + * for output enable and data. Demonstrates the register-level equivalent of + * gpio_init / gpio_set_function. + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -#define LED_PIN 16 +/** @brief GPIO pin number for the LED */ +#define LED_PIN 16 -int main(void) -{ - // gpio_init(LED_PIN); - /// gpio_set_dir(LED_PIN, GPIO_IN); +/** + * @brief Configure pad and IO bank registers for GPIO16 as SIO output + * + * @details Sets PADS_BANK0 IE/OD bits, assigns FUNCSEL to SIO in IO_BANK0, + * clears the ISO bit, and enables output via the coprocessor. + * + * @retval None + */ +static void configure_pad_and_iobank(void) { gpioc_bit_oe_put(LED_PIN, GPIO_OUT); - /// gpio_put(LED_PIN, 0); gpioc_bit_out_put(LED_PIN, 0); - /// gpio_set_function(LED_PIN, GPIO_FUNC_SIO); hw_write_masked(&pads_bank0_hw->io[LED_PIN], PADS_BANK0_GPIO0_IE_BITS, - PADS_BANK0_GPIO0_IE_BITS | PADS_BANK0_GPIO0_OD_BITS - ); + PADS_BANK0_GPIO0_IE_BITS | PADS_BANK0_GPIO0_OD_BITS); io_bank0_hw->io[LED_PIN].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB; hw_clear_bits(&pads_bank0_hw->io[LED_PIN], PADS_BANK0_GPIO0_ISO_BITS); - - // gpio_set_dir(LED_PIN, GPIO_OUT); gpioc_bit_oe_put(LED_PIN, GPIO_OUT); +} +/** + * @brief Blink LED using coprocessor bit output functions + * + * @details Toggles the LED on and off with 500ms delays using + * gpioc_bit_out_put and sleep_us. + * + * @retval None + */ +static void blink_cycle(void) { + gpioc_bit_out_put(LED_PIN, 1); + sleep_us(500 * 1000ull); + gpioc_bit_out_put(LED_PIN, 0); + sleep_us(500 * 1000ull); +} + +int main(void) { + configure_pad_and_iobank(); while (true) { - // gpio_put(LED_PIN, 1); - gpioc_bit_out_put(LED_PIN, 1); - // sleep_ms(500); - sleep_us(500 * 1000ull); - - // gpio_put(LED_PIN, 0); - gpioc_bit_out_put(LED_PIN, 0); - // sleep_ms(500); - sleep_us(500 * 1000ull); + blink_cycle(); } } diff --git a/0x0008_unitialized-variables-d/0x0008_unitialized-variables-d.c b/0x0008_unitialized-variables-d/0x0008_unitialized-variables-d.c index 457ed9a..2b7efe6 100644 --- a/0x0008_unitialized-variables-d/0x0008_unitialized-variables-d.c +++ b/0x0008_unitialized-variables-d/0x0008_unitialized-variables-d.c @@ -1,23 +1,70 @@ +/** + * @file 0x0008_unitialized-variables-d.c + * @brief Blink LED using pico_default_asm_volatile coprocessor instructions + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Blinks an LED on GPIO16 using pico_default_asm_volatile to emit mcrr + * coprocessor instructions for GPIO output enable and data, plus inline + * assembly for pad configuration (hw_write_masked, IO_BANK0 FUNCSEL, + * hw_clear_bits equivalents). + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -#define LED_PIN 16 +/** @brief GPIO pin number for the LED */ +#define LED_PIN 16 -int main(void) -{ - // gpio_init(LED_PIN); - /// gpio_set_dir(LED_PIN, GPIO_IN); - //// gpioc_bit_oe_put(LED_PIN, GPIO_OUT); +/** + * @brief Enable output and set initial coprocessor OE/OUT via mcrr + * + * @details Issues two mcrr p0 instructions: one to enable output direction, + * one to set the initial output state. + * + * @retval None + */ +static void asm_set_oe_and_out(void) { pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c4" : : "r" (LED_PIN), "r" (GPIO_OUT)); - /// gpio_put(LED_PIN, 0); - //// gpioc_bit_out_put(LED_PIN, 0); pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c4" : : "r" (LED_PIN), "r" (GPIO_OUT)); - /// gpio_set_function(LED_PIN, GPIO_FUNC_SIO); - //// hw_write_masked(&pads_bank0_hw->io[LED_PIN], - //// PADS_BANK0_GPIO0_IE_BITS, - //// PADS_BANK0_GPIO0_IE_BITS | PADS_BANK0_GPIO0_OD_BITS - //// ); - //// hw_xor_bits(addr, (*addr ^ values) & write_mask); +} + +/** + * @brief Configure PADS_BANK0 IE/OD bits via inline assembly hw_xor_bits + * + * @details Performs a read-modify-write on the pad register to set IE + * and clear OD, replicating hw_write_masked behavior. + * + * @retval None + */ +static void asm_configure_pad(void) { pico_default_asm_volatile ( "ldr r2, [%0]\n" // load current pad register "eor r2, r2, %1\n" // xor with IE bit @@ -30,8 +77,17 @@ int main(void) "r" (PADS_BANK0_GPIO0_IE_BITS | PADS_BANK0_GPIO0_OD_BITS) : "r2", "memory" ); +} - /// io_bank0_hw->io[LED_PIN].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB; +/** + * @brief Set IO_BANK0 FUNCSEL to SIO via inline assembly store + * + * @details Writes the SIO function select value directly to the + * IO_BANK0 GPIO control register. + * + * @retval None + */ +static void asm_set_funcsel(void) { pico_default_asm_volatile ( "str %1, [%0]\n" : @@ -39,32 +95,50 @@ int main(void) "r" (GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB) : "memory" ); - /// hw_clear_bits(&pads_bank0_hw->io[LED_PIN], PADS_BANK0_GPIO0_ISO_BITS); +} + +/** + * @brief Clear ISO bits in PADS_BANK0 via inline assembly + * + * @details Performs a read-modify-write to clear the pad isolation + * bit, un-isolating the pad for normal operation. + * + * @retval None + */ +static void asm_clear_iso(void) { pico_default_asm_volatile ( "ldr r2, [%0]\n" // load current register value "bic r2, r2, %1\n" // clear the ISO bits (bit clear) - "str r2, [%0]\n" // write back + "str r2, [%0]\n" // write back : : "r" (&pads_bank0_hw->io[LED_PIN]), "r" (PADS_BANK0_GPIO0_ISO_BITS) : "r2", "memory" ); +} - // gpio_set_dir(LED_PIN, GPIO_OUT); - /// gpioc_bit_oe_put(LED_PIN, GPIO_OUT); +/** + * @brief Blink LED using coprocessor mcrr output instructions + * + * @details Toggles the LED on and off with 500ms delays using + * pico_default_asm_volatile mcrr instructions. + * + * @retval None + */ +static void asm_blink_cycle(void) { + pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c0" : : "r" (LED_PIN), "r" (1)); + sleep_us(500 * 1000ull); + pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c0" : : "r" (LED_PIN), "r" (0)); + sleep_us(500 * 1000ull); +} + +int main(void) { + asm_set_oe_and_out(); + asm_configure_pad(); + asm_set_funcsel(); + asm_clear_iso(); pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c4" : : "r" (LED_PIN), "r" (GPIO_OUT)); - while (true) { - // gpio_put(LED_PIN, 1); - /// gpioc_bit_out_put(LED_PIN, 1); - pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c0" : : "r" (LED_PIN), "r" (1)); - /// sleep_ms(500); - sleep_us(500 * 1000ull); - - // gpio_put(LED_PIN, 0); - /// gpioc_bit_out_put(LED_PIN, 0); - pico_default_asm_volatile ("mcrr p0, #4, %0, %1, c0" : : "r" (LED_PIN), "r" (0)); - /// sleep_ms(500); - sleep_us(500 * 1000ull); + asm_blink_cycle(); } } diff --git a/0x0008_unitialized-variables-e/0x0008_unitialized-variables-e.c b/0x0008_unitialized-variables-e/0x0008_unitialized-variables-e.c index 5dba746..42799c7 100644 --- a/0x0008_unitialized-variables-e/0x0008_unitialized-variables-e.c +++ b/0x0008_unitialized-variables-e/0x0008_unitialized-variables-e.c @@ -1,5 +1,43 @@ -int main(void) { - __asm__ volatile ( +/** + * @file 0x0008_unitialized-variables-e.c + * @brief Blink LED using pure inline ARM assembly with direct register addresses + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Blinks an LED on GPIO16 using pure inline ARM assembly. No SDK calls, no + * includes. Configures PADS_BANK0, IO_BANK0, and GPIO coprocessor via direct + * register addresses and mcrr instructions, with a busy-wait delay loop. + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + +int main(void) { + __asm__ volatile ( // gpio_init(LED_PIN); /// gpio_set_dir(LED_PIN, GPIO_IN); //// gpioc_bit_oe_put(LED_PIN, GPIO_OUT); diff --git a/0x0008_unitialized-variables/0x0008_unitialized-variables.c b/0x0008_unitialized-variables/0x0008_unitialized-variables.c index 0c94677..26bf440 100644 --- a/0x0008_unitialized-variables/0x0008_unitialized-variables.c +++ b/0x0008_unitialized-variables/0x0008_unitialized-variables.c @@ -1,23 +1,68 @@ +/** + * @file 0x0008_unitialized-variables.c + * @brief Uninitialized variables: demonstrate undefined behavior with printf + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates the danger of uninitialized variables. Prints the value of an + * uninitialized uint8_t over UART while blinking an LED on GPIO16. + * + * Wiring: + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -#define LED_PIN 16 +/** @brief GPIO pin number for the LED */ +#define LED_PIN 16 + +/** + * @brief Toggle LED and print uninitialized variable value + * + * @details Blinks the LED on and off with a 500ms delay between each + * transition and prints the age variable each cycle. + * + * @param age value to print (uninitialized in this demo) + */ +static void blink_and_print(uint8_t age) { + printf("age: %d\r\n", age); + gpio_put(LED_PIN, 1); + sleep_ms(500); + gpio_put(LED_PIN, 0); + sleep_ms(500); +} int main(void) { uint8_t age; - stdio_init_all(); - gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); - while (true) { - printf("age: %d\r\n", age); - - gpio_put(LED_PIN, 1); - sleep_ms(500); - - gpio_put(LED_PIN, 0); - sleep_ms(500); + blink_and_print(age); } } diff --git a/0x000b_integer-data-type/0x000b_integer-data-type.c b/0x000b_integer-data-type/0x000b_integer-data-type.c index 6a0d6ab..c923449 100644 --- a/0x000b_integer-data-type/0x000b_integer-data-type.c +++ b/0x000b_integer-data-type/0x000b_integer-data-type.c @@ -1,17 +1,59 @@ -#include -#include "pico/stdlib.h" +/** + * @file 0x000b_integer-data-type.c + * @brief Integer data types: cycle LEDs on GPIO16-18 with asm, print int values + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates uint8_t and int8_t integer data types. Initializes GPIO16-18 + * via inline assembly (PADS_BANK0, IO_BANK0, coprocessor OE), then cycles + * LEDs using coprocessor mcrr instructions while printing integer values. + * + * Wiring: + * GPIO16 -> LED1 anode (with current-limiting resistor to GND) + * GPIO17 -> LED2 anode (with current-limiting resistor to GND) + * GPIO18 -> LED3 anode (with current-limiting resistor to GND) + */ -int main(void) { - uint8_t age = 43; - int8_t range = -42; +#include +#include "pico/stdlib.h" - stdio_init_all(); - - __asm volatile ( +/** + * @brief Initialize GPIO16-18 as SIO outputs via inline assembly loop + * + * @details Configures PADS_BANK0 (clear OD+ISO, set IE), IO_BANK0 + * (FUNCSEL=5 SIO), and coprocessor OE for pins 16-18. + * + * @retval None + */ +static void asm_init_gpio_range(void) { + __asm volatile ( "ldr r3, =0x40038000\n" // address of PADS_BANK0_BASE "ldr r2, =0x40028004\n" // address of IO_BANK0 GPIO0.ctrl "movs r0, #16\n" // GPIO16 (start pin) - "init_loop:\n" // loop start "lsls r1, r0, #2\n" // pin * 4 (pad offset) "adds r4, r3, r1\n" // PADS base + offset @@ -19,49 +61,72 @@ int main(void) { "bic r5, r5, #0x180\n" // clear OD+ISO "orr r5, r5, #0x40\n" // set IE "str r5, [r4]\n" // store updated config - "lsls r1, r0, #3\n" // pin * 8 (ctrl offset) "adds r4, r2, r1\n" // IO_BANK0 base + offset "ldr r5, [r4]\n" // load current config "bic r5, r5, #0x1f\n" // clear FUNCSEL bits [4:0] "orr r5, r5, #5\n" // set FUNCSEL = 5 (SIO) "str r5, [r4]\n" // store updated config - "mov r4, r0\n" // pin "movs r5, #1\n" // bit 1; used for OUT/OE writes "mcrr p0, #4, r4, r5, c4\n" // gpioc_bit_oe_put(pin,1) "adds r0, r0, #1\n" // increment pin "cmp r0, #20\n" // stop after pin 18 "blt init_loop\n" // loop until r0 == 20 - ); - - uint8_t pin = 16; - - while (1) { - __asm volatile ( - "mov r4, %0\n" // pin - "movs r5, #0x01\n" // bit 1; used for OUT/OE writes - "mcrr p0, #4, r4, r5, c0\n" // gpioc_bit_out_put(16, 1) - : - : "r"(pin) - : "r4","r5" - ); - sleep_ms(500); - - __asm volatile ( - "mov r4, %0\n" // pin - "movs r5, #0\n" // bit 0; used for OUT/OE writes - "mcrr p0, #4, r4, r5, c0\n" // gpioc_bit_out_put(16, 0) - : - : "r"(pin) - : "r4","r5" - ); - sleep_ms(500); - - pin++; - if (pin > 18) pin = 16; - - printf("age: %d\r\n", age); - printf("range: %d\r\n", range); - } + ); +} + +/** + * @brief Blink a single pin using coprocessor mcrr instructions + * + * @details Turns the specified pin on for 500ms, then off for 500ms + * using inline asm mcrr coprocessor output instructions. + * + * @param pin GPIO pin number to blink + * @retval None + */ +static void asm_blink_pin(uint8_t pin) { + __asm volatile ( + "mov r4, %0\n" + "movs r5, #0x01\n" + "mcrr p0, #4, r4, r5, c0\n" + : : "r"(pin) : "r4", "r5" + ); + sleep_ms(500); + __asm volatile ( + "mov r4, %0\n" + "movs r5, #0\n" + "mcrr p0, #4, r4, r5, c0\n" + : : "r"(pin) : "r4", "r5" + ); + sleep_ms(500); +} + +/** + * @brief Blink LED, advance pin, and print age/range + * + * @details Blinks the current pin, wraps pin 16-18, + * and prints both integer variables. + * + * @param pin pointer to the current GPIO pin number + * @param age unsigned 8-bit age value + * @param range signed 8-bit range value + * @retval None + */ +static void blink_and_print(uint8_t *pin, uint8_t age, int8_t range) { + asm_blink_pin(*pin); + *pin = (*pin > 18) ? 16 : *pin + 1; + printf("age: %d\r\n", age); + printf("range: %d\r\n", range); +} + +int main(void) { + uint8_t age = 43; + int8_t range = -42; + stdio_init_all(); + asm_init_gpio_range(); + uint8_t pin = 16; + while (1) { + blink_and_print(&pin, age, range); + } } diff --git a/0x000e_floating-point-data-type/0x000e_floating-point-data-type.c b/0x000e_floating-point-data-type/0x000e_floating-point-data-type.c index fb3d382..f0a3bac 100644 --- a/0x000e_floating-point-data-type/0x000e_floating-point-data-type.c +++ b/0x000e_floating-point-data-type/0x000e_floating-point-data-type.c @@ -1,11 +1,47 @@ +/** + * @file 0x000e_floating-point-data-type.c + * @brief Floating-point data type: print a float value over UART + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates the float data type on the Raspberry Pi Pico 2. Initializes + * a float variable and prints its value over UART in an infinite loop. + * + * Wiring: + * No external wiring required (USB serial). + */ + #include #include "pico/stdlib.h" int main(void) { float fav_num = 42.5; - stdio_init_all(); - - while (true) + while (true) { printf("fav_num: %f\r\n", fav_num); + } } diff --git a/0x0011_double-floating-point-data-type/0x0011_double-floating-point-data-type.c b/0x0011_double-floating-point-data-type/0x0011_double-floating-point-data-type.c index d4f3d11..753f51d 100644 --- a/0x0011_double-floating-point-data-type/0x0011_double-floating-point-data-type.c +++ b/0x0011_double-floating-point-data-type/0x0011_double-floating-point-data-type.c @@ -1,11 +1,47 @@ +/** + * @file 0x0011_double-floating-point-data-type.c + * @brief Double floating-point data type: print a double value over UART + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates the double data type on the Raspberry Pi Pico 2. Initializes + * a double variable and prints its value over UART in an infinite loop. + * + * Wiring: + * No external wiring required (USB serial). + */ + #include #include "pico/stdlib.h" int main(void) { double fav_num = 42.52525; - stdio_init_all(); - - while (true) + while (true) { printf("fav_num: %lf\r\n", fav_num); + } } diff --git a/0x0014_static-variables/0x0014_static-variables.c b/0x0014_static-variables/0x0014_static-variables.c index bb34259..ff5fd32 100644 --- a/0x0014_static-variables/0x0014_static-variables.c +++ b/0x0014_static-variables/0x0014_static-variables.c @@ -1,31 +1,90 @@ +/** + * @file 0x0014_static-variables.c + * @brief Static variables: compare regular vs static local variable persistence + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates the difference between regular and static local variables. + * A regular variable resets to 42 each iteration while a static variable + * persists and increments across loop iterations. Also reads a button on + * GPIO15 and mirrors its state to an LED on GPIO16. + * + * Wiring: + * GPIO15 -> Button (with pull-up, active low) + * GPIO16 -> LED anode (with current-limiting resistor to GND) + */ + #include #include "pico/stdlib.h" -int main(void) { - stdio_init_all(); - - const uint BUTTON_GPIO = 15; - const uint LED_GPIO = 16; - bool pressed = 0; +/** @brief GPIO pin number for the button input */ +#define BUTTON_GPIO 15 +/** @brief GPIO pin number for the LED output */ +#define LED_GPIO 16 +/** + * @brief Initialize button and LED GPIO pins + * + * @details Configures the button pin as input with pull-up and the + * LED pin as output. + * + * @retval None + */ +static void init_gpio(void) { gpio_init(BUTTON_GPIO); gpio_set_dir(BUTTON_GPIO, GPIO_IN); gpio_pull_up(BUTTON_GPIO); - gpio_init(LED_GPIO); gpio_set_dir(LED_GPIO, GPIO_OUT); +} +/** + * @brief Print and increment regular vs static variables, update LED + * + * @details Prints both variable values, increments them, reads the + * button state and drives the LED accordingly. + * + * @retval None + */ +static void demo_static_variable(void) { + uint8_t regular_fav_num = 42; + static uint8_t static_fav_num = 42; + printf("regular_fav_num: %d\r\n", regular_fav_num); + printf("static_fav_num: %d\r\n", static_fav_num); + regular_fav_num++; + static_fav_num++; + bool pressed = gpio_get(BUTTON_GPIO); + gpio_put(LED_GPIO, pressed ? 0 : 1); +} + +int main(void) { + stdio_init_all(); + init_gpio(); while (true) { - uint8_t regular_fav_num = 42; - static uint8_t static_fav_num = 42; - - printf("regular_fav_num: %d\r\n", regular_fav_num); - printf("static_fav_num: %d\r\n", static_fav_num); - - regular_fav_num++; - static_fav_num++; - - pressed = gpio_get(BUTTON_GPIO); - gpio_put(LED_GPIO, pressed ? 0 : 1); + demo_static_variable(); } } diff --git a/0x0017_constants/0x0017_constants.c b/0x0017_constants/0x0017_constants.c index b762ca1..f3b5182 100644 --- a/0x0017_constants/0x0017_constants.c +++ b/0x0017_constants/0x0017_constants.c @@ -1,33 +1,98 @@ +/** + * @file 0x0017_constants.c + * @brief Constants: demonstrate #define and const with LCD1602 I2C display + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates #define macro constants and const-qualified variables. + * Initializes an LCD1602 display over I2C and prints constant values + * over UART in an infinite loop. + * + * Wiring: + * GPIO2 (SDA) -> LCD1602 PCF8574 SDA + * GPIO3 (SCL) -> LCD1602 PCF8574 SCL + * 3V3 -> LCD1602 VCC + * GND -> LCD1602 GND + */ + #include #include #include "pico/stdlib.h" #include "hardware/i2c.h" #include "lcd_1602.h" -#define FAV_NUM 42 - -#define I2C_PORT i2c1 +/** @brief Macro constant for favorite number */ +#define FAV_NUM 42 +/** @brief I2C peripheral instance */ +#define I2C_PORT i2c1 +/** @brief GPIO pin for I2C SDA */ #define I2C_SDA_PIN 2 +/** @brief GPIO pin for I2C SCL */ #define I2C_SCL_PIN 3 +/** @brief Const-qualified favorite number */ const int OTHER_FAV_NUM = 1337; -int main(void) { - stdio_init_all(); - +/** + * @brief Initialize I2C bus and LCD1602 display + * + * @details Configures I2C1 at 100kHz on GPIO2/3, initializes the + * LCD via PCF8574 at address 0x27, and writes two lines. + * + * @retval None + */ +static void init_i2c_and_lcd(void) { i2c_init(I2C_PORT, 100000); gpio_set_function(I2C_SDA_PIN, GPIO_FUNC_I2C); gpio_set_function(I2C_SCL_PIN, GPIO_FUNC_I2C); gpio_pull_up(I2C_SDA_PIN); gpio_pull_up(I2C_SCL_PIN); - lcd_i2c_init(I2C_PORT, 0x27, 4, 0x08); +} +/** + * @brief Write greeting text to the LCD display + * + * @details Sets cursor to line 0 and writes "Reverse", then sets + * cursor to line 1 and writes "Engineering". + * + * @retval None + */ +static void write_lcd_greeting(void) { lcd_set_cursor(0, 0); lcd_puts("Reverse"); lcd_set_cursor(1, 0); lcd_puts("Engineering"); +} +int main(void) { + stdio_init_all(); + init_i2c_and_lcd(); + write_lcd_greeting(); while (true) { printf("FAV_NUM: %d\r\n", FAV_NUM); printf("OTHER_FAV_NUM: %d\r\n", OTHER_FAV_NUM); diff --git a/0x0017_constants/lcd_1602.c b/0x0017_constants/lcd_1602.c index 7425cf1..80054cc 100644 --- a/0x0017_constants/lcd_1602.c +++ b/0x0017_constants/lcd_1602.c @@ -31,21 +31,37 @@ #include #include +/** @brief I2C instance pointer for the LCD */ static i2c_inst_t *lcd_i2c = NULL; +/** @brief I2C address of the PCF8574 backpack */ static uint8_t lcd_addr = 0x27; +/** @brief Bit shift for 4-bit nibble position */ static int lcd_nibble_shift = 4; +/** @brief PCF8574 bit mask controlling the backlight */ static uint8_t lcd_backlight_mask = 0x08; -/* PCF8574 -> LCD control pins */ +/** @brief PCF8574 bit mask for Register Select */ #define PIN_RS 0x01 +/** @brief PCF8574 bit mask for Read/Write */ #define PIN_RW 0x02 +/** @brief PCF8574 bit mask for Enable */ #define PIN_EN 0x04 +/** + * @brief Write one raw byte to the PCF8574 expander over I2C + * + * @param data Output byte to send to the expander + */ static void pcf_write_byte(uint8_t data) { if (!lcd_i2c) return; i2c_write_blocking(lcd_i2c, lcd_addr, &data, 1, false); } +/** + * @brief Toggle EN to latch a nibble into the LCD controller + * + * @param data Current control/data bus byte (with RS and backlight already set) + */ static void pcf_pulse_enable(uint8_t data) { pcf_write_byte(data | PIN_EN); sleep_us(1); @@ -53,6 +69,12 @@ static void pcf_pulse_enable(uint8_t data) { sleep_us(50); } +/** + * @brief Write one 4-bit nibble to the LCD + * + * @param nibble Lower 4 bits to write + * @param mode 0 for command, non-zero for character data + */ static void lcd_write4(uint8_t nibble, uint8_t mode) { uint8_t data = (nibble & 0x0F) << lcd_nibble_shift; data |= mode ? PIN_RS : 0; @@ -60,18 +82,37 @@ static void lcd_write4(uint8_t nibble, uint8_t mode) { pcf_pulse_enable(data); } +/** + * @brief Send one full 8-bit command/data value as two nibbles + * + * @param value Byte to send to the LCD + * @param mode 0 for command, non-zero for character data + */ static void lcd_send(uint8_t value, uint8_t mode) { lcd_write4((value >> 4) & 0x0F, mode); lcd_write4(value & 0x0F, mode); } -void lcd_i2c_init(i2c_inst_t *i2c, uint8_t pcf_addr, int nibble_shift, uint8_t backlight_mask) { +/** + * @brief Store LCD driver configuration in module-level state + * + * @param i2c Pointer to the I2C instance + * @param pcf_addr 7-bit PCF8574 address + * @param nibble_shift Bit shift for 4-bit nibbles + * @param backlight_mask Backlight control bit mask + */ +static void lcd_store_config(i2c_inst_t *i2c, uint8_t pcf_addr, + int nibble_shift, uint8_t backlight_mask) { lcd_i2c = i2c; lcd_addr = pcf_addr; lcd_nibble_shift = nibble_shift; lcd_backlight_mask = backlight_mask; +} - // Follow init sequence for HD44780 in 4-bit mode +/** + * @brief Execute the HD44780 4-bit mode power-on reset sequence + */ +static void lcd_hd44780_reset(void) { lcd_write4(0x03, 0); sleep_ms(5); lcd_write4(0x03, 0); @@ -80,21 +121,28 @@ void lcd_i2c_init(i2c_inst_t *i2c, uint8_t pcf_addr, int nibble_shift, uint8_t b sleep_us(150); lcd_write4(0x02, 0); sleep_us(150); +} - // Function set: 4-bit, 2 lines +/** + * @brief Send post-reset configuration commands to the HD44780 + * + * Sets 4-bit mode with 2 display lines, turns the display on with + * cursor hidden, clears the screen, and selects left-to-right entry mode. + */ +static void lcd_hd44780_configure(void) { lcd_send(0x28, 0); - - // Display on, cursor off lcd_send(0x0C, 0); - - // Clear lcd_send(0x01, 0); sleep_ms(2); - - // Entry mode set lcd_send(0x06, 0); } +void lcd_i2c_init(i2c_inst_t *i2c, uint8_t pcf_addr, int nibble_shift, uint8_t backlight_mask) { + lcd_store_config(i2c, pcf_addr, nibble_shift, backlight_mask); + lcd_hd44780_reset(); + lcd_hd44780_configure(); +} + void lcd_clear(void) { lcd_send(0x01, 0); sleep_ms(2); @@ -102,13 +150,11 @@ void lcd_clear(void) { void lcd_set_cursor(int line, int position) { const uint8_t row_offsets[] = {0x00, 0x40}; - if (line > 1) line = 1; lcd_send(0x80 | (position + row_offsets[line]), 0); } void lcd_puts(const char *s) { - while (*s) { + while (*s) lcd_send((uint8_t)*s++, 1); - } } diff --git a/0x001a_operators/0x001a_operators.c b/0x001a_operators/0x001a_operators.c index d9ddccf..1eecc97 100644 --- a/0x001a_operators/0x001a_operators.c +++ b/0x001a_operators/0x001a_operators.c @@ -1,36 +1,126 @@ +/** + * @file 0x001a_operators.c + * @brief Operators: demonstrate C operators with DHT11 temperature sensor + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates arithmetic, increment, relational, logical, bitwise, and + * assignment operators in C. Also reads humidity and temperature from a + * DHT11 sensor on GPIO4. + * + * Wiring: + * GPIO4 -> DHT11 data pin (with 10k pull-up to 3V3) + * 3V3 -> DHT11 VCC + * GND -> DHT11 GND + */ + #include #include "pico/stdlib.h" #include "dht11.h" +/** + * @brief Print pre-computed operator results + * + * @details Prints all six operator demonstration values over UART. + * + * @param arith arithmetic operator result + * @param inc increment operator result + * @param rel relational operator result + * @param logic logical operator result + * @param bitw bitwise operator result + * @param assign assignment operator result + * @retval None + */ +static void print_operator_results(int arith, int inc, bool rel, + bool logic, int bitw, int assign) { + printf("arithmetic_operator: %d\r\n", arith); + printf("increment_operator: %d\r\n", inc); + printf("relational_operator: %d\r\n", rel); + printf("logical_operator: %d\r\n", logic); + printf("bitwise_operator: %d\r\n", bitw); + printf("assignment_operator: %d\r\n", assign); +} + +/** + * @brief Compute arithmetic and increment operator results + * + * @param arith pointer to store multiplication result + * @param incr pointer to store post-increment result + * @param x left operand + * @param y right operand + * @retval None + */ +static void compute_arithmetic_ops(int *arith, int *incr, int x, int y) { + *arith = (x * y); + *incr = x++; +} + +/** + * @brief Compute all operator values and print results + * + * @details Performs arithmetic, relational, logical, bitwise, + * and assignment operations, then prints each result. + * + * @retval None + */ +static void compute_operators(void) { + int x = 5, y = 10; + int arith, incr; + compute_arithmetic_ops(&arith, &incr, x, y); + bool rel = (x > y); + bool logic = (x > y) && (y > x); + int bits = (x << 1); + int assign = (x += 5); + print_operator_results(arith, incr, rel, logic, bits, assign); +} + +/** + * @brief Read and print DHT11 humidity and temperature + * + * @details Attempts a DHT11 read; on success prints humidity and + * temperature, on failure prints an error message. + * + * @retval None + */ +static void print_dht11_reading(void) { + float hum, temp; + if (dht11_read(&hum, &temp)) { + printf("Humidity: %.1f%%, Temperature: %.1f°C\r\n", hum, temp); + } else { + printf("DHT11 read failed\r\n"); + } +} + int main(void) { stdio_init_all(); - dht11_init(4); - - int x = 5; - int y = 10; - int arithmetic_operator = (x * y); - int increment_operator = x++; - bool relational_operator = (x > y); - bool logical_operator = (x > y) && (y > x); - int bitwise_operator = (x<<1); // x is now 6 because of x++ or 0b00000110 and (x<<1) is 0b00001100 or 12 - int assignment_operator = (x += 5); - while (true) { - printf("arithmetic_operator: %d\r\n", arithmetic_operator); - printf("increment_operator: %d\r\n", increment_operator); - printf("relational_operator: %d\r\n", relational_operator); - printf("logical_operator: %d\r\n", logical_operator); - printf("bitwise_operator: %d\r\n", bitwise_operator); - printf("assignment_operator: %d\r\n", assignment_operator); - - float hum, temp; - if (dht11_read(&hum, &temp)) { - printf("Humidity: %.1f%%, Temperature: %.1f°C\r\n", hum, temp); - } else { - printf("DHT11 read failed\r\n"); - } - + compute_operators(); + print_dht11_reading(); sleep_ms(2000); } } \ No newline at end of file diff --git a/0x001a_operators/dht11.c b/0x001a_operators/dht11.c index 9a52ba8..28f147f 100644 --- a/0x001a_operators/dht11.c +++ b/0x001a_operators/dht11.c @@ -31,8 +31,97 @@ #include "hardware/gpio.h" #include "pico/time.h" +/** @brief GPIO pin connected to the DHT11 sensor */ static uint dht_pin; +/** + * @brief Send the DHT11 start signal on the data pin + * + * Drives the pin LOW for 18 ms then HIGH for 40 us before switching + * the pin to input mode to listen for the sensor response. + */ +static void send_start_signal(void) { + gpio_set_dir(dht_pin, GPIO_OUT); + gpio_put(dht_pin, 0); + sleep_ms(18); + gpio_put(dht_pin, 1); + sleep_us(40); + gpio_set_dir(dht_pin, GPIO_IN); +} + +/** + * @brief Wait for the pin to leave a given logic level + * + * Spins until the pin no longer reads the specified level, returning + * false if a timeout of 10 000 iterations is exceeded. + * + * @param level Logic level to wait through (0 or 1) + * @return bool true once the level changed, false on timeout + */ +static bool wait_for_level(int level) { + uint32_t timeout = 10000; + while (gpio_get(dht_pin) == level) + if (--timeout == 0) return false; + return true; +} + +/** + * @brief Wait for the DHT11 response after the start signal + * + * The sensor pulls LOW then HIGH then LOW again; each transition + * is awaited with a timeout. + * + * @return bool true if the full response was received, false on timeout + */ +static bool wait_response(void) { + if (!wait_for_level(1)) return false; + if (!wait_for_level(0)) return false; + if (!wait_for_level(1)) return false; + return true; +} + +/** + * @brief Read a single bit from the DHT11 data stream + * + * Waits for the low-period to end, measures the high-period duration, + * and shifts the result into the appropriate byte of the data array. + * + * @param data 5-byte array accumulating the received bits + * @param i Bit index (0-39) + * @return bool true on success, false on timeout + */ +static bool read_bit(uint8_t *data, int i) { + if (!wait_for_level(0)) return false; + uint32_t start = time_us_32(); + if (!wait_for_level(1)) return false; + uint32_t duration = time_us_32() - start; + data[i / 8] <<= 1; + if (duration > 40) data[i / 8] |= 1; + return true; +} + +/** + * @brief Read all 40 data bits from the DHT11 + * + * @param data 5-byte array filled with the received data + * @return bool true if all 40 bits were read, false on timeout + */ +static bool read_40_bits(uint8_t *data) { + for (int i = 0; i < 40; i++) + if (!read_bit(data, i)) return false; + return true; +} + +/** + * @brief Verify the DHT11 checksum byte + * + * @param data 5-byte received data (bytes 0-3 plus checksum in byte 4) + * @return bool true if the checksum matches, false otherwise + */ +static bool validate_checksum(const uint8_t *data) { + return data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF); +} + void dht11_init(uint8_t pin) { dht_pin = pin; gpio_init(pin); @@ -41,38 +130,10 @@ void dht11_init(uint8_t pin) { bool dht11_read(float *humidity, float *temperature) { uint8_t data[5] = {0}; - - // Start signal - gpio_set_dir(dht_pin, GPIO_OUT); - gpio_put(dht_pin, 0); - sleep_ms(18); - gpio_put(dht_pin, 1); - sleep_us(40); - gpio_set_dir(dht_pin, GPIO_IN); - - // Wait for response - uint32_t timeout = 10000; - while (gpio_get(dht_pin) == 1) if (--timeout == 0) return false; - timeout = 10000; - while (gpio_get(dht_pin) == 0) if (--timeout == 0) return false; - timeout = 10000; - while (gpio_get(dht_pin) == 1) if (--timeout == 0) return false; - - // Read 40 bits - for (int i = 0; i < 40; i++) { - timeout = 10000; - while (gpio_get(dht_pin) == 0) if (--timeout == 0) return false; - uint32_t start = time_us_32(); - timeout = 10000; - while (gpio_get(dht_pin) == 1) if (--timeout == 0) return false; - uint32_t duration = time_us_32() - start; - data[i / 8] <<= 1; - if (duration > 40) data[i / 8] |= 1; - } - - // Check checksum - if (data[4] != ((data[0] + data[1] + data[2] + data[3]) & 0xFF)) return false; - + send_start_signal(); + if (!wait_response()) return false; + if (!read_40_bits(data)) return false; + if (!validate_checksum(data)) return false; *humidity = data[0] + data[1] * 0.1f; *temperature = data[2] + data[3] * 0.1f; return true; diff --git a/0x001d_static-conditionals/0x001d_static-conditionals.c b/0x001d_static-conditionals/0x001d_static-conditionals.c index 8ad9328..6db9a5e 100644 --- a/0x001d_static-conditionals/0x001d_static-conditionals.c +++ b/0x001d_static-conditionals/0x001d_static-conditionals.c @@ -1,39 +1,106 @@ +/** + * @file 0x001d_static-conditionals.c + * @brief Static conditionals: if/else and switch with servo sweep + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates static (compile-time known) conditionals using if/else if/else + * and switch/case statements. Also sweeps a servo on GPIO6 between 0 and + * 180 degrees each iteration. + * + * Wiring: + * GPIO6 -> Servo signal wire (orange/white) + * 5V -> Servo VCC (red) + * GND -> Servo GND (brown/black) + */ + #include #include "pico/stdlib.h" #include "servo.h" +/** @brief GPIO pin number for the servo */ #define SERVO_GPIO 6 +/** + * @brief Print choice value using if/else if/else conditional + * + * @details Prints "1", "2", or "?" depending on the choice value. + * + * @param choice integer value to evaluate + * @retval None + */ +static void print_if_else(int choice) { + if (choice == 1) { + printf("1\r\n"); + } else if (choice == 2) { + printf("2\r\n"); + } else { + printf("?\r\n"); + } +} + +/** + * @brief Print choice value using switch/case conditional + * + * @details Prints "one", "two", or "??" depending on the choice value. + * + * @param choice integer value to evaluate + * @retval None + */ +static void print_switch(int choice) { + switch (choice) { + case 1: printf("one\r\n"); break; + case 2: printf("two\r\n"); break; + default: printf("??\r\n"); + } +} + +/** + * @brief Sweep servo between 0 and 180 degrees + * + * @details Sets the servo to 0 degrees, waits 500ms, then sets + * to 180 degrees and waits 500ms. + * + * @retval None + */ +static void sweep_servo(void) { + servo_set_angle(0.0f); + sleep_ms(500); + servo_set_angle(180.0f); + sleep_ms(500); +} + int main(void) { stdio_init_all(); - int choice = 1; - servo_init(SERVO_GPIO); - while (true) { - if (choice == 1) { - printf("1\r\n"); - } else if (choice == 2) { - printf("2\r\n"); - } else { - printf("?\r\n"); - } - - switch (choice) { - case 1: - printf("one\r\n"); - break; - case 2: - printf("two\r\n"); - break; - default: - printf("??\r\n"); - } - - servo_set_angle(0.0f); - sleep_ms(500); - servo_set_angle(180.0f); - sleep_ms(500); + print_if_else(choice); + print_switch(choice); + sweep_servo(); } } \ No newline at end of file diff --git a/0x001d_static-conditionals/servo.c b/0x001d_static-conditionals/servo.c index ee48f0d..d0fefbd 100644 --- a/0x001d_static-conditionals/servo.c +++ b/0x001d_static-conditionals/servo.c @@ -32,46 +32,66 @@ #include "hardware/pwm.h" #include "hardware/clocks.h" -// Default servo pulse range (SG90 typical) +/** @brief Default minimum pulse width in microseconds */ static const uint16_t SERVO_DEFAULT_MIN_US = 1000; +/** @brief Default maximum pulse width in microseconds */ static const uint16_t SERVO_DEFAULT_MAX_US = 2000; -// internal state +/** @brief GPIO pin assigned to the servo */ static uint8_t servo_pin = 0; +/** @brief PWM hardware slice for the servo pin */ static uint servo_slice = 0; +/** @brief PWM channel within the servo slice */ static uint servo_chan = 0; -static uint32_t servo_wrap = 20000 - 1; // wrap to map microseconds for 50Hz +/** @brief PWM counter wrap value for 50 Hz servo */ +static uint32_t servo_wrap = 20000 - 1; +/** @brief Servo PWM frequency in Hz */ static float servo_hz = 50.0f; +/** @brief Flag indicating servo has been initialized */ +static bool servo_initialized = false; -// Convert microsecond pulse to PWM level based on wrap and frequency +/** + * @brief Convert a pulse width in microseconds to a PWM counter level + * + * Uses the configured PWM wrap and servo frequency to map pulse time + * into the channel compare value expected by the PWM hardware. + * + * @param pulse_us Pulse width in microseconds + * @return uint32_t PWM level suitable for pwm_set_chan_level() + */ static uint32_t pulse_us_to_level(uint32_t pulse_us) { - const float period_us = 1000000.0f / servo_hz; // 20000us + const float period_us = 1000000.0f / servo_hz; float counts_per_us = (servo_wrap + 1) / period_us; return (uint32_t)(pulse_us * counts_per_us + 0.5f); } -void servo_init(uint8_t pin) { - servo_pin = pin; - - // Configure GPIO for PWM - gpio_set_function(servo_pin, GPIO_FUNC_PWM); - servo_slice = pwm_gpio_to_slice_num(servo_pin); - servo_chan = pwm_gpio_to_channel(servo_pin); - +/** + * @brief Build and apply the PWM slice configuration for 50 Hz servo + * + * Computes the clock divider from the system clock to achieve the + * target servo frequency with the chosen wrap value, then starts + * the PWM slice. + */ +static void apply_servo_config(void) { pwm_config config = pwm_get_default_config(); - - // Calculate clock divider to achieve 50 Hz with our chosen wrap const uint32_t sys_clock_hz = clock_get_hz(clk_sys); float clock_div = (float)sys_clock_hz / (servo_hz * (servo_wrap + 1)); - pwm_config_set_clkdiv(&config, clock_div); pwm_config_set_wrap(&config, servo_wrap); pwm_init(servo_slice, &config, true); } +void servo_init(uint8_t pin) { + servo_pin = pin; + gpio_set_function(servo_pin, GPIO_FUNC_PWM); + servo_slice = pwm_gpio_to_slice_num(servo_pin); + servo_chan = pwm_gpio_to_channel(servo_pin); + apply_servo_config(); + servo_initialized = true; +} + void servo_set_pulse_us(uint16_t pulse_us) { - if (servo_pin == 0) return; // not initialized - // clamp to defaults + if (!servo_initialized) return; if (pulse_us < SERVO_DEFAULT_MIN_US) pulse_us = SERVO_DEFAULT_MIN_US; if (pulse_us > SERVO_DEFAULT_MAX_US) pulse_us = SERVO_DEFAULT_MAX_US; uint32_t level = pulse_us_to_level(pulse_us); @@ -81,9 +101,7 @@ void servo_set_pulse_us(uint16_t pulse_us) { void servo_set_angle(float degrees) { if (degrees < 0.0f) degrees = 0.0f; if (degrees > 180.0f) degrees = 180.0f; - // linear map 0..180 -> min_us..max_us float ratio = degrees / 180.0f; uint16_t pulse = (uint16_t)(SERVO_DEFAULT_MIN_US + ratio * (SERVO_DEFAULT_MAX_US - SERVO_DEFAULT_MIN_US) + 0.5f); servo_set_pulse_us(pulse); -} -# \ No newline at end of file +} \ No newline at end of file diff --git a/0x0020_dynamic-conditionals/0x0020_dynamic-conditionals.c b/0x0020_dynamic-conditionals/0x0020_dynamic-conditionals.c index 1bef42c..028fcd4 100644 --- a/0x0020_dynamic-conditionals/0x0020_dynamic-conditionals.c +++ b/0x0020_dynamic-conditionals/0x0020_dynamic-conditionals.c @@ -1,44 +1,111 @@ +/** + * @file 0x0020_dynamic-conditionals.c + * @brief Dynamic conditionals: UART input drives if/else and switch with servo + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates dynamic (runtime) conditionals using UART input via getchar(). + * Reads a character, evaluates it with if/else and switch/case, and controls + * a servo on GPIO6 based on the input ('1' or '2'). + * + * Wiring: + * GPIO6 -> Servo signal wire (orange/white) + * 5V -> Servo VCC (red) + * GND -> Servo GND (brown/black) + */ + #include #include "pico/stdlib.h" #include "servo.h" +/** @brief GPIO pin number for the servo */ #define SERVO_GPIO 6 +/** + * @brief Evaluate choice with if/else conditional and print result + * + * @details Compares against hex ASCII values 0x31 ('1') and 0x32 ('2'). + * + * @param choice character value received from UART + * @retval None + */ +static void eval_if_else(uint8_t choice) { + if (choice == 0x31) { + printf("1\r\n"); + } else if (choice == 0x32) { + printf("2\r\n"); + } else { + printf("??\r\n"); + } +} + +/** + * @brief Sweep servo from start angle to end angle with a pause + * + * @details Sets the servo to start, waits 500 ms, sets to end, + * waits 500 ms. + * + * @param label text to print before sweeping + * @param start starting angle in degrees + * @param end ending angle in degrees + * @retval None + */ +static void sweep_servo(const char *label, float start, float end) { + printf("%s\r\n", label); + servo_set_angle(start); + sleep_ms(500); + servo_set_angle(end); + sleep_ms(500); +} + +/** + * @brief Process choice with switch/case and drive servo accordingly + * + * @details On '1', sweeps servo 0->180; on '2', sweeps 180->0; + * otherwise prints unknown. + * + * @param choice character value received from UART + * @retval None + */ +static void process_servo_command(uint8_t choice) { + switch (choice) { + case '1': sweep_servo("one", 0.0f, 180.0f); break; + case '2': sweep_servo("two", 180.0f, 0.0f); break; + default: printf("??\r\n"); + } +} + int main(void) { stdio_init_all(); - uint8_t choice = 0; - servo_init(SERVO_GPIO); - while (true) { choice = getchar(); - - if (choice == 0x31) { - printf("1\r\n"); - } else if (choice == 0x32) { - printf("2\r\n"); - } else { - printf("??\r\n"); - } - - switch (choice) { - case '1': - printf("one\r\n"); - servo_set_angle(0.0f); - sleep_ms(500); - servo_set_angle(180.0f); - sleep_ms(500); - break; - case '2': - printf("two\r\n"); - servo_set_angle(180.0f); - sleep_ms(500); - servo_set_angle(0.0f); - sleep_ms(500); - break; - default: - printf("??\r\n"); - } + eval_if_else(choice); + process_servo_command(choice); } } diff --git a/0x0020_dynamic-conditionals/servo.c b/0x0020_dynamic-conditionals/servo.c index ee48f0d..d0fefbd 100644 --- a/0x0020_dynamic-conditionals/servo.c +++ b/0x0020_dynamic-conditionals/servo.c @@ -32,46 +32,66 @@ #include "hardware/pwm.h" #include "hardware/clocks.h" -// Default servo pulse range (SG90 typical) +/** @brief Default minimum pulse width in microseconds */ static const uint16_t SERVO_DEFAULT_MIN_US = 1000; +/** @brief Default maximum pulse width in microseconds */ static const uint16_t SERVO_DEFAULT_MAX_US = 2000; -// internal state +/** @brief GPIO pin assigned to the servo */ static uint8_t servo_pin = 0; +/** @brief PWM hardware slice for the servo pin */ static uint servo_slice = 0; +/** @brief PWM channel within the servo slice */ static uint servo_chan = 0; -static uint32_t servo_wrap = 20000 - 1; // wrap to map microseconds for 50Hz +/** @brief PWM counter wrap value for 50 Hz servo */ +static uint32_t servo_wrap = 20000 - 1; +/** @brief Servo PWM frequency in Hz */ static float servo_hz = 50.0f; +/** @brief Flag indicating servo has been initialized */ +static bool servo_initialized = false; -// Convert microsecond pulse to PWM level based on wrap and frequency +/** + * @brief Convert a pulse width in microseconds to a PWM counter level + * + * Uses the configured PWM wrap and servo frequency to map pulse time + * into the channel compare value expected by the PWM hardware. + * + * @param pulse_us Pulse width in microseconds + * @return uint32_t PWM level suitable for pwm_set_chan_level() + */ static uint32_t pulse_us_to_level(uint32_t pulse_us) { - const float period_us = 1000000.0f / servo_hz; // 20000us + const float period_us = 1000000.0f / servo_hz; float counts_per_us = (servo_wrap + 1) / period_us; return (uint32_t)(pulse_us * counts_per_us + 0.5f); } -void servo_init(uint8_t pin) { - servo_pin = pin; - - // Configure GPIO for PWM - gpio_set_function(servo_pin, GPIO_FUNC_PWM); - servo_slice = pwm_gpio_to_slice_num(servo_pin); - servo_chan = pwm_gpio_to_channel(servo_pin); - +/** + * @brief Build and apply the PWM slice configuration for 50 Hz servo + * + * Computes the clock divider from the system clock to achieve the + * target servo frequency with the chosen wrap value, then starts + * the PWM slice. + */ +static void apply_servo_config(void) { pwm_config config = pwm_get_default_config(); - - // Calculate clock divider to achieve 50 Hz with our chosen wrap const uint32_t sys_clock_hz = clock_get_hz(clk_sys); float clock_div = (float)sys_clock_hz / (servo_hz * (servo_wrap + 1)); - pwm_config_set_clkdiv(&config, clock_div); pwm_config_set_wrap(&config, servo_wrap); pwm_init(servo_slice, &config, true); } +void servo_init(uint8_t pin) { + servo_pin = pin; + gpio_set_function(servo_pin, GPIO_FUNC_PWM); + servo_slice = pwm_gpio_to_slice_num(servo_pin); + servo_chan = pwm_gpio_to_channel(servo_pin); + apply_servo_config(); + servo_initialized = true; +} + void servo_set_pulse_us(uint16_t pulse_us) { - if (servo_pin == 0) return; // not initialized - // clamp to defaults + if (!servo_initialized) return; if (pulse_us < SERVO_DEFAULT_MIN_US) pulse_us = SERVO_DEFAULT_MIN_US; if (pulse_us > SERVO_DEFAULT_MAX_US) pulse_us = SERVO_DEFAULT_MAX_US; uint32_t level = pulse_us_to_level(pulse_us); @@ -81,9 +101,7 @@ void servo_set_pulse_us(uint16_t pulse_us) { void servo_set_angle(float degrees) { if (degrees < 0.0f) degrees = 0.0f; if (degrees > 180.0f) degrees = 180.0f; - // linear map 0..180 -> min_us..max_us float ratio = degrees / 180.0f; uint16_t pulse = (uint16_t)(SERVO_DEFAULT_MIN_US + ratio * (SERVO_DEFAULT_MAX_US - SERVO_DEFAULT_MIN_US) + 0.5f); servo_set_pulse_us(pulse); -} -# \ No newline at end of file +} \ No newline at end of file diff --git a/0x0023_structures/0x0023_structures.c b/0x0023_structures/0x0023_structures.c index fd802cc..a66d3be 100644 --- a/0x0023_structures/0x0023_structures.c +++ b/0x0023_structures/0x0023_structures.c @@ -1,8 +1,50 @@ +/** + * @file 0x0023_structures.c + * @brief Structures: IR remote controls LEDs via a struct-based controller + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates C structures by defining a simple_led_ctrl_t to manage three + * LEDs. An IR receiver on GPIO5 decodes NEC commands and activates the + * corresponding LED (0x0C -> GPIO16, 0x18 -> GPIO17, 0x5E -> GPIO18). + * + * Wiring: + * GPIO5 -> IR receiver OUT + * GPIO16 -> LED1 anode (with current-limiting resistor to GND) + * GPIO17 -> LED2 anode (with current-limiting resistor to GND) + * GPIO18 -> LED3 anode (with current-limiting resistor to GND) + */ + #include #include #include "pico/stdlib.h" #include "ir.h" +/** @brief GPIO pin number for the IR receiver */ #define IR_PIN 5 typedef struct { @@ -14,48 +56,85 @@ typedef struct { bool led3_state; } simple_led_ctrl_t; -int main(void) { - stdio_init_all(); +/** + * @brief Initialize all three LED GPIO pins as outputs + * + * @details Configures led1_pin, led2_pin, and led3_pin from the + * structure as GPIO outputs. + * + * @param leds pointer to the LED controller structure + * @retval None + */ +static void init_led_gpios(simple_led_ctrl_t *leds) { + gpio_init(leds->led1_pin); + gpio_set_dir(leds->led1_pin, GPIO_OUT); + gpio_init(leds->led2_pin); + gpio_set_dir(leds->led2_pin, GPIO_OUT); + gpio_init(leds->led3_pin); + gpio_set_dir(leds->led3_pin, GPIO_OUT); +} - simple_led_ctrl_t leds = { - .led1_pin = 16, - .led2_pin = 17, - .led3_pin = 18, - .led1_state = false, - .led2_state = false, - .led3_state = false - }; +/** + * @brief Process an NEC IR key and update LED states + * + * @details Maps NEC command codes to LEDs: 0x0C -> LED1, 0x18 -> LED2, + * 0x5E -> LED3. Turns off all LEDs first, then activates the match. + * + * @param leds pointer to the LED controller structure + * @param key NEC command code from IR receiver + * @retval None + */ +static void process_ir_key(simple_led_ctrl_t *leds, int key) { + printf("NEC command: 0x%02X\n", key); + leds->led1_state = (key == 0x0C); + leds->led2_state = (key == 0x18); + leds->led3_state = (key == 0x5E); + gpio_put(leds->led1_pin, leds->led1_state); + gpio_put(leds->led2_pin, leds->led2_state); + gpio_put(leds->led3_pin, leds->led3_state); + sleep_ms(10); +} - gpio_init(leds.led1_pin); gpio_set_dir(leds.led1_pin, GPIO_OUT); - gpio_init(leds.led2_pin); gpio_set_dir(leds.led2_pin, GPIO_OUT); - gpio_init(leds.led3_pin); gpio_set_dir(leds.led3_pin, GPIO_OUT); - - ir_init(IR_PIN); - printf("IR receiver on GPIO %d ready\n", IR_PIN); - - while (true) { - int key = ir_getkey(); - if (key >= 0) { - printf("NEC command: 0x%02X\n", key); - - // turn all off first - leds.led1_state = false; - leds.led2_state = false; - leds.led3_state = false; - - // check NEC codes - if (key == 0x0C) leds.led1_state = true; // GPIO16 - if (key == 0x18) leds.led2_state = true; // GPIO17 - if (key == 0x5E) leds.led3_state = true; // GPIO18 - - // apply states - gpio_put(leds.led1_pin, leds.led1_state); - gpio_put(leds.led2_pin, leds.led2_state); - gpio_put(leds.led3_pin, leds.led3_state); - - sleep_ms(10); - } else { - sleep_ms(1); - } +/** + * @brief Poll IR receiver and dispatch key to handler + * + * @details Reads one IR key; if valid, processes it; otherwise + * yields with a short sleep. + * + * @param leds pointer to the LED controller structure + * @retval None + */ +static void poll_ir(simple_led_ctrl_t *leds) { + int key = ir_getkey(); + if (key >= 0) { + process_ir_key(leds, key); + } else { + sleep_ms(1); + } +} + +/** + * @brief Build the default LED controller structure + * + * @details Initializes pins 16-18 with all LEDs off. + * + * @return simple_led_ctrl_t initialized structure + */ +static simple_led_ctrl_t make_default_leds(void) { + simple_led_ctrl_t leds = { + .led1_pin = 16, .led2_pin = 17, .led3_pin = 18, + .led1_state = false, .led2_state = false, .led3_state = false + }; + return leds; +} + +int main(void) { + stdio_init_all(); + simple_led_ctrl_t leds = make_default_leds(); + init_led_gpios(&leds); + ir_init(IR_PIN); + printf("IR receiver on GPIO %d ready\n", IR_PIN); + while (true) { + poll_ir(&leds); } } diff --git a/0x0023_structures/ir.c b/0x0023_structures/ir.c index b89bd4e..9d5b42a 100644 --- a/0x0023_structures/ir.c +++ b/0x0023_structures/ir.c @@ -32,19 +32,89 @@ #include "pico/time.h" #include "hardware/gpio.h" +/** @brief GPIO pin connected to the IR receiver */ static unsigned int ir_pin = 0; -// Wait for 'gpio' to reach 'level' or timeout (microseconds). Return elapsed us or -1. +/** + * @brief Wait for a GPIO pin to reach a given logic level + * + * Spins until the pin matches the requested level or a microsecond timeout + * is exceeded. Returns the elapsed time in microseconds, or -1 on timeout. + * + * @param gpio GPIO pin to monitor + * @param level Desired logic level (true = HIGH, false = LOW) + * @param timeout_us Maximum wait in microseconds + * @return int64_t Elapsed microseconds, or -1 on timeout + */ static int64_t wait_for_level(unsigned int gpio, bool level, uint32_t timeout_us) { absolute_time_t start = get_absolute_time(); while (gpio_get(gpio) != level) { - if (absolute_time_diff_us(start, get_absolute_time()) > (int64_t)timeout_us) { + if (absolute_time_diff_us(start, get_absolute_time()) > (int64_t)timeout_us) return -1; - } } return absolute_time_diff_us(start, get_absolute_time()); } +/** + * @brief Wait for the NEC 9 ms leader pulse and 4.5 ms space + * + * @return bool true if a valid leader was detected, false on timeout + */ +static bool wait_leader(void) { + if (wait_for_level(ir_pin, 0, 150000) < 0) return false; + int64_t t = wait_for_level(ir_pin, 1, 12000); + if (t < 8000 || t > 10000) return false; + t = wait_for_level(ir_pin, 0, 7000); + if (t < 3500 || t > 5000) return false; + return true; +} + +/** + * @brief Read a single NEC-encoded bit from the IR receiver + * + * Measures the mark/space timing and shifts the result into the + * appropriate byte of the data array. + * + * @param data 4-byte array accumulating received bits + * @param i Bit index (0-31) + * @return bool true on success, false on timeout or protocol error + */ +static bool read_nec_bit(uint8_t *data, int i) { + if (wait_for_level(ir_pin, 1, 1000) < 0) return false; + int64_t t = wait_for_level(ir_pin, 0, 2500); + if (t < 200) return false; + int byte_idx = i / 8; + int bit_idx = i % 8; + if (t > 1200) data[byte_idx] |= (1 << bit_idx); + return true; +} + +/** + * @brief Read all 32 data bits of an NEC frame + * + * @param data 4-byte array filled with the received address and command + * @return bool true if all 32 bits were read, false on timeout + */ +static bool read_32_bits(uint8_t *data) { + for (int i = 0; i < 32; ++i) + if (!read_nec_bit(data, i)) return false; + return true; +} + +/** + * @brief Validate an NEC frame and extract the command byte + * + * Checks that the address and command pairs are bitwise-inverted. + * + * @param data 4-byte NEC frame (addr, ~addr, cmd, ~cmd) + * @return int Command byte (0-255) on success, -1 on validation failure + */ +static int validate_nec_frame(const uint8_t *data) { + if ((uint8_t)(data[0] + data[1]) == 0xFF && (uint8_t)(data[2] + data[3]) == 0xFF) + return data[2]; + return -1; +} + void ir_init(uint8_t pin) { ir_pin = pin; gpio_init(pin); @@ -53,28 +123,8 @@ void ir_init(uint8_t pin) { } int ir_getkey(void) { - // leader low (~9 ms) - if (wait_for_level(ir_pin, 0, 150000) < 0) return -1; - - int64_t t = wait_for_level(ir_pin, 1, 12000); - if (t < 8000 || t > 10000) return -1; - - t = wait_for_level(ir_pin, 0, 7000); - if (t < 3500 || t > 5000) return -1; - + if (!wait_leader()) return -1; uint8_t data[4] = {0, 0, 0, 0}; - for (int i = 0; i < 32; ++i) { - if (wait_for_level(ir_pin, 1, 1000) < 0) return -1; - t = wait_for_level(ir_pin, 0, 2500); - if (t < 200) return -1; - int byte_idx = i / 8; - int bit_idx = i % 8; - if (t > 1200) data[byte_idx] |= (1 << bit_idx); // logical '1' - } - - // Validate address/data inverted pairs - if ((uint8_t)(data[0] + data[1]) == 0xFF && (uint8_t)(data[2] + data[3]) == 0xFF) { - return data[2]; - } - return -1; + if (!read_32_bits(data)) return -1; + return validate_nec_frame(data); } diff --git a/0x0026_functions/0x0026_functions.c b/0x0026_functions/0x0026_functions.c index 518f5c0..210c7cc 100644 --- a/0x0026_functions/0x0026_functions.c +++ b/0x0026_functions/0x0026_functions.c @@ -1,8 +1,50 @@ +/** + * @file 0x0026_functions.c + * @brief Functions: IR remote controls LEDs with helper function decomposition + * @author Kevin Thomas + * @date 2025 + * + * MIT License + * + * Copyright (c) 2025 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * ----------------------------------------------------------------------------- + * + * Demonstrates function decomposition by breaking IR-controlled LED logic + * into small, focused helper functions. An IR receiver on GPIO5 decodes + * NEC commands and activates the corresponding LED with a blink effect. + * + * Wiring: + * GPIO5 -> IR receiver OUT + * GPIO16 -> LED1 anode (with current-limiting resistor to GND) + * GPIO17 -> LED2 anode (with current-limiting resistor to GND) + * GPIO18 -> LED3 anode (with current-limiting resistor to GND) + */ + #include #include #include "pico/stdlib.h" #include "ir.h" +/** @brief GPIO pin number for the IR receiver */ #define IR_PIN 5 typedef struct { @@ -17,13 +59,13 @@ typedef struct { /** * @brief Map NEC IR command code to LED number * - * Translates a received NEC IR command code to a logical LED number. - * Supports three button mappings for controlling individual LEDs. + * @details Translates a received NEC IR command code to a logical + * LED number. Supports three button mappings. * * @param ir_command NEC command code from IR receiver - * @return int LED number (1-3) or 0 if no match + * @retval 1-3 for matched LED, 0 if no match */ -int ir_to_led_number(int ir_command) { +static int ir_to_led_number(int ir_command) { if (ir_command == 0x0C) return 1; if (ir_command == 0x18) return 2; if (ir_command == 0x5E) return 3; @@ -33,14 +75,14 @@ int ir_to_led_number(int ir_command) { /** * @brief Get GPIO pin number for a given LED number * - * Retrieves the GPIO pin associated with a logical LED number - * from the LED controller structure. + * @details Retrieves the GPIO pin associated with a logical LED + * number from the LED controller structure. * - * @param leds Pointer to LED controller structure + * @param leds pointer to LED controller structure * @param led_num LED number (1-3) - * @return uint8_t GPIO pin number or 0 if invalid + * @retval GPIO pin number or 0 if invalid */ -uint8_t get_led_pin(simple_led_ctrl_t *leds, int led_num) { +static uint8_t get_led_pin(simple_led_ctrl_t *leds, int led_num) { if (led_num == 1) return leds->led1_pin; if (led_num == 2) return leds->led2_pin; if (led_num == 3) return leds->led3_pin; @@ -50,11 +92,12 @@ uint8_t get_led_pin(simple_led_ctrl_t *leds, int led_num) { /** * @brief Turn off all LEDs in the controller * - * Sets all three LED GPIO outputs to low, turning off all LEDs. + * @details Sets all three LED GPIO outputs to low. * - * @param leds Pointer to LED controller structure + * @param leds pointer to LED controller structure + * @retval None */ -void leds_all_off(simple_led_ctrl_t *leds) { +static void leds_all_off(simple_led_ctrl_t *leds) { gpio_put(leds->led1_pin, false); gpio_put(leds->led2_pin, false); gpio_put(leds->led3_pin, false); @@ -63,14 +106,15 @@ void leds_all_off(simple_led_ctrl_t *leds) { /** * @brief Blink an LED pin a specified number of times * - * Toggles the specified GPIO pin on and off for the given count, - * with configurable delay between transitions. + * @details Toggles the specified GPIO pin on and off for the given + * count, with configurable delay between transitions. * - * @param pin GPIO pin number to blink - * @param count Number of blink cycles - * @param delay_ms Delay in milliseconds for on/off periods + * @param pin GPIO pin number to blink + * @param count number of blink cycles + * @param delay_ms delay in milliseconds for on/off periods + * @retval None */ -void blink_led(uint8_t pin, uint8_t count, uint32_t delay_ms) { +static void blink_led(uint8_t pin, uint8_t count, uint32_t delay_ms) { for (uint8_t i = 0; i < count; i++) { gpio_put(pin, true); sleep_ms(delay_ms); @@ -82,15 +126,15 @@ void blink_led(uint8_t pin, uint8_t count, uint32_t delay_ms) { /** * @brief Process IR command and activate corresponding LED * - * Handles incoming IR commands by turning off all LEDs, mapping the - * command to an LED, blinking it, then holding it steady. + * @details Turns off all LEDs, maps the command to an LED number, + * blinks it, then holds it steady. * - * @param ir_command NEC command code from IR receiver - * @param leds Pointer to LED controller structure - * @param blink_count Number of blinks before steady state - * @return int LED number activated (1-3), 0 if none, -1 if invalid + * @param ir_command NEC command code from IR receiver + * @param leds pointer to LED controller structure + * @param blink_count number of blinks before steady state + * @retval LED number activated (1-3), 0 if none, -1 if invalid */ -int process_ir_led_command(int ir_command, simple_led_ctrl_t *leds, uint8_t blink_count) { +static int process_ir_led_command(int ir_command, simple_led_ctrl_t *leds, uint8_t blink_count) { if (!leds || ir_command < 0) return -1; leds_all_off(leds); int led_num = ir_to_led_number(ir_command); @@ -101,49 +145,93 @@ int process_ir_led_command(int ir_command, simple_led_ctrl_t *leds, uint8_t blin return led_num; } -int main(void) { - stdio_init_all(); +/** + * @brief Initialize all three LED GPIO pins as outputs + * + * @details Configures led1_pin, led2_pin, and led3_pin from the + * structure as GPIO outputs. + * + * @param leds pointer to the LED controller structure + * @retval None + */ +static void init_led_gpios(simple_led_ctrl_t *leds) { + gpio_init(leds->led1_pin); + gpio_set_dir(leds->led1_pin, GPIO_OUT); + gpio_init(leds->led2_pin); + gpio_set_dir(leds->led2_pin, GPIO_OUT); + gpio_init(leds->led3_pin); + gpio_set_dir(leds->led3_pin, GPIO_OUT); +} - simple_led_ctrl_t leds = { - .led1_pin = 16, - .led2_pin = 17, - .led3_pin = 18, - .led1_state = false, - .led2_state = false, - .led3_state = false - }; +/** + * @brief Poll IR and handle a single received key + * + * @details Reads an IR key, processes the command with 3 blinks, + * and prints the result. + * + * @param leds pointer to the LED controller structure + * @retval None + */ +/** + * @brief Handle a valid IR key press + * + * @details Prints the NEC command, processes it with 3 blinks, + * and reports the activated LED. + * + * @param leds pointer to the LED controller structure + * @param key NEC command code + * @retval None + */ +static void handle_ir_key(simple_led_ctrl_t *leds, int key) { + printf("NEC command: 0x%02X\n", key); + int activated_led = process_ir_led_command(key, leds, 3); + if (activated_led > 0) { + printf("LED %d activated on GPIO %d\n", activated_led, + get_led_pin(leds, activated_led)); + } + sleep_ms(10); +} - // Initialize LED GPIOs - gpio_init(leds.led1_pin); gpio_set_dir(leds.led1_pin, GPIO_OUT); - gpio_init(leds.led2_pin); gpio_set_dir(leds.led2_pin, GPIO_OUT); - gpio_init(leds.led3_pin); gpio_set_dir(leds.led3_pin, GPIO_OUT); - - // Initialize IR receiver - ir_init(IR_PIN); - printf("IR receiver on GPIO %d ready\n", IR_PIN); - printf("Press remote buttons to control LEDs with blink effects!\n"); - - while (true) { - int key = ir_getkey(); - if (key >= 0) { - printf("NEC command: 0x%02X\n", key); - - // Process the IR command with 3 blinks before steady state - int activated_led = process_ir_led_command(key, &leds, 3); - - if (activated_led > 0) { - printf("LED %d activated on GPIO %d\n", activated_led, - (activated_led == 1) ? leds.led1_pin : - (activated_led == 2) ? leds.led2_pin : leds.led3_pin); - } else if (activated_led == 0) { - printf("No LED matched or chase effect played\n"); - } else { - printf("Invalid command or null pointer\n"); - } - - sleep_ms(10); - } else { - sleep_ms(1); - } +/** + * @brief Poll IR and handle a single received key + * + * @details Reads an IR key; if valid dispatches to handler, + * otherwise yields with a short sleep. + * + * @param leds pointer to the LED controller structure + * @retval None + */ +static void poll_and_handle_ir(simple_led_ctrl_t *leds) { + int key = ir_getkey(); + if (key >= 0) { + handle_ir_key(leds, key); + } else { + sleep_ms(1); + } +} + +/** + * @brief Build the default LED controller structure + * + * @details Initializes pins 16-18 with all LEDs off. + * + * @return simple_led_ctrl_t initialized structure + */ +static simple_led_ctrl_t make_default_leds(void) { + simple_led_ctrl_t leds = { + .led1_pin = 16, .led2_pin = 17, .led3_pin = 18, + .led1_state = false, .led2_state = false, .led3_state = false + }; + return leds; +} + +int main(void) { + stdio_init_all(); + simple_led_ctrl_t leds = make_default_leds(); + init_led_gpios(&leds); + ir_init(IR_PIN); + printf("IR receiver on GPIO %d ready\n", IR_PIN); + while (true) { + poll_and_handle_ir(&leds); } } diff --git a/0x0026_functions/ir.c b/0x0026_functions/ir.c index b89bd4e..9d5b42a 100644 --- a/0x0026_functions/ir.c +++ b/0x0026_functions/ir.c @@ -32,19 +32,89 @@ #include "pico/time.h" #include "hardware/gpio.h" +/** @brief GPIO pin connected to the IR receiver */ static unsigned int ir_pin = 0; -// Wait for 'gpio' to reach 'level' or timeout (microseconds). Return elapsed us or -1. +/** + * @brief Wait for a GPIO pin to reach a given logic level + * + * Spins until the pin matches the requested level or a microsecond timeout + * is exceeded. Returns the elapsed time in microseconds, or -1 on timeout. + * + * @param gpio GPIO pin to monitor + * @param level Desired logic level (true = HIGH, false = LOW) + * @param timeout_us Maximum wait in microseconds + * @return int64_t Elapsed microseconds, or -1 on timeout + */ static int64_t wait_for_level(unsigned int gpio, bool level, uint32_t timeout_us) { absolute_time_t start = get_absolute_time(); while (gpio_get(gpio) != level) { - if (absolute_time_diff_us(start, get_absolute_time()) > (int64_t)timeout_us) { + if (absolute_time_diff_us(start, get_absolute_time()) > (int64_t)timeout_us) return -1; - } } return absolute_time_diff_us(start, get_absolute_time()); } +/** + * @brief Wait for the NEC 9 ms leader pulse and 4.5 ms space + * + * @return bool true if a valid leader was detected, false on timeout + */ +static bool wait_leader(void) { + if (wait_for_level(ir_pin, 0, 150000) < 0) return false; + int64_t t = wait_for_level(ir_pin, 1, 12000); + if (t < 8000 || t > 10000) return false; + t = wait_for_level(ir_pin, 0, 7000); + if (t < 3500 || t > 5000) return false; + return true; +} + +/** + * @brief Read a single NEC-encoded bit from the IR receiver + * + * Measures the mark/space timing and shifts the result into the + * appropriate byte of the data array. + * + * @param data 4-byte array accumulating received bits + * @param i Bit index (0-31) + * @return bool true on success, false on timeout or protocol error + */ +static bool read_nec_bit(uint8_t *data, int i) { + if (wait_for_level(ir_pin, 1, 1000) < 0) return false; + int64_t t = wait_for_level(ir_pin, 0, 2500); + if (t < 200) return false; + int byte_idx = i / 8; + int bit_idx = i % 8; + if (t > 1200) data[byte_idx] |= (1 << bit_idx); + return true; +} + +/** + * @brief Read all 32 data bits of an NEC frame + * + * @param data 4-byte array filled with the received address and command + * @return bool true if all 32 bits were read, false on timeout + */ +static bool read_32_bits(uint8_t *data) { + for (int i = 0; i < 32; ++i) + if (!read_nec_bit(data, i)) return false; + return true; +} + +/** + * @brief Validate an NEC frame and extract the command byte + * + * Checks that the address and command pairs are bitwise-inverted. + * + * @param data 4-byte NEC frame (addr, ~addr, cmd, ~cmd) + * @return int Command byte (0-255) on success, -1 on validation failure + */ +static int validate_nec_frame(const uint8_t *data) { + if ((uint8_t)(data[0] + data[1]) == 0xFF && (uint8_t)(data[2] + data[3]) == 0xFF) + return data[2]; + return -1; +} + void ir_init(uint8_t pin) { ir_pin = pin; gpio_init(pin); @@ -53,28 +123,8 @@ void ir_init(uint8_t pin) { } int ir_getkey(void) { - // leader low (~9 ms) - if (wait_for_level(ir_pin, 0, 150000) < 0) return -1; - - int64_t t = wait_for_level(ir_pin, 1, 12000); - if (t < 8000 || t > 10000) return -1; - - t = wait_for_level(ir_pin, 0, 7000); - if (t < 3500 || t > 5000) return -1; - + if (!wait_leader()) return -1; uint8_t data[4] = {0, 0, 0, 0}; - for (int i = 0; i < 32; ++i) { - if (wait_for_level(ir_pin, 1, 1000) < 0) return -1; - t = wait_for_level(ir_pin, 0, 2500); - if (t < 200) return -1; - int byte_idx = i / 8; - int bit_idx = i % 8; - if (t > 1200) data[byte_idx] |= (1 << bit_idx); // logical '1' - } - - // Validate address/data inverted pairs - if ((uint8_t)(data[0] + data[1]) == 0xFF && (uint8_t)(data[2] + data[3]) == 0xFF) { - return data[2]; - } - return -1; + if (!read_32_bits(data)) return -1; + return validate_nec_frame(data); } diff --git a/drivers/0x01_uart_cbm/Inc/rp2350.h b/drivers/0x01_uart_cbm/Inc/rp2350.h index a6941e1..afce93e 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x01_uart_cbm/Inc/rp2350_reset.h b/drivers/0x01_uart_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350_reset.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x01_uart_cbm/Inc/rp2350_reset_handler.h b/drivers/0x01_uart_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x01_uart_cbm/Inc/rp2350_stack.h b/drivers/0x01_uart_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350_stack.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x01_uart_cbm/Inc/rp2350_uart.h b/drivers/0x01_uart_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350_uart.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x01_uart_cbm/Inc/rp2350_xosc.h b/drivers/0x01_uart_cbm/Inc/rp2350_xosc.h index d2d6523..41303ca 100644 --- a/drivers/0x01_uart_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x01_uart_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x01_uart_cbm/Src/image_def.c b/drivers/0x01_uart_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x01_uart_cbm/Src/image_def.c +++ b/drivers/0x01_uart_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x01_uart_cbm/Src/main.c b/drivers/0x01_uart_cbm/Src/main.c index f9d916d..c5b73dc 100644 --- a/drivers/0x01_uart_cbm/Src/main.c +++ b/drivers/0x01_uart_cbm/Src/main.c @@ -1,31 +1,40 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief UART demonstration: echo received characters in uppercase. - * - * Demonstrates hardware UART0 using the bare-metal UART driver. - * Characters typed into a terminal via a USB-to-UART adapter - * are echoed back in uppercase. - * - * Wiring: - * GPIO0 (TX) -> USB-to-UART adapter RX - * GPIO1 (RX) -> USB-to-UART adapter TX - * GND -> USB-to-UART adapter GND - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief UART demonstration: echo received characters in uppercase. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates hardware UART0 using the bare-metal UART driver. + * Characters typed into a terminal via a USB-to-UART adapter + * are echoed back in uppercase. + * + * Wiring: + * GPIO0 (TX) -> USB-to-UART adapter RX + * GPIO1 (RX) -> USB-to-UART adapter TX + * GND -> USB-to-UART adapter GND + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" int main(void) diff --git a/drivers/0x01_uart_cbm/Src/rp2350_reset.c b/drivers/0x01_uart_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x01_uart_cbm/Src/rp2350_reset.c +++ b/drivers/0x01_uart_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x01_uart_cbm/Src/rp2350_reset_handler.c b/drivers/0x01_uart_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x01_uart_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x01_uart_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x01_uart_cbm/Src/rp2350_stack.c b/drivers/0x01_uart_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x01_uart_cbm/Src/rp2350_stack.c +++ b/drivers/0x01_uart_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x01_uart_cbm/Src/rp2350_uart.c b/drivers/0x01_uart_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x01_uart_cbm/Src/rp2350_uart.c +++ b/drivers/0x01_uart_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x01_uart_cbm/Src/rp2350_xosc.c b/drivers/0x01_uart_cbm/Src/rp2350_xosc.c index a55dcc0..e4a58c2 100644 --- a/drivers/0x01_uart_cbm/Src/rp2350_xosc.c +++ b/drivers/0x01_uart_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x01_uart_cbm/Src/vector_table.c b/drivers/0x01_uart_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x01_uart_cbm/Src/vector_table.c +++ b/drivers/0x01_uart_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x02_blink_cbm/Inc/rp2350.h b/drivers/0x02_blink_cbm/Inc/rp2350.h index a6941e1..afce93e 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_delay.h b/drivers/0x02_blink_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_delay.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_gpio.h b/drivers/0x02_blink_cbm/Inc/rp2350_gpio.h index 4d20089..ca3595f 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_gpio.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_gpio.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_gpio.h - * @author Kevin Thomas - * @brief GPIO driver header for RP2350. - * - * SIO-based GPIO configuration, set, clear, toggle, and read - * functions for the RP2350 GPIO pins 0-29. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.h + * @brief GPIO driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration, set, clear, toggle, and read + * functions for the RP2350 GPIO pins 0-29. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_GPIO_H #define __RP2350_GPIO_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_led.h b/drivers/0x02_blink_cbm/Inc/rp2350_led.h index ba5f24c..12b56c3 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_led.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_led.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_led.h - * @author Kevin Thomas - * @brief LED driver header for RP2350. - * - * High-level GPIO output / LED driver wrapping the - * low-level GPIO functions. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.h + * @brief LED driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level GPIO output / LED driver wrapping the + * low-level GPIO functions. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_LED_H #define __RP2350_LED_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_reset.h b/drivers/0x02_blink_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_reset.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_reset_handler.h b/drivers/0x02_blink_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_stack.h b/drivers/0x02_blink_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_stack.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_uart.h b/drivers/0x02_blink_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_uart.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x02_blink_cbm/Inc/rp2350_xosc.h b/drivers/0x02_blink_cbm/Inc/rp2350_xosc.h index d2d6523..41303ca 100644 --- a/drivers/0x02_blink_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x02_blink_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x02_blink_cbm/Src/image_def.c b/drivers/0x02_blink_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x02_blink_cbm/Src/image_def.c +++ b/drivers/0x02_blink_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x02_blink_cbm/Src/main.c b/drivers/0x02_blink_cbm/Src/main.c index 9076282..bc4585f 100644 --- a/drivers/0x02_blink_cbm/Src/main.c +++ b/drivers/0x02_blink_cbm/Src/main.c @@ -1,30 +1,40 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief Blink demonstration: toggle onboard LED every 500 ms. - * - * Demonstrates GPIO output control using the blink driver. - * The onboard LED on GPIO 25 is toggled every 500 ms and the - * current state is reported over UART. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief Blink demonstration: toggle onboard LED every 500 ms. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates GPIO output control using the blink driver. + * The onboard LED on GPIO 25 is toggled every 500 ms and the + * current state is reported over UART. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_led.h" #include "rp2350_uart.h" #include "rp2350_delay.h" +/** @brief Delay between LED state toggles in milliseconds */ #define BLINK_DELAY_MS 500 /** diff --git a/drivers/0x02_blink_cbm/Src/rp2350_delay.c b/drivers/0x02_blink_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_delay.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x02_blink_cbm/Src/rp2350_gpio.c b/drivers/0x02_blink_cbm/Src/rp2350_gpio.c index b7c87f1..f2fdb20 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_gpio.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_gpio.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_gpio.c - * @author Kevin Thomas - * @brief GPIO driver implementation for RP2350. - * - * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 - * register structs defined in rp2350.h. All register offsets - * verified against the RP2350 datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.c + * @brief GPIO driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 + * register structs defined in rp2350.h. All register offsets + * verified against the RP2350 datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_gpio.h" /** diff --git a/drivers/0x02_blink_cbm/Src/rp2350_led.c b/drivers/0x02_blink_cbm/Src/rp2350_led.c index ebf2a76..633a6ca 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_led.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_led.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_led.c - * @author Kevin Thomas - * @brief LED driver implementation for RP2350. - * - * High-level wrapper around the GPIO driver for LED control. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.c + * @brief LED driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level wrapper around the GPIO driver for LED control. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_led.h" #include "rp2350_gpio.h" diff --git a/drivers/0x02_blink_cbm/Src/rp2350_reset.c b/drivers/0x02_blink_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_reset.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x02_blink_cbm/Src/rp2350_reset_handler.c b/drivers/0x02_blink_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x02_blink_cbm/Src/rp2350_stack.c b/drivers/0x02_blink_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_stack.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x02_blink_cbm/Src/rp2350_uart.c b/drivers/0x02_blink_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_uart.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x02_blink_cbm/Src/rp2350_xosc.c b/drivers/0x02_blink_cbm/Src/rp2350_xosc.c index a55dcc0..e4a58c2 100644 --- a/drivers/0x02_blink_cbm/Src/rp2350_xosc.c +++ b/drivers/0x02_blink_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x02_blink_cbm/Src/vector_table.c b/drivers/0x02_blink_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x02_blink_cbm/Src/vector_table.c +++ b/drivers/0x02_blink_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x03_button_cbm/Inc/rp2350.h b/drivers/0x03_button_cbm/Inc/rp2350.h index ff45209..bea038b 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350.h +++ b/drivers/0x03_button_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_button.h b/drivers/0x03_button_cbm/Inc/rp2350_button.h index a09a5ff..b7d7dc2 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_button.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_button.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_button.h - * @author Kevin Thomas - * @brief Button input driver header for RP2350. - * - * Push-button GPIO input driver with software debounce. - * The button pin is configured as active-low with internal - * pull-up; pressing the button connects the pin to GND. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_button.h + * @brief Button input driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Push-button GPIO input driver with software debounce. + * The button pin is configured as active-low with internal + * pull-up; pressing the button connects the pin to GND. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_BUTTON_H #define __RP2350_BUTTON_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_delay.h b/drivers/0x03_button_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_delay.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_gpio.h b/drivers/0x03_button_cbm/Inc/rp2350_gpio.h index a99f32f..93a116e 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_gpio.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_gpio.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_gpio.h - * @author Kevin Thomas - * @brief GPIO driver header for RP2350. - * - * SIO-based GPIO configuration, set, clear, toggle, and read - * functions for the RP2350 GPIO pins 0-29. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.h + * @brief GPIO driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration, set, clear, toggle, and read + * functions for the RP2350 GPIO pins 0-29. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_GPIO_H #define __RP2350_GPIO_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_led.h b/drivers/0x03_button_cbm/Inc/rp2350_led.h index ba5f24c..12b56c3 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_led.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_led.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_led.h - * @author Kevin Thomas - * @brief LED driver header for RP2350. - * - * High-level GPIO output / LED driver wrapping the - * low-level GPIO functions. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.h + * @brief LED driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level GPIO output / LED driver wrapping the + * low-level GPIO functions. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_LED_H #define __RP2350_LED_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_reset.h b/drivers/0x03_button_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_reset.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_reset_handler.h b/drivers/0x03_button_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_stack.h b/drivers/0x03_button_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_stack.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_uart.h b/drivers/0x03_button_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_uart.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x03_button_cbm/Inc/rp2350_xosc.h b/drivers/0x03_button_cbm/Inc/rp2350_xosc.h index d2d6523..41303ca 100644 --- a/drivers/0x03_button_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x03_button_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x03_button_cbm/Src/image_def.c b/drivers/0x03_button_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x03_button_cbm/Src/image_def.c +++ b/drivers/0x03_button_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x03_button_cbm/Src/main.c b/drivers/0x03_button_cbm/Src/main.c index acea024..96d6079 100644 --- a/drivers/0x03_button_cbm/Src/main.c +++ b/drivers/0x03_button_cbm/Src/main.c @@ -1,37 +1,48 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief Button demonstration: debounced press mirrors to LED + UART report. - * - * Demonstrates GPIO input using the button driver. The onboard - * LED mirrors the button state and every edge transition is - * reported over UART. - * - * Wiring: - * GPIO15 -> One leg of push button - * GND -> Other leg of push button - * GPIO25 -> Onboard LED (no external wiring needed) - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief Button demonstration: debounced press mirrors to LED + UART report. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates GPIO input using the button driver. The onboard + * LED mirrors the button state and every edge transition is + * reported over UART. + * + * Wiring: + * GPIO15 -> One leg of push button + * GND -> Other leg of push button + * GPIO25 -> Onboard LED (no external wiring needed) + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_button.h" #include "rp2350_led.h" #include "rp2350_uart.h" #include "rp2350_delay.h" +/** @brief Button debounce window in milliseconds */ #define DEBOUNCE_MS 20 +/** @brief Button polling interval in milliseconds */ #define POLL_DELAY_MS 10 /** diff --git a/drivers/0x03_button_cbm/Src/rp2350_button.c b/drivers/0x03_button_cbm/Src/rp2350_button.c index e3f7291..53c18d0 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_button.c +++ b/drivers/0x03_button_cbm/Src/rp2350_button.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_button.c - * @author Kevin Thomas - * @brief Button input driver implementation for RP2350. - * - * Configures a GPIO pin as an active-low input with internal - * pull-up and provides debounced press detection using a - * busy-wait confirmation delay. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_button.c + * @brief Button input driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures a GPIO pin as an active-low input with internal + * pull-up and provides debounced press detection using a + * busy-wait confirmation delay. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_button.h" #include "rp2350_gpio.h" #include "rp2350_delay.h" diff --git a/drivers/0x03_button_cbm/Src/rp2350_delay.c b/drivers/0x03_button_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_delay.c +++ b/drivers/0x03_button_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x03_button_cbm/Src/rp2350_gpio.c b/drivers/0x03_button_cbm/Src/rp2350_gpio.c index 640b4bf..4689ccd 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_gpio.c +++ b/drivers/0x03_button_cbm/Src/rp2350_gpio.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_gpio.c - * @author Kevin Thomas - * @brief GPIO driver implementation for RP2350. - * - * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 - * register structs defined in rp2350.h. All register offsets - * verified against the RP2350 datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.c + * @brief GPIO driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 + * register structs defined in rp2350.h. All register offsets + * verified against the RP2350 datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_gpio.h" /** diff --git a/drivers/0x03_button_cbm/Src/rp2350_led.c b/drivers/0x03_button_cbm/Src/rp2350_led.c index ebf2a76..633a6ca 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_led.c +++ b/drivers/0x03_button_cbm/Src/rp2350_led.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_led.c - * @author Kevin Thomas - * @brief LED driver implementation for RP2350. - * - * High-level wrapper around the GPIO driver for LED control. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.c + * @brief LED driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level wrapper around the GPIO driver for LED control. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_led.h" #include "rp2350_gpio.h" diff --git a/drivers/0x03_button_cbm/Src/rp2350_reset.c b/drivers/0x03_button_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_reset.c +++ b/drivers/0x03_button_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x03_button_cbm/Src/rp2350_reset_handler.c b/drivers/0x03_button_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x03_button_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x03_button_cbm/Src/rp2350_stack.c b/drivers/0x03_button_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_stack.c +++ b/drivers/0x03_button_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x03_button_cbm/Src/rp2350_uart.c b/drivers/0x03_button_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_uart.c +++ b/drivers/0x03_button_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x03_button_cbm/Src/rp2350_xosc.c b/drivers/0x03_button_cbm/Src/rp2350_xosc.c index a55dcc0..e4a58c2 100644 --- a/drivers/0x03_button_cbm/Src/rp2350_xosc.c +++ b/drivers/0x03_button_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x03_button_cbm/Src/vector_table.c b/drivers/0x03_button_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x03_button_cbm/Src/vector_table.c +++ b/drivers/0x03_button_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350.h b/drivers/0x04_pwm_cbm/Inc/rp2350.h index 4fa343e..24af5bb 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_delay.h b/drivers/0x04_pwm_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_delay.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_gpio.h b/drivers/0x04_pwm_cbm/Inc/rp2350_gpio.h index 4d20089..ca3595f 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_gpio.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_gpio.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_gpio.h - * @author Kevin Thomas - * @brief GPIO driver header for RP2350. - * - * SIO-based GPIO configuration, set, clear, toggle, and read - * functions for the RP2350 GPIO pins 0-29. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.h + * @brief GPIO driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration, set, clear, toggle, and read + * functions for the RP2350 GPIO pins 0-29. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_GPIO_H #define __RP2350_GPIO_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_led.h b/drivers/0x04_pwm_cbm/Inc/rp2350_led.h index ba5f24c..12b56c3 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_led.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_led.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_led.h - * @author Kevin Thomas - * @brief LED driver header for RP2350. - * - * High-level GPIO output / LED driver wrapping the - * low-level GPIO functions. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.h + * @brief LED driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level GPIO output / LED driver wrapping the + * low-level GPIO functions. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_LED_H #define __RP2350_LED_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_pwm.h b/drivers/0x04_pwm_cbm/Inc/rp2350_pwm.h index 0774d7b..037d5f9 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_pwm.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_pwm.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_pwm.h - * @author Kevin Thomas - * @brief PWM driver header for RP2350. - * - * Provides PWM output on GPIO 25 (onboard LED) at approximately - * 1 kHz using PWM slice 4, channel B. Duty cycle is controllable - * from 0 to 100 percent. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_pwm.h + * @brief PWM driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides PWM output on GPIO 25 (onboard LED) at approximately + * 1 kHz using PWM slice 4, channel B. Duty cycle is controllable + * from 0 to 100 percent. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_PWM_H #define __RP2350_PWM_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_reset.h b/drivers/0x04_pwm_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_reset.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_reset_handler.h b/drivers/0x04_pwm_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_stack.h b/drivers/0x04_pwm_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_stack.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_uart.h b/drivers/0x04_pwm_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_uart.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x04_pwm_cbm/Inc/rp2350_xosc.h b/drivers/0x04_pwm_cbm/Inc/rp2350_xosc.h index d2d6523..41303ca 100644 --- a/drivers/0x04_pwm_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x04_pwm_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x04_pwm_cbm/Src/image_def.c b/drivers/0x04_pwm_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x04_pwm_cbm/Src/image_def.c +++ b/drivers/0x04_pwm_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x04_pwm_cbm/Src/main.c b/drivers/0x04_pwm_cbm/Src/main.c index 34fdf70..f541c71 100644 --- a/drivers/0x04_pwm_cbm/Src/main.c +++ b/drivers/0x04_pwm_cbm/Src/main.c @@ -1,37 +1,48 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief PWM demonstration: LED breathing effect via duty-cycle sweep. - * - * Demonstrates PWM output using the PWM driver. A signal on - * GPIO 25 (onboard LED) sweeps its duty cycle from 0% to 100% - * and back to produce a smooth breathing effect. The current - * duty is reported over UART. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO25 -> Onboard LED (no external wiring needed) - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief PWM demonstration: LED breathing effect via duty-cycle sweep. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates PWM output using the PWM driver. A signal on + * GPIO 25 (onboard LED) sweeps its duty cycle from 0% to 100% + * and back to produce a smooth breathing effect. The current + * duty is reported over UART. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO25 -> Onboard LED (no external wiring needed) + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_pwm.h" #include "rp2350_uart.h" #include "rp2350_delay.h" +/** @brief PWM duty cycle increment per step */ #define SWEEP_STEP 5 +/** @brief Delay between PWM sweep steps in milliseconds */ #define SWEEP_DELAY_MS 50 /** @@ -40,7 +51,7 @@ * @param buf output buffer (at least 4 bytes) * @retval None */ -static void _uint8_to_str(uint8_t value, char *buf) +static void uint8_to_str(uint8_t value, char *buf) { uint8_t idx = 0; if (value >= 100) @@ -59,7 +70,7 @@ static void _uint8_to_str(uint8_t value, char *buf) static void print_duty(uint8_t duty) { char buf[4]; - _uint8_to_str(duty, buf); + uint8_to_str(duty, buf); uart_puts("Duty: "); uart_puts(buf); uart_puts("%\r\n"); diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_delay.c b/drivers/0x04_pwm_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_delay.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_gpio.c b/drivers/0x04_pwm_cbm/Src/rp2350_gpio.c index b7c87f1..f2fdb20 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_gpio.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_gpio.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_gpio.c - * @author Kevin Thomas - * @brief GPIO driver implementation for RP2350. - * - * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 - * register structs defined in rp2350.h. All register offsets - * verified against the RP2350 datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.c + * @brief GPIO driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 + * register structs defined in rp2350.h. All register offsets + * verified against the RP2350 datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_gpio.h" /** diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_led.c b/drivers/0x04_pwm_cbm/Src/rp2350_led.c index ebf2a76..633a6ca 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_led.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_led.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_led.c - * @author Kevin Thomas - * @brief LED driver implementation for RP2350. - * - * High-level wrapper around the GPIO driver for LED control. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.c + * @brief LED driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level wrapper around the GPIO driver for LED control. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_led.h" #include "rp2350_gpio.h" diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_pwm.c b/drivers/0x04_pwm_cbm/Src/rp2350_pwm.c index e06f24c..55c1c3e 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_pwm.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_pwm.c @@ -1,28 +1,38 @@ /** - ****************************************************************************** - * @file rp2350_pwm.c - * @author Kevin Thomas - * @brief PWM driver implementation for RP2350. - * - * Configures PWM slice 4, channel B on GPIO 25 (onboard LED). - * Uses a wrap value of 9999 with no clock division, yielding - * approximately 650 Hz from the ROSC system clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_pwm.c + * @brief PWM driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures PWM slice 4, channel B on GPIO 25 (onboard LED). + * Uses a wrap value of 9999 with no clock division, yielding + * approximately 650 Hz from the ROSC system clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_pwm.h" +/** @brief Base address pointer for PWM peripheral registers */ #define PWM ((volatile uint32_t *) PWM_BASE) /** diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_reset.c b/drivers/0x04_pwm_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_reset.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_reset_handler.c b/drivers/0x04_pwm_cbm/Src/rp2350_reset_handler.c index 32ef0df..25dfd35 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, PWM, then - * branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, PWM, then + * branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_stack.c b/drivers/0x04_pwm_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_stack.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_uart.c b/drivers/0x04_pwm_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_uart.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x04_pwm_cbm/Src/rp2350_xosc.c b/drivers/0x04_pwm_cbm/Src/rp2350_xosc.c index a55dcc0..e4a58c2 100644 --- a/drivers/0x04_pwm_cbm/Src/rp2350_xosc.c +++ b/drivers/0x04_pwm_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x04_pwm_cbm/Src/vector_table.c b/drivers/0x04_pwm_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x04_pwm_cbm/Src/vector_table.c +++ b/drivers/0x04_pwm_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x05_servo_cbm/Inc/rp2350.h b/drivers/0x05_servo_cbm/Inc/rp2350.h index fe9620c..e484a5a 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_delay.h b/drivers/0x05_servo_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_delay.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_gpio.h b/drivers/0x05_servo_cbm/Inc/rp2350_gpio.h index 4d20089..ca3595f 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_gpio.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_gpio.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_gpio.h - * @author Kevin Thomas - * @brief GPIO driver header for RP2350. - * - * SIO-based GPIO configuration, set, clear, toggle, and read - * functions for the RP2350 GPIO pins 0-29. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.h + * @brief GPIO driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration, set, clear, toggle, and read + * functions for the RP2350 GPIO pins 0-29. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_GPIO_H #define __RP2350_GPIO_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_led.h b/drivers/0x05_servo_cbm/Inc/rp2350_led.h index ba5f24c..12b56c3 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_led.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_led.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_led.h - * @author Kevin Thomas - * @brief LED driver header for RP2350. - * - * High-level GPIO output / LED driver wrapping the - * low-level GPIO functions. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.h + * @brief LED driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level GPIO output / LED driver wrapping the + * low-level GPIO functions. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_LED_H #define __RP2350_LED_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_reset.h b/drivers/0x05_servo_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_reset.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_reset_handler.h b/drivers/0x05_servo_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_servo.h b/drivers/0x05_servo_cbm/Inc/rp2350_servo.h index e005fea..15c41ac 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_servo.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_servo.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_servo.h - * @author Kevin Thomas - * @brief SG90 servo driver header for RP2350. - * - * PWM-based servo driver on GPIO 6 at 50 Hz. Supports pulse - * width control in microseconds and angle control in degrees. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_servo.h + * @brief SG90 servo driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * PWM-based servo driver on GPIO 6 at 50 Hz. Supports pulse + * width control in microseconds and angle control in degrees. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_SERVO_H #define __RP2350_SERVO_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_stack.h b/drivers/0x05_servo_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_stack.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_uart.h b/drivers/0x05_servo_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_uart.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x05_servo_cbm/Inc/rp2350_xosc.h b/drivers/0x05_servo_cbm/Inc/rp2350_xosc.h index d2d6523..41303ca 100644 --- a/drivers/0x05_servo_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x05_servo_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x05_servo_cbm/Src/image_def.c b/drivers/0x05_servo_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x05_servo_cbm/Src/image_def.c +++ b/drivers/0x05_servo_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x05_servo_cbm/Src/main.c b/drivers/0x05_servo_cbm/Src/main.c index 40119c8..4da0034 100644 --- a/drivers/0x05_servo_cbm/Src/main.c +++ b/drivers/0x05_servo_cbm/Src/main.c @@ -1,38 +1,49 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief SG90 servo motor sweep demonstration. - * - * Demonstrates servo control using the servo driver. The servo - * sweeps from 0 to 180 degrees and back in 10-degree steps, - * reporting each angle over UART. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO6 -> Servo signal (orange/yellow) - * 5V -> Servo power (red) - * GND -> Servo ground (brown/black) - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief SG90 servo motor sweep demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates servo control using the servo driver. The servo + * sweeps from 0 to 180 degrees and back in 10-degree steps, + * reporting each angle over UART. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO6 -> Servo signal (orange/yellow) + * 5V -> Servo power (red) + * GND -> Servo ground (brown/black) + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_servo.h" #include "rp2350_uart.h" #include "rp2350_delay.h" +/** @brief Servo angle increment per step in degrees */ #define STEP_DEGREES 10 +/** @brief Delay between servo sweep steps in milliseconds */ #define STEP_DELAY_MS 150 /** @@ -41,7 +52,7 @@ * @param buf output buffer (at least 4 bytes) * @retval None */ -static void _uint8_to_str(uint8_t value, char *buf) +static void uint8_to_str(uint8_t value, char *buf) { uint8_t idx = 0; if (value >= 100) @@ -60,7 +71,7 @@ static void _uint8_to_str(uint8_t value, char *buf) static void print_angle(uint8_t angle) { char buf[4]; - _uint8_to_str(angle, buf); + uint8_to_str(angle, buf); uart_puts("Angle: "); uart_puts(buf); uart_puts(" deg\r\n"); diff --git a/drivers/0x05_servo_cbm/Src/rp2350_delay.c b/drivers/0x05_servo_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_delay.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x05_servo_cbm/Src/rp2350_gpio.c b/drivers/0x05_servo_cbm/Src/rp2350_gpio.c index b7c87f1..f2fdb20 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_gpio.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_gpio.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_gpio.c - * @author Kevin Thomas - * @brief GPIO driver implementation for RP2350. - * - * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 - * register structs defined in rp2350.h. All register offsets - * verified against the RP2350 datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_gpio.c + * @brief GPIO driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * SIO-based GPIO configuration using IO_BANK0 and PADS_BANK0 + * register structs defined in rp2350.h. All register offsets + * verified against the RP2350 datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_gpio.h" /** diff --git a/drivers/0x05_servo_cbm/Src/rp2350_led.c b/drivers/0x05_servo_cbm/Src/rp2350_led.c index ebf2a76..633a6ca 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_led.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_led.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_led.c - * @author Kevin Thomas - * @brief LED driver implementation for RP2350. - * - * High-level wrapper around the GPIO driver for LED control. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_led.c + * @brief LED driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * High-level wrapper around the GPIO driver for LED control. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_led.h" #include "rp2350_gpio.h" diff --git a/drivers/0x05_servo_cbm/Src/rp2350_reset.c b/drivers/0x05_servo_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_reset.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x05_servo_cbm/Src/rp2350_reset_handler.c b/drivers/0x05_servo_cbm/Src/rp2350_reset_handler.c index 95d3868..adb5099 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, servo, then - * branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, servo, then + * branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x05_servo_cbm/Src/rp2350_servo.c b/drivers/0x05_servo_cbm/Src/rp2350_servo.c index 3009616..8841017 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_servo.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_servo.c @@ -1,28 +1,38 @@ /** - ****************************************************************************** - * @file rp2350_servo.c - * @author Kevin Thomas - * @brief SG90 servo driver implementation for RP2350. - * - * Configures PWM slice 3, channel A on GPIO 6 at 50 Hz for - * standard hobby servo control. Uses a wrap of 19999 and a - * clock divider of 12 (12 MHz XOSC / 50 Hz / 20000 = 12). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_servo.c + * @brief SG90 servo driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures PWM slice 3, channel A on GPIO 6 at 50 Hz for + * standard hobby servo control. Uses a wrap of 19999 and a + * clock divider of 12 (12 MHz XOSC / 50 Hz / 20000 = 12). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_servo.h" +/** @brief Base address pointer for PWM peripheral registers */ #define PWM ((volatile uint32_t *) PWM_BASE) /** diff --git a/drivers/0x05_servo_cbm/Src/rp2350_stack.c b/drivers/0x05_servo_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_stack.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x05_servo_cbm/Src/rp2350_uart.c b/drivers/0x05_servo_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_uart.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x05_servo_cbm/Src/rp2350_xosc.c b/drivers/0x05_servo_cbm/Src/rp2350_xosc.c index a55dcc0..e4a58c2 100644 --- a/drivers/0x05_servo_cbm/Src/rp2350_xosc.c +++ b/drivers/0x05_servo_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x05_servo_cbm/Src/vector_table.c b/drivers/0x05_servo_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x05_servo_cbm/Src/vector_table.c +++ b/drivers/0x05_servo_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x06_adc_cbm/Inc/rp2350.h b/drivers/0x06_adc_cbm/Inc/rp2350.h index ca17c12..bb5fdc2 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_adc.h b/drivers/0x06_adc_cbm/Inc/rp2350_adc.h index 6f9631d..4752831 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_adc.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_adc.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_adc.h - * @author Kevin Thomas - * @brief Header for RP2350 12-bit ADC driver. - * - * Provides functions to initialise the ADC peripheral, read an - * analog voltage in millivolts from GPIO26 (channel 0), and read - * the on-chip temperature sensor (channel 4) in tenths of degrees - * Celsius. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_adc.h + * @brief Header for RP2350 12-bit ADC driver. + * @author Kevin Thomas + * @date 2026 + * + * Provides functions to initialise the ADC peripheral, read an + * analog voltage in millivolts from GPIO26 (channel 0), and read + * the on-chip temperature sensor (channel 4) in tenths of degrees + * Celsius. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_ADC_H #define __RP2350_ADC_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_delay.h b/drivers/0x06_adc_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_delay.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_reset.h b/drivers/0x06_adc_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_reset.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_reset_handler.h b/drivers/0x06_adc_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_stack.h b/drivers/0x06_adc_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_stack.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_uart.h b/drivers/0x06_adc_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_uart.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x06_adc_cbm/Inc/rp2350_xosc.h b/drivers/0x06_adc_cbm/Inc/rp2350_xosc.h index 9202a9c..7dc643e 100644 --- a/drivers/0x06_adc_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x06_adc_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x06_adc_cbm/Src/image_def.c b/drivers/0x06_adc_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x06_adc_cbm/Src/image_def.c +++ b/drivers/0x06_adc_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x06_adc_cbm/Src/main.c b/drivers/0x06_adc_cbm/Src/main.c index f47d308..32ad0de 100644 --- a/drivers/0x06_adc_cbm/Src/main.c +++ b/drivers/0x06_adc_cbm/Src/main.c @@ -1,39 +1,49 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief ADC demonstration: potentiometer voltage and chip temperature. - * - * Demonstrates 12-bit ADC using the bare-metal ADC driver. Reads - * ADC channel 0 (GPIO26) and reports the voltage in millivolts - * alongside the on-chip temperature sensor reading every 500 ms - * over UART. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO26 -> Wiper of a 10 kohm potentiometer - * 3.3V -> One end of the potentiometer - * GND -> Other end of the potentiometer - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief ADC demonstration: potentiometer voltage and chip temperature. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates 12-bit ADC using the bare-metal ADC driver. Reads + * ADC channel 0 (GPIO26) and reports the voltage in millivolts + * alongside the on-chip temperature sensor reading every 500 ms + * over UART. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO26 -> Wiper of a 10 kohm potentiometer + * 3.3V -> One end of the potentiometer + * GND -> Other end of the potentiometer + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_adc.h" #include "rp2350_uart.h" #include "rp2350_xosc.h" #include "rp2350_delay.h" +/** @brief Delay between ADC samples in milliseconds */ #define SAMPLE_DELAY_MS 500 /** @@ -57,7 +67,7 @@ static void reverse(char *buf, uint8_t len) * @param val value to print * @retval None */ -static void _print_uint32(uint32_t val) +static void print_uint32(uint32_t val) { char buf[11]; uint8_t len = 0; @@ -75,7 +85,7 @@ static void _print_uint32(uint32_t val) static void print_temp(int32_t tenths) { if (tenths < 0) { uart_puts("-"); tenths = -tenths; } - _print_uint32((uint32_t)(tenths / 10)); + print_uint32((uint32_t)(tenths / 10)); char frac[2] = { (char)('0' + tenths % 10), '\0' }; uart_puts("."); uart_puts(frac); @@ -90,7 +100,7 @@ static void print_readings(void) uint32_t mv = adc_read_mv(); int32_t temp = adc_read_temp_tenths(); uart_puts("ADC0: "); - _print_uint32(mv); + print_uint32(mv); uart_puts(" mV | Chip temp: "); print_temp(temp); uart_puts(" C\r\n"); diff --git a/drivers/0x06_adc_cbm/Src/rp2350_adc.c b/drivers/0x06_adc_cbm/Src/rp2350_adc.c index 4049f15..94087a1 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_adc.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_adc.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_adc.c - * @author Kevin Thomas - * @brief RP2350 12-bit ADC driver implementation. - * - * Bare-metal driver for the RP2350 ADC peripheral. Reads analog - * voltage on GPIO26 (channel 0) and the on-chip temperature sensor - * (channel 4). All register accesses verified against the RP2350 - * datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_adc.c + * @brief RP2350 12-bit ADC driver implementation. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal driver for the RP2350 ADC peripheral. Reads analog + * voltage on GPIO26 (channel 0) and the on-chip temperature sensor + * (channel 4). All register accesses verified against the RP2350 + * datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_adc.h" static uint8_t active_channel = 0; diff --git a/drivers/0x06_adc_cbm/Src/rp2350_delay.c b/drivers/0x06_adc_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_delay.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x06_adc_cbm/Src/rp2350_reset.c b/drivers/0x06_adc_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_reset.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x06_adc_cbm/Src/rp2350_reset_handler.c b/drivers/0x06_adc_cbm/Src/rp2350_reset_handler.c index eac8526..f4043a1 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, ADC, then - * branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, ADC, then + * branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x06_adc_cbm/Src/rp2350_stack.c b/drivers/0x06_adc_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_stack.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x06_adc_cbm/Src/rp2350_uart.c b/drivers/0x06_adc_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_uart.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x06_adc_cbm/Src/rp2350_xosc.c b/drivers/0x06_adc_cbm/Src/rp2350_xosc.c index 02afcc3..b100a45 100644 --- a/drivers/0x06_adc_cbm/Src/rp2350_xosc.c +++ b/drivers/0x06_adc_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x06_adc_cbm/Src/vector_table.c b/drivers/0x06_adc_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x06_adc_cbm/Src/vector_table.c +++ b/drivers/0x06_adc_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x07_i2c/i2c.c b/drivers/0x07_i2c/i2c.c index 98e5f2e..b1925a7 100644 --- a/drivers/0x07_i2c/i2c.c +++ b/drivers/0x07_i2c/i2c.c @@ -39,13 +39,13 @@ * @param port I2C port number (0 for i2c0, 1 for i2c1) * @return i2c_inst_t* Pointer to the corresponding I2C hardware instance */ -static i2c_inst_t *_get_i2c_inst(uint8_t port) { +static i2c_inst_t *get_i2c_inst(uint8_t port) { return port == 0 ? i2c0 : i2c1; } void i2c_driver_init(uint8_t port, uint32_t sda_pin, uint32_t scl_pin, uint32_t baud_hz) { - i2c_inst_t *inst = _get_i2c_inst(port); + i2c_inst_t *inst = get_i2c_inst(port); i2c_init(inst, baud_hz); gpio_set_function(sda_pin, GPIO_FUNC_I2C); gpio_set_function(scl_pin, GPIO_FUNC_I2C); @@ -54,7 +54,7 @@ void i2c_driver_init(uint8_t port, uint32_t sda_pin, uint32_t scl_pin, } bool i2c_driver_probe(uint8_t port, uint8_t addr) { - i2c_inst_t *inst = _get_i2c_inst(port); + i2c_inst_t *inst = get_i2c_inst(port); uint8_t dummy; return i2c_read_blocking(inst, addr, &dummy, 1, false) >= 0; } diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350.h b/drivers/0x07_i2c_cbm/Inc/rp2350.h index eb09eb0..49b8459 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_delay.h b/drivers/0x07_i2c_cbm/Inc/rp2350_delay.h index a7f6cb0..6860cf7 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_delay.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_delay.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond busy-wait delay calibrated for a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond busy-wait delay calibrated for a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_i2c.h b/drivers/0x07_i2c_cbm/Inc/rp2350_i2c.h index 4a76e9d..1b8c7f8 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_i2c.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_i2c.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_i2c.h - * @author Kevin Thomas - * @brief I2C driver header for RP2350. - * - * I2C1 master-mode driver at 100 kHz on SDA=GPIO2 / SCL=GPIO3. - * Provides init, probe, read, write, and bus scan functions. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_i2c.h + * @brief I2C driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * I2C1 master-mode driver at 100 kHz on SDA=GPIO2 / SCL=GPIO3. + * Provides init, probe, read, write, and bus scan functions. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_I2C_H #define __RP2350_I2C_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_reset.h b/drivers/0x07_i2c_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_reset.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_reset_handler.h b/drivers/0x07_i2c_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_stack.h b/drivers/0x07_i2c_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_stack.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_uart.h b/drivers/0x07_i2c_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_uart.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x07_i2c_cbm/Inc/rp2350_xosc.h b/drivers/0x07_i2c_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x07_i2c_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x07_i2c_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x07_i2c_cbm/Src/image_def.c b/drivers/0x07_i2c_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x07_i2c_cbm/Src/image_def.c +++ b/drivers/0x07_i2c_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x07_i2c_cbm/Src/main.c b/drivers/0x07_i2c_cbm/Src/main.c index 09d71e2..7821d8d 100644 --- a/drivers/0x07_i2c_cbm/Src/main.c +++ b/drivers/0x07_i2c_cbm/Src/main.c @@ -1,40 +1,50 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief I2C demonstration: scan all 7-bit addresses and report devices. - * - * Demonstrates I2C bus scanning using the bare-metal I2C driver. - * I2C1 is configured at 100 kHz on SDA=GPIO2 / SCL=GPIO3. A - * formatted hex table of all responding device addresses is - * printed over UART and repeated every 5 seconds. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO2 -> I2C device SDA (4.7 kohm pull-up to 3.3 V) - * GPIO3 -> I2C device SCL (4.7 kohm pull-up to 3.3 V) - * 3.3V -> I2C device VCC - * GND -> I2C device GND - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief I2C demonstration: scan all 7-bit addresses and report devices. + * @author Kevin Thomas + * @date 2026 + * + * Demonstrates I2C bus scanning using the bare-metal I2C driver. + * I2C1 is configured at 100 kHz on SDA=GPIO2 / SCL=GPIO3. A + * formatted hex table of all responding device addresses is + * printed over UART and repeated every 5 seconds. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO2 -> I2C device SDA (4.7 kohm pull-up to 3.3 V) + * GPIO3 -> I2C device SCL (4.7 kohm pull-up to 3.3 V) + * 3.3V -> I2C device VCC + * GND -> I2C device GND + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_i2c.h" #include "rp2350_uart.h" #include "rp2350_xosc.h" #include "rp2350_delay.h" +/** @brief Delay between I2C bus scans in milliseconds */ #define SCAN_DELAY_MS 5000 int main(void) diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_delay.c b/drivers/0x07_i2c_cbm/Src/rp2350_delay.c index 8788630..70d7f16 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_delay.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond delay calibrated for a 12 MHz clock - * (3600 loop iterations per millisecond). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond delay calibrated for a 12 MHz clock + * (3600 loop iterations per millisecond). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_i2c.c b/drivers/0x07_i2c_cbm/Src/rp2350_i2c.c index b18d7ad..554425f 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_i2c.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_i2c.c @@ -1,28 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_i2c.c - * @author Kevin Thomas - * @brief RP2350 I2C1 master-mode driver implementation. - * - * Bare-metal driver for the RP2350 Synopsys DW APB I2C controller. - * Configures I2C1 at 100 kHz on SDA=GPIO2 / SCL=GPIO3 with - * internal pull-ups. Provides address probing and bus scanning. - * All register accesses verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_i2c.c + * @brief RP2350 I2C1 master-mode driver implementation. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal driver for the RP2350 Synopsys DW APB I2C controller. + * Configures I2C1 at 100 kHz on SDA=GPIO2 / SCL=GPIO3 with + * internal pull-ups. Provides address probing and bus scanning. + * All register accesses verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_i2c.h" #include "rp2350_uart.h" @@ -34,7 +43,7 @@ * * @retval None */ -static void _i2c_config_pads(void) +static void i2c_config_pads(void) { uint32_t pad_val = (1U << PADS_BANK0_IE_SHIFT) | (1U << PADS_BANK0_PUE_SHIFT) | (1U << 4); PADS_BANK0->GPIO[I2C_SDA_PIN] = pad_val; @@ -45,7 +54,7 @@ static void _i2c_config_pads(void) * @brief Set GPIO2 and GPIO3 IO mux function to I2C (FUNCSEL=3). * @retval None */ -static void _i2c_config_gpio(void) +static void i2c_config_gpio(void) { IO_BANK0->GPIO[I2C_SDA_PIN].CTRL = IO_BANK0_CTRL_FUNCSEL_I2C; IO_BANK0->GPIO[I2C_SCL_PIN].CTRL = IO_BANK0_CTRL_FUNCSEL_I2C; @@ -59,7 +68,7 @@ static void _i2c_config_gpio(void) * * @retval None */ -static void _i2c_config_con(void) +static void i2c_config_con(void) { I2C1->CON = (1U << I2C_CON_MASTER_MODE_SHIFT) | (I2C_CON_SPEED_FAST << I2C_CON_SPEED_SHIFT) @@ -76,7 +85,7 @@ static void _i2c_config_con(void) * * @retval None */ -static void _i2c_config_timing(void) +static void i2c_config_timing(void) { I2C1->FS_SCL_HCNT = I2C_FS_SCL_HCNT_VAL; I2C1->FS_SCL_LCNT = I2C_FS_SCL_LCNT_VAL; @@ -89,7 +98,7 @@ static void _i2c_config_timing(void) * @param val byte value to print (0x00-0xFF) * @retval None */ -static void _print_hex8(uint8_t val) +static void print_hex8(uint8_t val) { const char hex[] = "0123456789ABCDEF"; char buf[3] = { hex[val >> 4], hex[val & 0x0F], '\0' }; @@ -108,7 +117,7 @@ static void print_probe_result(uint8_t addr) uart_puts(" "); } else if (i2c_probe(addr)) { - _print_hex8(addr); + print_hex8(addr); uart_puts(" "); } else { uart_puts("-- "); @@ -127,7 +136,7 @@ static void print_probe_result(uint8_t addr) */ static void print_scan_entry(uint8_t addr) { - if (addr % 16 == 0) { _print_hex8(addr); uart_puts(": "); } + if (addr % 16 == 0) { print_hex8(addr); uart_puts(": "); } print_probe_result(addr); if (addr % 16 == 15) uart_puts("\r\n"); @@ -142,13 +151,13 @@ void i2c_release_reset(void) void i2c_init(void) { - _i2c_config_pads(); - _i2c_config_gpio(); + i2c_config_pads(); + i2c_config_gpio(); I2C1->ENABLE = 0U; - _i2c_config_con(); + i2c_config_con(); I2C1->TX_TL = 0U; I2C1->RX_TL = 0U; - _i2c_config_timing(); + i2c_config_timing(); I2C1->ENABLE = 1U; } diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_reset.c b/drivers/0x07_i2c_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_reset.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_reset_handler.c b/drivers/0x07_i2c_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_stack.c b/drivers/0x07_i2c_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_stack.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_uart.c b/drivers/0x07_i2c_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_uart.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x07_i2c_cbm/Src/rp2350_xosc.c b/drivers/0x07_i2c_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x07_i2c_cbm/Src/rp2350_xosc.c +++ b/drivers/0x07_i2c_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x07_i2c_cbm/Src/vector_table.c b/drivers/0x07_i2c_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x07_i2c_cbm/Src/vector_table.c +++ b/drivers/0x07_i2c_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x08_lcd1602/lcd1602.c b/drivers/0x08_lcd1602/lcd1602.c index bef16e6..2ccfa06 100644 --- a/drivers/0x08_lcd1602/lcd1602.c +++ b/drivers/0x08_lcd1602/lcd1602.c @@ -39,7 +39,7 @@ * @param port I2C port number (0 for i2c0, 1 for i2c1) * @return i2c_inst_t* Pointer to the corresponding I2C hardware instance */ -static i2c_inst_t *_get_i2c_inst(uint8_t port) { +static i2c_inst_t *get_i2c_inst(uint8_t port) { return port == 0 ? i2c0 : i2c1; } @@ -88,7 +88,7 @@ static void pcf_pulse_enable(uint8_t data) { * @param nibble Lower 4 bits to write * @param mode 0 for command, non-zero for character data */ -static void _lcd_write4(uint8_t nibble, uint8_t mode) { +static void lcd_write4(uint8_t nibble, uint8_t mode) { uint8_t data = (nibble & 0x0F) << lcd_nibble_shift; data |= mode ? PIN_RS : 0; data |= lcd_backlight_mask; @@ -102,8 +102,8 @@ static void _lcd_write4(uint8_t nibble, uint8_t mode) { * @param mode 0 for command, non-zero for character data */ static void lcd_send(uint8_t value, uint8_t mode) { - _lcd_write4((value >> 4) & 0x0F, mode); - _lcd_write4(value & 0x0F, mode); + lcd_write4((value >> 4) & 0x0F, mode); + lcd_write4(value & 0x0F, mode); } /** @@ -116,7 +116,7 @@ static void lcd_send(uint8_t value, uint8_t mode) { */ static void lcd_store_config(uint8_t i2c_port, uint8_t pcf_addr, int nibble_shift, uint8_t backlight_mask) { - lcd_i2c = _get_i2c_inst(i2c_port); + lcd_i2c = get_i2c_inst(i2c_port); lcd_addr = pcf_addr; lcd_nibble_shift = nibble_shift; lcd_backlight_mask = backlight_mask; @@ -125,14 +125,14 @@ static void lcd_store_config(uint8_t i2c_port, uint8_t pcf_addr, /** * @brief Execute the HD44780 4-bit mode power-on reset sequence */ -static void _lcd_hd44780_reset(void) { - _lcd_write4(0x03, 0); +static void lcd_hd44780_reset(void) { + lcd_write4(0x03, 0); sleep_ms(5); - _lcd_write4(0x03, 0); + lcd_write4(0x03, 0); sleep_us(150); - _lcd_write4(0x03, 0); + lcd_write4(0x03, 0); sleep_us(150); - _lcd_write4(0x02, 0); + lcd_write4(0x02, 0); sleep_us(150); } @@ -142,7 +142,7 @@ static void _lcd_hd44780_reset(void) { * Sets 4-bit mode with 2 display lines, turns the display on with * cursor hidden, clears the screen, and selects left-to-right entry mode. */ -static void _lcd_hd44780_configure(void) { +static void lcd_hd44780_configure(void) { lcd_send(0x28, 0); lcd_send(0x0C, 0); lcd_send(0x01, 0); @@ -153,30 +153,14 @@ static void _lcd_hd44780_configure(void) { void lcd_i2c_init(uint8_t i2c_port, uint8_t pcf_addr, int nibble_shift, uint8_t backlight_mask) { lcd_store_config(i2c_port, pcf_addr, nibble_shift, backlight_mask); - _lcd_hd44780_reset(); - _lcd_hd44780_configure(); + lcd_hd44780_reset(); + lcd_hd44780_configure(); } -/** - * @brief Initialize I2C bus and the LCD driver in one call - * - * Configures the I2C peripheral at the given baud rate, assigns GPIO - * alternate functions for SDA and SCL with internal pull-ups, and then - * performs the full HD44780 4-bit initialization sequence through the - * PCF8574 backpack. - * - * @param i2c_port I2C port number (0 for i2c0, 1 for i2c1) - * @param sda_pin GPIO pin number for SDA - * @param scl_pin GPIO pin number for SCL - * @param baud_hz I2C clock rate in Hz (e.g. 100000) - * @param pcf_addr PCF8574 I2C address (commonly 0x27 or 0x3F) - * @param nibble_shift Bit shift applied to 4-bit nibbles (commonly 4 or 0) - * @param backlight_mask PCF8574 bit mask that controls the backlight - */ void lcd_init(uint8_t i2c_port, uint32_t sda_pin, uint32_t scl_pin, uint32_t baud_hz, uint8_t pcf_addr, int nibble_shift, uint8_t backlight_mask) { - i2c_inst_t *i2c = _get_i2c_inst(i2c_port); + i2c_inst_t *i2c = get_i2c_inst(i2c_port); i2c_init(i2c, baud_hz); gpio_set_function(sda_pin, GPIO_FUNC_I2C); gpio_set_function(scl_pin, GPIO_FUNC_I2C); diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350.h index 5962d52..1438808 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_delay.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_delay.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_i2c.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_i2c.h index 7eca0d8..459c04d 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_i2c.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_i2c.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_i2c.h - * @author Kevin Thomas - * @brief I2C driver header for RP2350. - * - * I2C1 master-mode driver at 100 kHz on SDA=GPIO2 / SCL=GPIO3. - * Provides init, target selection, and single-byte write. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_i2c.h + * @brief I2C driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * I2C1 master-mode driver at 100 kHz on SDA=GPIO2 / SCL=GPIO3. + * Provides init, target selection, and single-byte write. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_I2C_H #define __RP2350_I2C_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_lcd1602.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_lcd1602.h index e5fb0dc..efc9a8e 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_lcd1602.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_lcd1602.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_lcd1602.h - * @author Kevin Thomas - * @brief LCD1602 driver header for RP2350. - * - * HD44780 16x2 LCD driver via PCF8574 I2C backpack. Uses I2C1 - * to communicate with the PCF8574 expander at address 0x27 in - * 4-bit mode with backlight control. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_lcd1602.h + * @brief LCD1602 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * HD44780 16x2 LCD driver via PCF8574 I2C backpack. Uses I2C1 + * to communicate with the PCF8574 expander at address 0x27 in + * 4-bit mode with backlight control. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_LCD1602_H #define __RP2350_LCD1602_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset_handler.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_stack.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_stack.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_uart.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_uart.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x08_lcd1602_cbm/Inc/rp2350_xosc.h b/drivers/0x08_lcd1602_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x08_lcd1602_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x08_lcd1602_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x08_lcd1602_cbm/Src/image_def.c b/drivers/0x08_lcd1602_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x08_lcd1602_cbm/Src/image_def.c +++ b/drivers/0x08_lcd1602_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x08_lcd1602_cbm/Src/main.c b/drivers/0x08_lcd1602_cbm/Src/main.c index 803ac90..5f7c405 100644 --- a/drivers/0x08_lcd1602_cbm/Src/main.c +++ b/drivers/0x08_lcd1602_cbm/Src/main.c @@ -1,41 +1,51 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief LCD1602 demonstration: static title and live counter display. - * - * Drives a 16x2 HD44780 LCD via a PCF8574 I2C backpack. Line 0 - * shows a static title ("Reverse Eng.") and line 1 displays a - * counter that increments every second. The counter value is - * also printed over UART for debugging. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO2 -> PCF8574 backpack SDA (4.7 kohm pull-up to 3.3 V) - * GPIO3 -> PCF8574 backpack SCL (4.7 kohm pull-up to 3.3 V) - * 3.3V -> PCF8574 backpack VCC - * GND -> PCF8574 backpack GND - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief LCD1602 demonstration: static title and live counter display. + * @author Kevin Thomas + * @date 2026 + * + * Drives a 16x2 HD44780 LCD via a PCF8574 I2C backpack. Line 0 + * shows a static title ("Reverse Eng.") and line 1 displays a + * counter that increments every second. The counter value is + * also printed over UART for debugging. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO2 -> PCF8574 backpack SDA (4.7 kohm pull-up to 3.3 V) + * GPIO3 -> PCF8574 backpack SCL (4.7 kohm pull-up to 3.3 V) + * 3.3V -> PCF8574 backpack VCC + * GND -> PCF8574 backpack GND + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_i2c.h" #include "rp2350_lcd1602.h" #include "rp2350_uart.h" #include "rp2350_xosc.h" #include "rp2350_delay.h" +/** @brief Delay between LCD counter updates in milliseconds */ #define COUNT_DELAY_MS 1000 /** diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_delay.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_delay.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_i2c.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_i2c.c index 3269fa1..5777b64 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_i2c.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_i2c.c @@ -1,28 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_i2c.c - * @author Kevin Thomas - * @brief RP2350 I2C1 master-mode driver implementation. - * - * Bare-metal driver for the RP2350 Synopsys DW APB I2C controller. - * Configures I2C1 at 100 kHz on SDA=GPIO2 / SCL=GPIO3 with - * internal pull-ups. Provides target selection and single-byte - * write. All register accesses verified against the RP2350 - * datasheet (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_i2c.c + * @brief RP2350 I2C1 master-mode driver implementation. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal driver for the RP2350 Synopsys DW APB I2C controller. + * Configures I2C1 at 100 kHz on SDA=GPIO2 / SCL=GPIO3 with + * internal pull-ups. Provides target selection and single-byte + * write. All register accesses verified against the RP2350 + * datasheet (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_i2c.h" /** @@ -33,7 +42,7 @@ * * @retval None */ -static void _i2c_config_pads(void) +static void i2c_config_pads(void) { uint32_t pad_val = (1U << PADS_BANK0_IE_SHIFT) | (1U << PADS_BANK0_PUE_SHIFT) | (1U << 4); PADS_BANK0->GPIO[I2C_SDA_PIN] = pad_val; @@ -44,7 +53,7 @@ static void _i2c_config_pads(void) * @brief Set GPIO2 and GPIO3 IO mux function to I2C (FUNCSEL=3). * @retval None */ -static void _i2c_config_gpio(void) +static void i2c_config_gpio(void) { IO_BANK0->GPIO[I2C_SDA_PIN].CTRL = IO_BANK0_CTRL_FUNCSEL_I2C; IO_BANK0->GPIO[I2C_SCL_PIN].CTRL = IO_BANK0_CTRL_FUNCSEL_I2C; @@ -58,7 +67,7 @@ static void _i2c_config_gpio(void) * * @retval None */ -static void _i2c_config_con(void) +static void i2c_config_con(void) { I2C1->CON = (1U << I2C_CON_MASTER_MODE_SHIFT) | (I2C_CON_SPEED_FAST << I2C_CON_SPEED_SHIFT) @@ -75,7 +84,7 @@ static void _i2c_config_con(void) * * @retval None */ -static void _i2c_config_timing(void) +static void i2c_config_timing(void) { I2C1->FS_SCL_HCNT = I2C_FS_SCL_HCNT_VAL; I2C1->FS_SCL_LCNT = I2C_FS_SCL_LCNT_VAL; @@ -115,7 +124,7 @@ static bool check_stop(void) * @brief Wait for a STOP_DET or TX_ABRT interrupt, then clear it. * @retval None */ -static void _i2c_wait_done(void) +static void i2c_wait_done(void) { uint32_t timeout = I2C_TIMEOUT; while (timeout > 0U) @@ -135,13 +144,13 @@ void i2c_release_reset(void) void i2c_init(void) { - _i2c_config_pads(); - _i2c_config_gpio(); + i2c_config_pads(); + i2c_config_gpio(); I2C1->ENABLE = 0U; - _i2c_config_con(); + i2c_config_con(); I2C1->TX_TL = 0U; I2C1->RX_TL = 0U; - _i2c_config_timing(); + i2c_config_timing(); I2C1->ENABLE = 1U; } @@ -156,5 +165,5 @@ void i2c_write_byte(uint8_t data) { (void)I2C1->CLR_TX_ABRT; I2C1->DATA_CMD = data | (1U << I2C_DATA_CMD_STOP_SHIFT); - _i2c_wait_done(); + i2c_wait_done(); } diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_lcd1602.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_lcd1602.c index b322fb4..35da36c 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_lcd1602.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_lcd1602.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_lcd1602.c - * @author Kevin Thomas - * @brief LCD1602 driver implementation for RP2350. - * - * Drives a 16x2 HD44780 LCD through a PCF8574 I2C backpack - * in 4-bit mode. Each nibble is latched by pulsing the EN - * line via single-byte I2C writes to the PCF8574. All - * timing margins exceed HD44780 datasheet minimums. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_lcd1602.c + * @brief LCD1602 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Drives a 16x2 HD44780 LCD through a PCF8574 I2C backpack + * in 4-bit mode. Each nibble is latched by pulsing the EN + * line via single-byte I2C writes to the PCF8574. All + * timing margins exceed HD44780 datasheet minimums. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_lcd1602.h" #include "rp2350_i2c.h" #include "rp2350_delay.h" @@ -49,7 +58,7 @@ static void lcd_pulse_enable(uint8_t data) * @param mode 0 for command, non-zero for character data * @retval None */ -static void _lcd_write4(uint8_t nibble, uint8_t mode) +static void lcd_write4(uint8_t nibble, uint8_t mode) { uint8_t data = (nibble & 0x0FU) << LCD_NIBBLE_SHIFT; data |= mode ? LCD_PIN_RS : 0U; @@ -65,8 +74,8 @@ static void _lcd_write4(uint8_t nibble, uint8_t mode) */ static void lcd_send(uint8_t value, uint8_t mode) { - _lcd_write4((value >> 4) & 0x0FU, mode); - _lcd_write4(value & 0x0FU, mode); + lcd_write4((value >> 4) & 0x0FU, mode); + lcd_write4(value & 0x0FU, mode); } /** @@ -77,15 +86,15 @@ static void lcd_send(uint8_t value, uint8_t mode) * * @retval None */ -static void _lcd_hd44780_reset(void) +static void lcd_hd44780_reset(void) { - _lcd_write4(0x03, 0); + lcd_write4(0x03, 0); delay_ms(5); - _lcd_write4(0x03, 0); + lcd_write4(0x03, 0); delay_us(150); - _lcd_write4(0x03, 0); + lcd_write4(0x03, 0); delay_us(150); - _lcd_write4(0x02, 0); + lcd_write4(0x02, 0); delay_us(150); } @@ -98,7 +107,7 @@ static void _lcd_hd44780_reset(void) * * @retval None */ -static void _lcd_hd44780_configure(void) +static void lcd_hd44780_configure(void) { lcd_send(LCD_CMD_FUNCTION_SET_4BIT, 0); lcd_send(LCD_CMD_DISPLAY_ON, 0); @@ -110,8 +119,8 @@ static void _lcd_hd44780_configure(void) void lcd_init(void) { i2c_set_target(LCD_I2C_ADDR); - _lcd_hd44780_reset(); - _lcd_hd44780_configure(); + lcd_hd44780_reset(); + lcd_hd44780_configure(); } void lcd_clear(void) diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_reset.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_reset.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_reset_handler.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_stack.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_stack.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_uart.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_uart.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x08_lcd1602_cbm/Src/rp2350_xosc.c b/drivers/0x08_lcd1602_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x08_lcd1602_cbm/Src/rp2350_xosc.c +++ b/drivers/0x08_lcd1602_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x08_lcd1602_cbm/Src/vector_table.c b/drivers/0x08_lcd1602_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x08_lcd1602_cbm/Src/vector_table.c +++ b/drivers/0x08_lcd1602_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x09_dht11/dht11.c b/drivers/0x09_dht11/dht11.c index 7594b25..28f147f 100644 --- a/drivers/0x09_dht11/dht11.c +++ b/drivers/0x09_dht11/dht11.c @@ -106,7 +106,7 @@ static bool read_bit(uint8_t *data, int i) { * @param data 5-byte array filled with the received data * @return bool true if all 40 bits were read, false on timeout */ -static bool _read_40_bits(uint8_t *data) { +static bool read_40_bits(uint8_t *data) { for (int i = 0; i < 40; i++) if (!read_bit(data, i)) return false; return true; @@ -132,7 +132,7 @@ bool dht11_read(float *humidity, float *temperature) { uint8_t data[5] = {0}; send_start_signal(); if (!wait_response()) return false; - if (!_read_40_bits(data)) return false; + if (!read_40_bits(data)) return false; if (!validate_checksum(data)) return false; *humidity = data[0] + data[1] * 0.1f; *temperature = data[2] + data[3] * 0.1f; diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350.h b/drivers/0x09_dht11_cbm/Inc/rp2350.h index de9458d..f5d4b43 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_delay.h b/drivers/0x09_dht11_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_delay.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_dht11.h b/drivers/0x09_dht11_cbm/Inc/rp2350_dht11.h index dbe4022..fd2f62d 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_dht11.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_dht11.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_dht11.h - * @author Kevin Thomas - * @brief DHT11 temperature and humidity sensor driver for RP2350. - * - * Single-wire protocol driver for the DHT11 sensor on GPIO4. - * Uses SIO for GPIO direction switching and TIMER0 TIMERAWL - * for microsecond pulse-width measurement. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_dht11.h + * @brief DHT11 temperature and humidity sensor driver for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Single-wire protocol driver for the DHT11 sensor on GPIO4. + * Uses SIO for GPIO direction switching and TIMER0 TIMERAWL + * for microsecond pulse-width measurement. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DHT11_H #define __RP2350_DHT11_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_reset.h b/drivers/0x09_dht11_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_reset.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_reset_handler.h b/drivers/0x09_dht11_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_stack.h b/drivers/0x09_dht11_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_stack.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_uart.h b/drivers/0x09_dht11_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_uart.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x09_dht11_cbm/Inc/rp2350_xosc.h b/drivers/0x09_dht11_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x09_dht11_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x09_dht11_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x09_dht11_cbm/Src/image_def.c b/drivers/0x09_dht11_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x09_dht11_cbm/Src/image_def.c +++ b/drivers/0x09_dht11_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x09_dht11_cbm/Src/main.c b/drivers/0x09_dht11_cbm/Src/main.c index dfb534c..19a0a25 100644 --- a/drivers/0x09_dht11_cbm/Src/main.c +++ b/drivers/0x09_dht11_cbm/Src/main.c @@ -1,33 +1,42 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief DHT11 temperature and humidity sensor demonstration. - * - * Reads the DHT11 sensor on GPIO4 every 2 seconds, printing - * humidity and temperature over UART. Reports read failures - * for wiring diagnostics. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO4 -> DHT11 DATA (10k pull-up to 3.3V recommended) - * 3.3V -> DHT11 VCC - * GND -> DHT11 GND - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief DHT11 temperature and humidity sensor demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Reads the DHT11 sensor on GPIO4 every 2 seconds, printing + * humidity and temperature over UART. Reports read failures + * for wiring diagnostics. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO4 -> DHT11 DATA (10k pull-up to 3.3V recommended) + * 3.3V -> DHT11 VCC + * GND -> DHT11 GND + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_dht11.h" #include "rp2350_uart.h" #include "rp2350_delay.h" @@ -36,6 +45,7 @@ /** * @brief Minimum polling interval for the DHT11 sensor in milliseconds. */ +/** @brief Interval between DHT11 sensor reads in milliseconds */ #define DHT11_POLL_MS 2000U /** @@ -86,7 +96,7 @@ static void print_failure(void) * @brief Initialize clocks, timer, DHT11, and announce over UART. * @retval None */ -static void _dht11_setup(void) +static void dht11_setup(void) { uint8_t dummy_h; uint8_t dummy_t; @@ -117,7 +127,7 @@ static void poll_sensor(void) int main(void) { - _dht11_setup(); + dht11_setup(); while (1) poll_sensor(); } diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_delay.c b/drivers/0x09_dht11_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_delay.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_dht11.c b/drivers/0x09_dht11_cbm/Src/rp2350_dht11.c index 1fb6b2d..eda4ac6 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_dht11.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_dht11.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_dht11.c - * @author Kevin Thomas - * @brief DHT11 temperature and humidity sensor driver for RP2350. - * - * Implements the single-wire DHT11 protocol using bare-metal - * SIO GPIO control and TIMER0 microsecond timestamps. Reads - * 40 bits (humidity high, humidity low, temperature high, - * temperature low, checksum) with timeout protection. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_dht11.c + * @brief DHT11 temperature and humidity sensor driver for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Implements the single-wire DHT11 protocol using bare-metal + * SIO GPIO control and TIMER0 microsecond timestamps. Reads + * 40 bits (humidity high, humidity low, temperature high, + * temperature low, checksum) with timeout protection. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_dht11.h" #include "rp2350_delay.h" @@ -166,7 +175,7 @@ static bool read_bit(uint8_t *data, uint8_t bit) * @param data 5-byte array filled with received data * @retval bool true if all bits read, false on timeout */ -static bool _read_40_bits(uint8_t *data) +static bool read_40_bits(uint8_t *data) { for (uint8_t i = 0; i < DHT11_DATA_BITS; i++) if (!read_bit(data, i)) @@ -260,7 +269,7 @@ static bool acquire_data(uint8_t *data) send_start_signal(); if (!wait_response()) return false; - if (!_read_40_bits(data)) + if (!read_40_bits(data)) return false; return validate_checksum(data); } diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_reset.c b/drivers/0x09_dht11_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_reset.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_reset_handler.c b/drivers/0x09_dht11_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_stack.c b/drivers/0x09_dht11_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_stack.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_uart.c b/drivers/0x09_dht11_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_uart.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x09_dht11_cbm/Src/rp2350_xosc.c b/drivers/0x09_dht11_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x09_dht11_cbm/Src/rp2350_xosc.c +++ b/drivers/0x09_dht11_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x09_dht11_cbm/Src/vector_table.c b/drivers/0x09_dht11_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x09_dht11_cbm/Src/vector_table.c +++ b/drivers/0x09_dht11_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0a_ir/ir.c b/drivers/0x0a_ir/ir.c index 4e37631..9d5b42a 100644 --- a/drivers/0x0a_ir/ir.c +++ b/drivers/0x0a_ir/ir.c @@ -95,7 +95,7 @@ static bool read_nec_bit(uint8_t *data, int i) { * @param data 4-byte array filled with the received address and command * @return bool true if all 32 bits were read, false on timeout */ -static bool _read_32_bits(uint8_t *data) { +static bool read_32_bits(uint8_t *data) { for (int i = 0; i < 32; ++i) if (!read_nec_bit(data, i)) return false; return true; @@ -125,6 +125,6 @@ void ir_init(uint8_t pin) { int ir_getkey(void) { if (!wait_leader()) return -1; uint8_t data[4] = {0, 0, 0, 0}; - if (!_read_32_bits(data)) return -1; + if (!read_32_bits(data)) return -1; return validate_nec_frame(data); } diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350.h b/drivers/0x0a_ir_cbm/Inc/rp2350.h index 656ada4..ed70f0b 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_delay.h b/drivers/0x0a_ir_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_delay.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_ir.h b/drivers/0x0a_ir_cbm/Inc/rp2350_ir.h index 7d1762d..0e97201 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_ir.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_ir.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_ir.h - * @author Kevin Thomas - * @brief NEC IR receiver driver for RP2350. - * - * Decodes NEC infrared remote frames on GPIO5 using SIO - * input reads and TIMER0 TIMERAWL for microsecond timing. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_ir.h + * @brief NEC IR receiver driver for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Decodes NEC infrared remote frames on GPIO5 using SIO + * input reads and TIMER0 TIMERAWL for microsecond timing. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_IR_H #define __RP2350_IR_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_reset.h b/drivers/0x0a_ir_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0a_ir_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_stack.h b/drivers/0x0a_ir_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_uart.h b/drivers/0x0a_ir_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0a_ir_cbm/Inc/rp2350_xosc.h b/drivers/0x0a_ir_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0a_ir_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0a_ir_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0a_ir_cbm/Src/image_def.c b/drivers/0x0a_ir_cbm/Src/image_def.c index e46113a..ed17cda 100644 --- a/drivers/0x0a_ir_cbm/Src/image_def.c +++ b/drivers/0x0a_ir_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0a_ir_cbm/Src/main.c b/drivers/0x0a_ir_cbm/Src/main.c index 66c2992..f718c3d 100644 --- a/drivers/0x0a_ir_cbm/Src/main.c +++ b/drivers/0x0a_ir_cbm/Src/main.c @@ -1,32 +1,41 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief NEC IR receiver demonstration. - * - * Decodes NEC infrared remote frames on GPIO5 and prints - * each command byte in hex and decimal over UART. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO5 -> IR receiver OUT (e.g. VS1838B or TSOP4838) - * 3.3V -> IR receiver VCC - * GND -> IR receiver GND - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief NEC IR receiver demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Decodes NEC infrared remote frames on GPIO5 and prints + * each command byte in hex and decimal over UART. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO5 -> IR receiver OUT (e.g. VS1838B or TSOP4838) + * 3.3V -> IR receiver VCC + * GND -> IR receiver GND + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_ir.h" #include "rp2350_uart.h" #include "rp2350_xosc.h" @@ -34,7 +43,7 @@ /** * @brief Hex digit lookup table for byte-to-hex conversion. */ -static const char _hex_lut[16] = "0123456789ABCDEF"; +static const char hex_lut[16] = "0123456789ABCDEF"; /** * @brief Print a byte as a two-digit hex string over UART. @@ -44,8 +53,8 @@ static const char _hex_lut[16] = "0123456789ABCDEF"; static void print_hex(uint8_t value) { char buf[3]; - buf[0] = _hex_lut[value >> 4]; - buf[1] = _hex_lut[value & 0x0FU]; + buf[0] = hex_lut[value >> 4]; + buf[1] = hex_lut[value & 0x0FU]; buf[2] = '\0'; uart_puts(buf); } @@ -56,7 +65,7 @@ static void print_hex(uint8_t value) * @param buf output buffer (at least 4 bytes) * @retval None */ -static void _uint8_to_str(uint8_t value, char *buf) +static void uint8_to_str(uint8_t value, char *buf) { uint8_t idx = 0; if (value >= 100) @@ -75,7 +84,7 @@ static void _uint8_to_str(uint8_t value, char *buf) static void print_dec(uint8_t value) { char buf[4]; - _uint8_to_str(value, buf); + uint8_to_str(value, buf); uart_puts(buf); } diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_delay.c b/drivers/0x0a_ir_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_delay.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_ir.c b/drivers/0x0a_ir_cbm/Src/rp2350_ir.c index 037ce85..2c248c3 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_ir.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_ir.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_ir.c - * @author Kevin Thomas - * @brief NEC IR receiver driver implementation for RP2350. - * - * Decodes NEC infrared remote frames using bare-metal SIO - * GPIO input and TIMER0 microsecond timestamps. Validates - * the 32-bit frame (addr, ~addr, cmd, ~cmd) and returns - * the command byte. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_ir.c + * @brief NEC IR receiver driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Decodes NEC infrared remote frames using bare-metal SIO + * GPIO input and TIMER0 microsecond timestamps. Validates + * the 32-bit frame (addr, ~addr, cmd, ~cmd) and returns + * the command byte. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_ir.h" /** @@ -135,7 +144,7 @@ static bool read_nec_bit(uint8_t *data, uint8_t bit) * @param data 4-byte array filled with received data * @retval bool true if all bits read, false on timeout */ -static bool _read_32_bits(uint8_t *data) +static bool read_32_bits(uint8_t *data) { for (uint8_t i = 0; i < NEC_DATA_BITS; i++) if (!read_nec_bit(data, i)) @@ -236,7 +245,7 @@ int ir_getkey(void) uint8_t data[NEC_DATA_BYTES] = {0}; if (!wait_leader()) return -1; - if (!_read_32_bits(data)) + if (!read_32_bits(data)) return -1; int result = validate_nec_frame(data); if (result < 0) diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_reset.c b/drivers/0x0a_ir_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_reset.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_reset_handler.c b/drivers/0x0a_ir_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_stack.c b/drivers/0x0a_ir_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_stack.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_uart.c b/drivers/0x0a_ir_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_uart.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0a_ir_cbm/Src/rp2350_xosc.c b/drivers/0x0a_ir_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0a_ir_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0a_ir_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0a_ir_cbm/Src/vector_table.c b/drivers/0x0a_ir_cbm/Src/vector_table.c index 96fc150..dd7ca9e 100644 --- a/drivers/0x0a_ir_cbm/Src/vector_table.c +++ b/drivers/0x0a_ir_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350.h b/drivers/0x0b_spi_cbm/Inc/rp2350.h index 842ba5b..50f528b 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_delay.h b/drivers/0x0b_spi_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_delay.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_reset.h b/drivers/0x0b_spi_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0b_spi_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_spi.h b/drivers/0x0b_spi_cbm/Inc/rp2350_spi.h index 2e3130d..4d06215 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_spi.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_spi.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_spi.h - * @author Kevin Thomas - * @brief SPI0 master driver header for RP2350. - * - * Provides full-duplex SPI0 master mode on GPIO16-19 with - * software-controlled chip select. Configures Motorola SPI - * frame format, 8-bit data, CPOL=0, CPHA=0, 1 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_spi.h + * @brief SPI0 master driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides full-duplex SPI0 master mode on GPIO16-19 with + * software-controlled chip select. Configures Motorola SPI + * frame format, 8-bit data, CPOL=0, CPHA=0, 1 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_SPI_H #define __RP2350_SPI_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_stack.h b/drivers/0x0b_spi_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_uart.h b/drivers/0x0b_spi_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0b_spi_cbm/Inc/rp2350_xosc.h b/drivers/0x0b_spi_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0b_spi_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0b_spi_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0b_spi_cbm/Src/image_def.c b/drivers/0x0b_spi_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x0b_spi_cbm/Src/image_def.c +++ b/drivers/0x0b_spi_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0b_spi_cbm/Src/main.c b/drivers/0x0b_spi_cbm/Src/main.c index e24542b..db4f44a 100644 --- a/drivers/0x0b_spi_cbm/Src/main.c +++ b/drivers/0x0b_spi_cbm/Src/main.c @@ -1,33 +1,42 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief SPI loopback demonstration. - * - * Performs a full-duplex SPI0 transfer in master mode with - * MOSI wired to MISO for loopback verification. Prints TX - * and RX data over UART every second. - * - * Wiring (loopback test): - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * GPIO19 (MOSI) -> GPIO16 (MISO) - * GPIO18 (SCK) -> logic analyzer (optional) - * GPIO17 (CS) -> active-low slave (optional) - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief SPI loopback demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Performs a full-duplex SPI0 transfer in master mode with + * MOSI wired to MISO for loopback verification. Prints TX + * and RX data over UART every second. + * + * Wiring (loopback test): + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * GPIO19 (MOSI) -> GPIO16 (MISO) + * GPIO18 (SCK) -> logic analyzer (optional) + * GPIO17 (CS) -> active-low slave (optional) + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_spi.h" #include "rp2350_uart.h" #include "rp2350_delay.h" @@ -36,7 +45,7 @@ /** * @brief Hex digit lookup table for byte-to-hex conversion. */ -static const char _hex_lut[16] = "0123456789ABCDEF"; +static const char hex_lut[16] = "0123456789ABCDEF"; /** * @brief Print a byte as a two-digit hex string over UART. @@ -46,8 +55,8 @@ static const char _hex_lut[16] = "0123456789ABCDEF"; static void print_hex(uint8_t value) { char buf[3]; - buf[0] = _hex_lut[value >> 4]; - buf[1] = _hex_lut[value & 0x0FU]; + buf[0] = hex_lut[value >> 4]; + buf[1] = hex_lut[value & 0x0FU]; buf[2] = '\0'; uart_puts(buf); } diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_delay.c b/drivers/0x0b_spi_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_delay.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_reset.c b/drivers/0x0b_spi_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_reset.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_reset_handler.c b/drivers/0x0b_spi_cbm/Src/rp2350_reset_handler.c index c6da9f2..d715c90 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, SPI, UART, then - * branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, SPI, UART, then + * branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_spi.c b/drivers/0x0b_spi_cbm/Src/rp2350_spi.c index bb208b2..2c9f18d 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_spi.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_spi.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_spi.c - * @author Kevin Thomas - * @brief SPI0 master driver implementation for RP2350. - * - * Full-duplex SPI0 master on GPIO16 (MISO), GPIO17 (CS), - * GPIO18 (SCK), GPIO19 (MOSI). Motorola SPI frame format, - * 8-bit data, CPOL=0, CPHA=0, 1 MHz clock from 12 MHz - * clk_peri. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_spi.c + * @brief SPI0 master driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Full-duplex SPI0 master on GPIO16 (MISO), GPIO17 (CS), + * GPIO18 (SCK), GPIO19 (MOSI). Motorola SPI frame format, + * 8-bit data, CPOL=0, CPHA=0, 1 MHz clock from 12 MHz + * clk_peri. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_spi.h" /** @@ -115,7 +124,7 @@ static void cs_init(void) * @brief Configure SSPCR0 for 8-bit Motorola SPI, SCR=0. * @retval None */ -static void _configure_cr0(void) +static void configure_cr0(void) { uint32_t value = 0; value |= (SPI_SSPCR0_DSS_8BIT << SPI_SSPCR0_DSS_SHIFT); @@ -194,7 +203,7 @@ void spi_init(void) configure_all_pads(); configure_all_funcsel(); cs_init(); - _configure_cr0(); + configure_cr0(); configure_prescaler(); enable_spi(); } diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_stack.c b/drivers/0x0b_spi_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_stack.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_uart.c b/drivers/0x0b_spi_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_uart.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0b_spi_cbm/Src/rp2350_xosc.c b/drivers/0x0b_spi_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0b_spi_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0b_spi_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0b_spi_cbm/Src/vector_table.c b/drivers/0x0b_spi_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x0b_spi_cbm/Src/vector_table.c +++ b/drivers/0x0b_spi_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0c_multicore/0x0c_multicore.c b/drivers/0x0c_multicore/0x0c_multicore.c index 2ecc468..fefa95c 100644 --- a/drivers/0x0c_multicore/0x0c_multicore.c +++ b/drivers/0x0c_multicore/0x0c_multicore.c @@ -47,7 +47,7 @@ * Blocks on the FIFO, adds one to each received value, and pushes * the result back to core 0. */ -static void _core1_main(void) { +static void core1_main(void) { while (true) { uint32_t value = multicore_driver_pop(); multicore_driver_push(value + 1u); @@ -70,7 +70,7 @@ static void send_and_print(uint32_t *counter) { int main(void) { stdio_init_all(); - multicore_driver_launch(_core1_main); + multicore_driver_launch(core1_main); uint32_t counter = 0; while (true) send_and_print(&counter); diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350.h b/drivers/0x0c_multicore_cbm/Inc/rp2350.h index 3863062..fbc6597 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_delay.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_delay.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_multicore.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_multicore.h index 2c0723f..beb037e 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_multicore.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_multicore.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_multicore.h - * @author Kevin Thomas - * @brief Multicore driver header for RP2350. - * - * Bare-metal dual-core driver using the SIO inter-processor - * FIFOs. Provides core 1 launch, blocking push, and blocking - * pop operations for 32-bit mailbox messaging. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_multicore.h + * @brief Multicore driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal dual-core driver using the SIO inter-processor + * FIFOs. Provides core 1 launch, blocking push, and blocking + * pop operations for 32-bit mailbox messaging. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_MULTICORE_H #define __RP2350_MULTICORE_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_reset.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_stack.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_uart.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0c_multicore_cbm/Inc/rp2350_xosc.h b/drivers/0x0c_multicore_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0c_multicore_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0c_multicore_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0c_multicore_cbm/Src/image_def.c b/drivers/0x0c_multicore_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x0c_multicore_cbm/Src/image_def.c +++ b/drivers/0x0c_multicore_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0c_multicore_cbm/Src/main.c b/drivers/0x0c_multicore_cbm/Src/main.c index b66c004..27500eb 100644 --- a/drivers/0x0c_multicore_cbm/Src/main.c +++ b/drivers/0x0c_multicore_cbm/Src/main.c @@ -1,32 +1,41 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief Multicore FIFO messaging demonstration. - * - * Core 0 launches core 1, then sends an incrementing counter - * through the SIO inter-processor FIFO. Core 1 returns the - * value plus one. Both values are printed over UART every - * second. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * No external wiring required (dual-core on-chip) - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief Multicore FIFO messaging demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Core 0 launches core 1, then sends an incrementing counter + * through the SIO inter-processor FIFO. Core 1 returns the + * value plus one. Both values are printed over UART every + * second. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * No external wiring required (dual-core on-chip) + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_multicore.h" #include "rp2350_uart.h" #include "rp2350_delay.h" @@ -109,7 +118,7 @@ static void print_counter_line(uint32_t sent, uint32_t received) * @brief Core 1 entry point: receive a value and return it plus one. * @retval None (does not return) */ -static void _core1_main(void) +static void core1_main(void) { while (1) { @@ -135,7 +144,7 @@ static void send_and_print(uint32_t *counter) int main(void) { uint32_t counter = 0; - multicore_launch(_core1_main); + multicore_launch(core1_main); uart_puts("Multicore FIFO demo initialized\r\n"); while (1) send_and_print(&counter); diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_delay.c b/drivers/0x0c_multicore_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_delay.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_multicore.c b/drivers/0x0c_multicore_cbm/Src/rp2350_multicore.c index 832f501..e5e45d1 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_multicore.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_multicore.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_multicore.c - * @author Kevin Thomas - * @brief Multicore driver implementation for RP2350. - * - * Implements bare-metal core 1 launch via the PSM reset and - * SIO FIFO handshake protocol (RP2350 datasheet Section 5.3). - * Provides blocking push/pop for inter-core 32-bit messaging. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_multicore.c + * @brief Multicore driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Implements bare-metal core 1 launch via the PSM reset and + * SIO FIFO handshake protocol (RP2350 datasheet Section 5.3). + * Provides blocking push/pop for inter-core 32-bit messaging. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_multicore.h" /** @@ -31,7 +40,7 @@ /** * @brief Core 1 stack array allocated in BSS. */ -static uint32_t _core1_stack[CORE1_STACK_WORDS]; +static uint32_t core1_stack[CORE1_STACK_WORDS]; /** * @brief Drain all pending values from the RX FIFO. @@ -69,7 +78,7 @@ static uint32_t fifo_pop_blocking(void) * @brief Force core 1 into reset via PSM atomic set alias. * @retval None */ -static void _set_frce_off_proc1(void) +static void set_frce_off_proc1(void) { volatile uint32_t *set = (volatile uint32_t *)((uintptr_t)&PSM->FRCE_OFF + ATOMIC_SET_OFFSET); *set = (1U << PSM_FRCE_OFF_PROC1_SHIFT); @@ -80,7 +89,7 @@ static void _set_frce_off_proc1(void) * @brief Release core 1 from reset via PSM atomic clear alias. * @retval None */ -static void _clr_frce_off_proc1(void) +static void clr_frce_off_proc1(void) { volatile uint32_t *clr = (volatile uint32_t *)((uintptr_t)&PSM->FRCE_OFF + ATOMIC_CLR_OFFSET); *clr = (1U << PSM_FRCE_OFF_PROC1_SHIFT); @@ -90,10 +99,10 @@ static void _clr_frce_off_proc1(void) * @brief Reset core 1 and wait for its boot FIFO acknowledgement. * @retval None */ -static void _reset_core1(void) +static void reset_core1(void) { - _set_frce_off_proc1(); - _clr_frce_off_proc1(); + set_frce_off_proc1(); + clr_frce_off_proc1(); (void)fifo_pop_blocking(); } @@ -120,7 +129,7 @@ static void send_handshake_word(uint32_t cmd) static void launch_handshake(void (*entry)(void)) { extern uint32_t __Vectors; - uint32_t *sp = &_core1_stack[CORE1_STACK_WORDS]; + uint32_t *sp = &core1_stack[CORE1_STACK_WORDS]; const uint32_t seq[] = {0, 0, 1, (uintptr_t)&__Vectors, (uintptr_t)sp, (uintptr_t)entry}; uint32_t idx = 0; do { @@ -131,7 +140,7 @@ static void launch_handshake(void (*entry)(void)) void multicore_launch(void (*entry)(void)) { - _reset_core1(); + reset_core1(); launch_handshake(entry); } diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_reset.c b/drivers/0x0c_multicore_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_reset.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_reset_handler.c b/drivers/0x0c_multicore_cbm/Src/rp2350_reset_handler.c index e228a44..46645b1 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, then branches - * to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, then branches + * to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_stack.c b/drivers/0x0c_multicore_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_stack.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_uart.c b/drivers/0x0c_multicore_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_uart.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0c_multicore_cbm/Src/rp2350_xosc.c b/drivers/0x0c_multicore_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0c_multicore_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0c_multicore_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0c_multicore_cbm/Src/vector_table.c b/drivers/0x0c_multicore_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x0c_multicore_cbm/Src/vector_table.c +++ b/drivers/0x0c_multicore_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350.h b/drivers/0x0d_timer_cbm/Inc/rp2350.h index 6750ab5..3f858fb 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_delay.h b/drivers/0x0d_timer_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_delay.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_reset.h b/drivers/0x0d_timer_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0d_timer_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_stack.h b/drivers/0x0d_timer_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_timer.h b/drivers/0x0d_timer_cbm/Inc/rp2350_timer.h index b431b10..c920575 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_timer.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_timer.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_timer.h - * @author Kevin Thomas - * @brief TIMER0 alarm driver header for RP2350. - * - * Bare-metal TIMER0 driver providing a repeating alarm - * interrupt on alarm 0. The tick generator is configured - * for 1 us resolution from the 12 MHz CLK_REF. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_timer.h + * @brief TIMER0 alarm driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal TIMER0 driver providing a repeating alarm + * interrupt on alarm 0. The tick generator is configured + * for 1 us resolution from the 12 MHz CLK_REF. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_TIMER_H #define __RP2350_TIMER_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_uart.h b/drivers/0x0d_timer_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0d_timer_cbm/Inc/rp2350_xosc.h b/drivers/0x0d_timer_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0d_timer_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0d_timer_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0d_timer_cbm/Src/image_def.c b/drivers/0x0d_timer_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x0d_timer_cbm/Src/image_def.c +++ b/drivers/0x0d_timer_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0d_timer_cbm/Src/main.c b/drivers/0x0d_timer_cbm/Src/main.c index fc80264..529bddc 100644 --- a/drivers/0x0d_timer_cbm/Src/main.c +++ b/drivers/0x0d_timer_cbm/Src/main.c @@ -1,31 +1,40 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief Repeating timer alarm demonstration. - * - * Configures TIMER0 alarm 0 to fire a callback every 1 second. - * The callback prints "Timer heartbeat" over UART. The main - * loop idles with WFI. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * No external components required - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief Repeating timer alarm demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Configures TIMER0 alarm 0 to fire a callback every 1 second. + * The callback prints "Timer heartbeat" over UART. The main + * loop idles with WFI. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * No external components required + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_timer.h" #include "rp2350_uart.h" diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_delay.c b/drivers/0x0d_timer_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_delay.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_reset.c b/drivers/0x0d_timer_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_reset.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_reset_handler.c b/drivers/0x0d_timer_cbm/Src/rp2350_reset_handler.c index 9922cc2..4433e3b 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, TIMER0 tick - * generator, then branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, TIMER0 tick + * generator, then branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_stack.c b/drivers/0x0d_timer_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_stack.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_timer.c b/drivers/0x0d_timer_cbm/Src/rp2350_timer.c index 9b02c06..9846e1d 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_timer.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_timer.c @@ -1,37 +1,46 @@ /** - ****************************************************************************** - * @file rp2350_timer.c - * @author Kevin Thomas - * @brief TIMER0 alarm driver implementation for RP2350. - * - * Configures the TIMER0 tick generator for 1 us resolution - * from the 12 MHz CLK_REF, then uses alarm 0 with NVIC IRQ - * to implement a repeating callback at a configurable period. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_timer.c + * @brief TIMER0 alarm driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the TIMER0 tick generator for 1 us resolution + * from the 12 MHz CLK_REF, then uses alarm 0 with NVIC IRQ + * to implement a repeating callback at a configurable period. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_timer.h" /** * @brief User callback and period stored for ISR re-arm. */ -static timer_callback_t _user_callback; +static timer_callback_t user_callback; /** * @brief Alarm period in microseconds for re-arming. */ -static uint32_t _alarm_period_us; +static uint32_t alarm_period_us; /** * @brief Clear the TIMER0 reset bit in the reset controller. @@ -97,7 +106,7 @@ static void timer_enable_nvic(void) static void timer_arm_alarm(void) { uint32_t target; - target = TIMER0->TIMERAWL + _alarm_period_us; + target = TIMER0->TIMERAWL + alarm_period_us; TIMER0->ALARM0 = target; } @@ -115,8 +124,8 @@ void timer_tick_init(void) void timer_alarm_start(uint32_t period_ms, timer_callback_t cb) { - _user_callback = cb; - _alarm_period_us = period_ms * 1000U; + user_callback = cb; + alarm_period_us = period_ms * 1000U; timer_enable_alarm_irq(); timer_enable_nvic(); timer_arm_alarm(); @@ -126,6 +135,6 @@ void TIMER0_IRQ_0_Handler(void) { TIMER0->INTR = TIMER_INTR_ALARM0_MASK; timer_arm_alarm(); - if (_user_callback) - _user_callback(); + if (user_callback) + user_callback(); } diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_uart.c b/drivers/0x0d_timer_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_uart.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0d_timer_cbm/Src/rp2350_xosc.c b/drivers/0x0d_timer_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0d_timer_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0d_timer_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0d_timer_cbm/Src/vector_table.c b/drivers/0x0d_timer_cbm/Src/vector_table.c index 4034b2a..954ff28 100644 --- a/drivers/0x0d_timer_cbm/Src/vector_table.c +++ b/drivers/0x0d_timer_cbm/Src/vector_table.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer, reset handler, and - * TIMER0 alarm 0 IRQ handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer, reset handler, and + * @author Kevin Thomas + * @date 2026 + * + * TIMER0 alarm 0 IRQ handler. + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350.h index 09663c7..bdba3e7 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_delay.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_delay.h index 185f919..79db58f 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_delay.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_delay.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.h - * @author Kevin Thomas - * @brief Delay driver header for RP2350. - * - * Millisecond and microsecond busy-wait delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.h + * @brief Delay driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Millisecond and microsecond busy-wait delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_DELAY_H #define __RP2350_DELAY_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_stack.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_uart.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_watchdog.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_watchdog.h index f016898..ece89b9 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_watchdog.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_watchdog.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_watchdog.h - * @author Kevin Thomas - * @brief Watchdog timer driver header for RP2350. - * - * Bare-metal watchdog driver providing enable, feed, and - * reboot-cause detection. The watchdog tick generator is - * configured for 1 us resolution from the 12 MHz CLK_REF. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_watchdog.h + * @brief Watchdog timer driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal watchdog driver providing enable, feed, and + * reboot-cause detection. The watchdog tick generator is + * configured for 1 us resolution from the 12 MHz CLK_REF. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_WATCHDOG_H #define __RP2350_WATCHDOG_H diff --git a/drivers/0x0e_watchdog_cbm/Inc/rp2350_xosc.h b/drivers/0x0e_watchdog_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0e_watchdog_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0e_watchdog_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0e_watchdog_cbm/Src/image_def.c b/drivers/0x0e_watchdog_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x0e_watchdog_cbm/Src/image_def.c +++ b/drivers/0x0e_watchdog_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0e_watchdog_cbm/Src/main.c b/drivers/0x0e_watchdog_cbm/Src/main.c index a6d8a77..3ba9e9a 100644 --- a/drivers/0x0e_watchdog_cbm/Src/main.c +++ b/drivers/0x0e_watchdog_cbm/Src/main.c @@ -1,31 +1,40 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief Watchdog feed demonstration. - * - * Enables the watchdog with a 3-second timeout and feeds it - * every 1 second. Reports whether the system booted from a - * watchdog reset or a normal power-on. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * No external components required - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief Watchdog feed demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Enables the watchdog with a 3-second timeout and feeds it + * every 1 second. Reports whether the system booted from a + * watchdog reset or a normal power-on. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * No external components required + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_watchdog.h" #include "rp2350_uart.h" #include "rp2350_delay.h" diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_delay.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_delay.c index f2fe8de..65b0821 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_delay.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_delay.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_delay.c - * @author Kevin Thomas - * @brief Delay driver implementation for RP2350. - * - * Busy-wait millisecond and microsecond delays calibrated for - * a 12 MHz clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_delay.c + * @brief Delay driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Busy-wait millisecond and microsecond delays calibrated for + * a 12 MHz clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_delay.h" void delay_ms(uint32_t ms) diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_reset.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_reset.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_reset_handler.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_reset_handler.c index f5666ef..50584ab 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Initializes the - * stack, XOSC, subsystem resets, UART, watchdog tick - * generator, then branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Initializes the + * stack, XOSC, subsystem resets, UART, watchdog tick + * generator, then branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_stack.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_stack.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_uart.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_uart.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_watchdog.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_watchdog.c index 3026b68..6bca077 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_watchdog.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_watchdog.c @@ -1,32 +1,41 @@ /** - ****************************************************************************** - * @file rp2350_watchdog.c - * @author Kevin Thomas - * @brief Watchdog timer driver implementation for RP2350. - * - * Configures the watchdog tick generator for 1 us resolution - * from the 12 MHz CLK_REF, enables the watchdog countdown, - * and provides feed and reboot-cause detection. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_watchdog.c + * @brief Watchdog timer driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the watchdog tick generator for 1 us resolution + * from the 12 MHz CLK_REF, enables the watchdog countdown, + * and provides feed and reboot-cause detection. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_watchdog.h" /** * @brief Saved load value for feeding the watchdog. */ -static uint32_t _load_value; +static uint32_t load_value; /** * @brief Set the watchdog tick generator cycle count to 12. @@ -85,7 +94,7 @@ static void watchdog_set_pause_debug(void) */ static void watchdog_load_and_enable(void) { - WATCHDOG->LOAD = _load_value; + WATCHDOG->LOAD = load_value; WATCHDOG->CTRL |= (1U << WATCHDOG_CTRL_ENABLE_SHIFT); } @@ -97,9 +106,9 @@ void watchdog_tick_init(void) void watchdog_enable(uint32_t timeout_ms) { - _load_value = timeout_ms * 1000U; - if (_load_value > WATCHDOG_LOAD_MAX) - _load_value = WATCHDOG_LOAD_MAX; + load_value = timeout_ms * 1000U; + if (load_value > WATCHDOG_LOAD_MAX) + load_value = WATCHDOG_LOAD_MAX; watchdog_disable(); watchdog_set_psm_wdsel(); watchdog_set_pause_debug(); @@ -108,7 +117,7 @@ void watchdog_enable(uint32_t timeout_ms) void watchdog_feed(void) { - WATCHDOG->LOAD = _load_value; + WATCHDOG->LOAD = load_value; } bool watchdog_caused_reboot(void) diff --git a/drivers/0x0e_watchdog_cbm/Src/rp2350_xosc.c b/drivers/0x0e_watchdog_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0e_watchdog_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0e_watchdog_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0e_watchdog_cbm/Src/vector_table.c b/drivers/0x0e_watchdog_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x0e_watchdog_cbm/Src/vector_table.c +++ b/drivers/0x0e_watchdog_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top; diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350.h b/drivers/0x0f_flash_cbm/Inc/rp2350.h index 99bd8cf..66618d5 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350.h @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350.h - * @author Kevin Thomas - * @brief RP2350 Device Peripheral Access Layer Header File. - * - * Memory-mapped register structures and peripheral base addresses - * for the RP2350 microcontroller (Cortex-M33 dual-core). All - * register offsets verified against the RP2350 datasheet - * (RP-008373-DS-2). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350.h + * @brief RP2350 Device Peripheral Access Layer Header File. + * @author Kevin Thomas + * @date 2026 + * + * Memory-mapped register structures and peripheral base addresses + * for the RP2350 microcontroller (Cortex-M33 dual-core). All + * register offsets verified against the RP2350 datasheet + * (RP-008373-DS-2). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_H #define __RP2350_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_flash.h b/drivers/0x0f_flash_cbm/Inc/rp2350_flash.h index ec046b7..0c5eb09 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_flash.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_flash.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_flash.h - * @author Kevin Thomas - * @brief On-chip flash driver header for RP2350. - * - * Bare-metal flash erase, program, and read driver using ROM - * bootrom functions. Write operations run from RAM to avoid - * XIP conflicts. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_flash.h + * @brief On-chip flash driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal flash erase, program, and read driver using ROM + * bootrom functions. Write operations run from RAM to avoid + * XIP conflicts. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_FLASH_H #define __RP2350_FLASH_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_reset.h b/drivers/0x0f_flash_cbm/Inc/rp2350_reset.h index 4a10831..733054a 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_reset.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_reset.h @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_reset.h - * @author Kevin Thomas - * @brief Reset controller driver header for RP2350. - * - * Provides subsystem reset release for IO_BANK0. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.h + * @brief Reset controller driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Provides subsystem reset release for IO_BANK0. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_H #define __RP2350_RESET_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_reset_handler.h b/drivers/0x0f_flash_cbm/Inc/rp2350_reset_handler.h index fb837a0..43c2d7f 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_reset_handler.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_reset_handler.h @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.h - * @author Kevin Thomas - * @brief Reset handler header for RP2350. - * - * Entry point after reset. Performs stack initialization, XOSC - * setup, subsystem reset release, UART initialization, - * and branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.h + * @brief Reset handler header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after reset. Performs stack initialization, XOSC + * setup, subsystem reset release, UART initialization, + * and branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_RESET_HANDLER_H #define __RP2350_RESET_HANDLER_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_stack.h b/drivers/0x0f_flash_cbm/Inc/rp2350_stack.h index 952d26e..4faea5c 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_stack.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_stack.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_stack.h - * @author Kevin Thomas - * @brief Stack pointer initialization header for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and - * STACK_LIMIT values defined in rp2350.h. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.h + * @brief Stack pointer initialization header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM from the STACK_TOP and + * STACK_LIMIT values defined in rp2350.h. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_STACK_H #define __RP2350_STACK_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_uart.h b/drivers/0x0f_flash_cbm/Inc/rp2350_uart.h index 6e9df10..c72890e 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_uart.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_uart.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_uart.h - * @author Kevin Thomas - * @brief UART0 driver header for RP2350. - * - * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at - * 115200 baud (12 MHz XOSC clock). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.h + * @brief UART0 driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Bare-metal UART0 driver supporting TX/RX on GPIO 0/1 at + * 115200 baud (12 MHz XOSC clock). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_UART_H #define __RP2350_UART_H diff --git a/drivers/0x0f_flash_cbm/Inc/rp2350_xosc.h b/drivers/0x0f_flash_cbm/Inc/rp2350_xosc.h index 0dd40d8..80fd75d 100644 --- a/drivers/0x0f_flash_cbm/Inc/rp2350_xosc.h +++ b/drivers/0x0f_flash_cbm/Inc/rp2350_xosc.h @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.h - * @author Kevin Thomas - * @brief XOSC driver header for RP2350. - * - * External crystal oscillator initialization and peripheral - * clock enable using the XOSC registers. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.h + * @brief XOSC driver header for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * External crystal oscillator initialization and peripheral + * clock enable using the XOSC registers. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef __RP2350_XOSC_H #define __RP2350_XOSC_H diff --git a/drivers/0x0f_flash_cbm/Src/image_def.c b/drivers/0x0f_flash_cbm/Src/image_def.c index 6f8eb7d..72148ba 100644 --- a/drivers/0x0f_flash_cbm/Src/image_def.c +++ b/drivers/0x0f_flash_cbm/Src/image_def.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file image_def.c - * @author Kevin Thomas - * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. - * - * Must appear within the first 4 KB of flash for the boot ROM - * to accept the image. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file image_def.c + * @brief RP2350 IMAGE_DEF block for boot ROM image recognition. + * @author Kevin Thomas + * @date 2026 + * + * Must appear within the first 4 KB of flash for the boot ROM + * to accept the image. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include __attribute__((section(".embedded_block"), used)) diff --git a/drivers/0x0f_flash_cbm/Src/main.c b/drivers/0x0f_flash_cbm/Src/main.c index 7496ba7..f422cdd 100644 --- a/drivers/0x0f_flash_cbm/Src/main.c +++ b/drivers/0x0f_flash_cbm/Src/main.c @@ -1,37 +1,47 @@ /** - ****************************************************************************** - * @file main.c - * @author Kevin Thomas - * @brief On-chip flash write / read demonstration. - * - * Writes "Embedded Hacking flash driver demo" to the last - * sector of flash, reads it back via XIP, and prints the - * result over UART. - * - * Wiring: - * GPIO0 -> UART TX (USB-to-UART adapter RX) - * GPIO1 -> UART RX (USB-to-UART adapter TX) - * No external components required - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file main.c + * @brief On-chip flash write / read demonstration. + * @author Kevin Thomas + * @date 2026 + * + * Writes "Embedded Hacking flash driver demo" to the last + * sector of flash, reads it back via XIP, and prints the + * result over UART. + * + * Wiring: + * GPIO0 -> UART TX (USB-to-UART adapter RX) + * GPIO1 -> UART RX (USB-to-UART adapter TX) + * No external components required + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_flash.h" #include "rp2350_uart.h" /** * @brief Target offset: last sector of the 4 MB flash chip. */ +/** @brief Flash offset for the target storage sector */ #define FLASH_TARGET_OFFSET (FLASH_SIZE - FLASH_SECTOR_SIZE) /** diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_flash.c b/drivers/0x0f_flash_cbm/Src/rp2350_flash.c index 350e411..660bdf3 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_flash.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_flash.c @@ -1,27 +1,36 @@ /** - ****************************************************************************** - * @file rp2350_flash.c - * @author Kevin Thomas - * @brief On-chip flash driver implementation for RP2350. - * - * Erases and programs flash sectors using ROM bootrom - * functions. The erase/program trampoline executes from RAM - * (placed in .ram_func) because XIP is disabled while the - * flash chip is being modified. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_flash.c + * @brief On-chip flash driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Erases and programs flash sectors using ROM bootrom + * functions. The erase/program trampoline executes from RAM + * (placed in .ram_func) because XIP is disabled while the + * flash chip is being modified. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_flash.h" /** diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_reset.c b/drivers/0x0f_flash_cbm/Src/rp2350_reset.c index 6f09550..702ef53 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_reset.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_reset.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_reset.c - * @author Kevin Thomas - * @brief Reset controller driver implementation for RP2350. - * - * Releases IO_BANK0 from reset and waits until the subsystem - * is ready. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset.c + * @brief Reset controller driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Releases IO_BANK0 from reset and waits until the subsystem + * is ready. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset.h" void reset_init_subsystem(void) diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_reset_handler.c b/drivers/0x0f_flash_cbm/Src/rp2350_reset_handler.c index 14fbd31..fae4d80 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_reset_handler.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_reset_handler.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file rp2350_reset_handler.c - * @author Kevin Thomas - * @brief Reset handler implementation for RP2350. - * - * Entry point after power-on or system reset. Copies the - * .data section from flash to RAM, initializes the stack, - * XOSC, subsystem resets, UART, then branches to main(). - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_reset_handler.c + * @brief Reset handler implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Entry point after power-on or system reset. Copies the + * .data section from flash to RAM, initializes the stack, + * XOSC, subsystem resets, UART, then branches to main(). + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_reset_handler.h" #include "rp2350_stack.h" #include "rp2350_xosc.h" diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_stack.c b/drivers/0x0f_flash_cbm/Src/rp2350_stack.c index 9c328dc..2143da3 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_stack.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_stack.c @@ -1,24 +1,33 @@ /** - ****************************************************************************** - * @file rp2350_stack.c - * @author Kevin Thomas - * @brief Stack pointer initialization for RP2350. - * - * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_stack.c + * @brief Stack pointer initialization for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Sets MSP, PSP, MSPLIM, and PSPLIM using inline assembly. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_stack.h" void stack_init(void) diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_uart.c b/drivers/0x0f_flash_cbm/Src/rp2350_uart.c index ad3e732..4b196d5 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_uart.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_uart.c @@ -1,27 +1,37 @@ /** - ****************************************************************************** - * @file rp2350_uart.c - * @author Kevin Thomas - * @brief UART0 driver implementation for RP2350. - * - * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 - * baud using the 12 MHz XOSC clock. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_uart.c + * @brief UART0 driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures UART0 on GPIO 0 (TX) and GPIO 1 (RX) at 115200 + * baud using the 12 MHz XOSC clock. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_uart.h" +/** @brief Base address pointer for UART0 peripheral registers */ #define UART_BASE ((volatile uint32_t *) UART0_BASE) /** diff --git a/drivers/0x0f_flash_cbm/Src/rp2350_xosc.c b/drivers/0x0f_flash_cbm/Src/rp2350_xosc.c index 324bf96..b33a71d 100644 --- a/drivers/0x0f_flash_cbm/Src/rp2350_xosc.c +++ b/drivers/0x0f_flash_cbm/Src/rp2350_xosc.c @@ -1,25 +1,34 @@ /** - ****************************************************************************** - * @file rp2350_xosc.c - * @author Kevin Thomas - * @brief XOSC driver implementation for RP2350. - * - * Configures the external crystal oscillator and enables the - * peripheral clock sourced from XOSC. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file rp2350_xosc.c + * @brief XOSC driver implementation for RP2350. + * @author Kevin Thomas + * @date 2026 + * + * Configures the external crystal oscillator and enables the + * peripheral clock sourced from XOSC. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "rp2350_xosc.h" void xosc_init(void) diff --git a/drivers/0x0f_flash_cbm/Src/vector_table.c b/drivers/0x0f_flash_cbm/Src/vector_table.c index 091894b..23691fb 100644 --- a/drivers/0x0f_flash_cbm/Src/vector_table.c +++ b/drivers/0x0f_flash_cbm/Src/vector_table.c @@ -1,26 +1,35 @@ /** - ****************************************************************************** - * @file vector_table.c - * @author Kevin Thomas - * @brief Vector table with initial stack pointer and reset handler. - * - * Placed in the .vectors section at the start of flash. - * The Thumb bit (bit 0 = 1) is automatically set by the - * linker for function pointers in Thumb mode. - * - ****************************************************************************** - * @attention - * - * Copyright (c) 2026 Kevin Thomas. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - + * @file vector_table.c + * @brief Vector table with initial stack pointer and reset handler. + * @author Kevin Thomas + * @date 2026 + * + * Placed in the .vectors section at the start of flash. + * The Thumb bit (bit 0 = 1) is automatically set by the + * linker for function pointers in Thumb mode. + * + * MIT License + * + * Copyright (c) 2026 Kevin Thomas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include extern uint32_t _stack_top;