From 70a8bcb04099117ad0837bfce575a2698a054923 Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Tue, 23 Jan 2024 12:18:00 +1100 Subject: [PATCH 1/6] Added raspberry Pi GPIO functionalites into splashkit. --- coresdk/src/backend/gpio_driver.cpp | 140 ++++++++ coresdk/src/backend/gpio_driver.h | 24 ++ coresdk/src/coresdk/raspi_gpio.cpp | 186 +++++++++++ coresdk/src/coresdk/raspi_gpio.h | 95 ++++++ coresdk/src/coresdk/rectangle_geometry.h | 2 +- coresdk/src/coresdk/terminal.cpp | 307 +----------------- coresdk/src/coresdk/terminal.h | 151 +-------- coresdk/src/coresdk/types.h | 179 ++++++++-- coresdk/src/coresdk/vector_2d.cpp | 1 - coresdk/src/keynote_code.cpp | 1 - coresdk/src/test/test_main.cpp | 1 + coresdk/src/test/test_main.h | 2 +- coresdk/src/test/test_raspi_gpio.cpp | 44 +++ coresdk/src/test/test_terminal.cpp | 50 +-- .../Xcode/splashkit.xcodeproj/project.pbxproj | 8 +- projects/cmake/CMakeLists.txt | 57 ++++ 16 files changed, 718 insertions(+), 530 deletions(-) create mode 100644 coresdk/src/backend/gpio_driver.cpp create mode 100644 coresdk/src/backend/gpio_driver.h create mode 100644 coresdk/src/coresdk/raspi_gpio.cpp create mode 100644 coresdk/src/coresdk/raspi_gpio.h create mode 100644 coresdk/src/test/test_raspi_gpio.cpp diff --git a/coresdk/src/backend/gpio_driver.cpp b/coresdk/src/backend/gpio_driver.cpp new file mode 100644 index 00000000..67196390 --- /dev/null +++ b/coresdk/src/backend/gpio_driver.cpp @@ -0,0 +1,140 @@ +/*********************************************** + * XQuestCode || Aditya Parmar + * 🚀 © 2024 Aditya Parmar. All Rights Reserved. + * This file is part of the SplashKit Core Library. + * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference + ***********************************************/ + +#include "gpio_driver.h" + +#include +#include +#include // Add this line to include the necessary header for the exit() function + +#ifdef RASPBERRY_PI +#include "pigpiod_if2.h" +#endif + +using namespace std; + +namespace splashkit_lib +{ + int pi; + + // Check if pigpio_init() has been called before any other GPIO functions + void check_pi() + { +#ifdef RASPBERRY_PI + if (pi < 0) + { + cout << "pigpio_init() must be called before any other GPIO functions" << endl; + exit(1); + } +#endif + } + + // Initialize the GPIO library + int sk_gpio_init() + { +#ifdef RASPBERRY_PI + pi = pigpio_start(0, 0); + return pi; +#else + return -1; +#endif + } + + // Read the value of a GPIO pin + int sk_gpio_read(int pin) + { +#ifdef RASPBERRY_PI + check_pi(); + return gpio_read(pi, pin); +#else + cout << "gpio_read() called, but not on a Raspberry Pi" << endl; + return -1; +#endif + } + + // Write a value to a GPIO pin + void sk_gpio_write(int pin, int value) + { +#ifdef RASPBERRY_PI + check_pi(); + gpio_write(pi, pin, value); +#else + cout << "gpio_write() called, but not on a Raspberry Pi" << endl; +#endif + } + + // Set the mode of a GPIO pin + void sk_gpio_set_mode(int pin, int mode) + { +#ifdef RASPBERRY_PI + check_pi(); + set_mode(pi, pin, mode); +#else + cout << "gpio_set_mode() called, but not on a Raspberry Pi" << endl; +#endif + } + int sk_gpio_get_mode(int pin) + { +#ifdef RASPBERRY_PI + check_pi(); + return get_mode(pi, pin); +#else + cout << "gpio_get_mode() called, but not on a Raspberry Pi" << endl; + return -1; +#endif + } + void sk_gpio_set_pull_up_down(int pin, int pud) + { +#ifdef RASPBERRY_PI + check_pi(); + set_pull_up_down(pi, pin, pud); +#else + + cout << "gpio_set_pull_up_down() called, but not on a Raspberry Pi" << endl; +#endif + } + void sk_set_pwm_range(int pin, int range) + { +#ifdef RASPBERRY_PI + check_pi(); + set_PWM_range(pi, pin, range); +#else + cout << "set_PWM_range() called, but not on a Raspberry Pi" << endl; +#endif + } + void sk_set_pwm_frequency(int pin, int frequency) + { +#ifdef RASPBERRY_PI + check_pi(); + set_PWM_frequency(pi, pin, frequency); +#else + cout << "set_PWM_frequency() called, but not on a Raspberry Pi" << endl; +#endif + } + void sk_set_pwm_dutycycle(int pin, int dutycycle) + { +#ifdef RASPBERRY_PI + check_pi(); + set_PWM_dutycycle(pi, pin, dutycycle); +#else + cout << "set_PWM_dutycycle() called, but not on a Raspberry Pi" << endl; +#endif + } + + + // Cleanup the GPIO library + void sk_gpio_cleanup() + { +#ifdef RASPBERRY_PI + check_pi(); + + pigpio_stop(pi); +#else + cout << "pigpio_cleanup() called, but not on a Raspberry Pi" << endl; +#endif + } +} \ No newline at end of file diff --git a/coresdk/src/backend/gpio_driver.h b/coresdk/src/backend/gpio_driver.h new file mode 100644 index 00000000..3e265979 --- /dev/null +++ b/coresdk/src/backend/gpio_driver.h @@ -0,0 +1,24 @@ +/*********************************************** + * XQuestCode || Aditya Parmar + * 🚀 © 2024 Aditya Parmar. All Rights Reserved. + * This file is part of the SplashKit Core Library. + * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference + ***********************************************/ +#ifndef SPLASHKIT_GPIO_H +#define SPLASHKIT_GPIO_H + +#include // Include the appropriate header file for stdint.h +namespace splashkit_lib +{ + int sk_gpio_init(); + int sk_gpio_read(int pin); + void sk_gpio_set_mode(int pin, int mode); + int sk_gpio_get_mode(int pin); + void sk_gpio_set_pull_up_down(int pin, int pud); + void sk_gpio_write(int pin, int value); + void sk_set_pwm_range(int pin, int range); + void sk_set_pwm_frequency(int pin, int frequency); + void sk_set_pwm_dutycycle(int pin, int dutycycle); + void sk_gpio_cleanup(); +} +#endif // SPLASHKIT_sk_gpio_H \ No newline at end of file diff --git a/coresdk/src/coresdk/raspi_gpio.cpp b/coresdk/src/coresdk/raspi_gpio.cpp new file mode 100644 index 00000000..926a82bb --- /dev/null +++ b/coresdk/src/coresdk/raspi_gpio.cpp @@ -0,0 +1,186 @@ +// raspi_gpio.c +/*********************************************** + * XQuestCode || Aditya Parmar + * 🚀 © 2024 Aditya Parmar. All Rights Reserved. + * This file is part of the SplashKit Core Library. + * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference + ***********************************************/ + +#include "raspi_gpio.h" +#include "gpio_driver.h" +#include +using namespace std; +// Each index points to PIN_1, PIN_2, PIN_3, etc. + +namespace splashkit_lib +{ + int BCMpinData[] = { + -1, -1, 2, -1, 3, -2, 4, 14, -2, 15, 17, 18, 27, -2, 22, 23, -1, 24, 10, -2, 9, 25, 11, 8, -2, 7, 0, 1, 5, -2, -6, 12, 13, -2, 19, 16, 26, 20, -2, 21}; + + int boardToBCM(pins pin) + { + if (pin >= PIN_1 && pin <= PIN_40) + { + return BCMpinData[static_cast(pin) - static_cast(PIN_1)]; + } + cout << "Invalid board pin" << endl; + return -1; + } + + // Initialize GPIO resources + void raspi_init() + { + sk_gpio_init(); + } + + // Set the mode of the given pin + void raspi_set_mode(pins pin, pin_modes mode) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + sk_gpio_set_mode(bcmPin, static_cast(mode)); + } + } + pin_modes raspi_get_mode(pins pin) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + return static_cast(sk_gpio_get_mode(bcmPin)); + } + return INPUT; + } + + // Write a value to the given pin + void raspi_write(pins pin, pin_values value) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant write a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant write a Ground pin" << endl; + } + else + { + sk_gpio_write(bcmPin, static_cast(value)); + } + } + + // Read the value of the given pin + pin_values raspi_read(pins pin) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Reading of PIN: " << pin << " would always be HIGH" << endl; + return HIGH; + } + else if (bcmPin == -2) + { + + cout << "Reading of PIN: " << pin << " would always be LOW" << endl; + return LOW; + } + return static_cast(sk_gpio_read(bcmPin)); + } + void raspi_set_pull_up_down(pins pin, pull_up_down pud) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + sk_gpio_set_pull_up_down(bcmPin, static_cast(pud)); + } + } + void raspi_set_pwm_range(pins pin, int range) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + sk_set_pwm_range(bcmPin, range); + } + } + void raspi_set_pwm_frequency(pins pin, int frequency) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + sk_set_pwm_frequency(bcmPin, frequency); + } + } + void raspi_set_pwm_dutycycle(pins pin, int dutycycle) + { + int bcmPin = boardToBCM(pin); + if (bcmPin == -1) + { + cout << "Cant modify a HIGH Pin" << endl; + } + else if (bcmPin == -2) + { + cout << "Cant modify a Ground pin" << endl; + } + else + { + sk_set_pwm_dutycycle(bcmPin, dutycycle); + } + } + + // Cleanup GPIO resources + void raspi_cleanup() + { + cout << "Cleaning GPIO pins" << endl; + for (int i = 1; i <= 40; i++) + { + int bcmPin = boardToBCM(static_cast(i)); + if (bcmPin > 0) + { + raspi_set_mode(static_cast(bcmPin), INPUT); + raspi_write(static_cast(bcmPin), LOW); + } + } + sk_gpio_cleanup(); + } +} diff --git a/coresdk/src/coresdk/raspi_gpio.h b/coresdk/src/coresdk/raspi_gpio.h new file mode 100644 index 00000000..cb327d9a --- /dev/null +++ b/coresdk/src/coresdk/raspi_gpio.h @@ -0,0 +1,95 @@ +/** + * @header raspberry + * @author Aditya Parmar + * @brief Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi. + * + * @attribute group raspberry + * @attribute static raspberry + */ +#ifndef raspi_gpio_h +#define raspi_gpio_h + + +#include // Include the appropriate header file for stdint.h +#include "gpio_driver.h" +#include "types.h" + +namespace splashkit_lib +{ + /** + * @brief Initializes the GPIO library. + */ + void raspi_init(); + + /** + * @brief Sets the mode of the specified pin. + * + * @param pin The pin to set the mode for. + * @param mode The mode to set for the pin. + */ + void raspi_set_mode(pins pin, pin_modes mode); + + /** + * @brief Gets the mode of the specified pin. + * + * @param pin The pin to get the mode for. + * @returns The mode of the pin. + */ + pin_modes raspi_get_mode(pins pin); + + /** + * @brief Writes a value to the specified pin. + * + * @param pin The pin to write the value to. + * @param value The value to write to the pin. + */ + void raspi_write(pins pin, pin_values value); + + /** + * @brief Sets the pull up/down mode for the specified pin. + * + * @param pin The pin to set the pull up/down mode for. + * @param pud The pull up/down mode to set for the pin. + */ + void raspi_set_pull_up_down(pins pin, pull_up_down pud); + + /** + * Sets the PWM range for the specified pin. + * + * @param pin The pin to set the PWM range for. + * @param range The PWM range to set for the pin. + */ + void raspi_set_pwm_range(pins pin, int range); + + /** + * Sets the PWM frequency for the specified pin. + * + * @param pin The pin to set the PWM frequency for. + * @param frequency The PWM frequency to set for the pin. + */ + void raspi_set_pwm_frequency(pins pin, int frequency); + + /** + * Sets the PWM duty cycle for the specified pin. + * + * @param pin The pin to set the PWM duty cycle for. + * @param dutycycle The PWM duty cycle to set for the pin. + */ + void raspi_set_pwm_dutycycle(pins pin, int dutycycle); + + /** + * Reads the value from the specified pin. + * + * @param pin The pin to read the value from. + * @returns The value read from the pin. + */ + pin_values raspi_read(pins pin); + + + + /** + * Cleans up and releases any resources used by the GPIO library ( sets all pin modes to INPUT and values to LOW ). This should be called when you are finished using the GPIO library. + */ + void raspi_cleanup(); +} +#endif // RASPI_GPIO_H \ No newline at end of file diff --git a/coresdk/src/coresdk/rectangle_geometry.h b/coresdk/src/coresdk/rectangle_geometry.h index 50cd23f0..d29eca14 100644 --- a/coresdk/src/coresdk/rectangle_geometry.h +++ b/coresdk/src/coresdk/rectangle_geometry.h @@ -1,4 +1,4 @@ -/** + /** * @header rectangle_geometry * @author Jacob Milligan * @attribute group geometry diff --git a/coresdk/src/coresdk/terminal.cpp b/coresdk/src/coresdk/terminal.cpp index e1183d42..f222c37f 100644 --- a/coresdk/src/coresdk/terminal.cpp +++ b/coresdk/src/coresdk/terminal.cpp @@ -7,15 +7,7 @@ // #include - -#ifdef WINDOWS - #include -#else - #include -#endif - #include "types.h" - #include #include @@ -28,202 +20,9 @@ using std::cin; namespace splashkit_lib { - inline bool operator< (const color& lhs, const color& rhs) - { - if ( lhs.a != rhs.a ) return lhs.a < rhs.a; - if ( lhs.r != rhs.r ) return lhs.r < rhs.r; - if ( lhs.g != rhs.g ) return lhs.g < rhs.g; - if ( lhs.b != rhs.b ) return lhs.b < rhs.b; - return false; - } - - struct color_pair_data - { - int idx; - }; - - static bool _ncurses_active = false; - static map, int> _color_pair_map; - - static map _color_map; - - int map_color(color clr) - { - // Try and find it first... - if ( _color_map.count(clr) > 0 ) - return _color_map[clr]; - - // Now need to register it... - if ( _color_map.size() >= COLORS) - { - LOG(ERROR) << "You have exceeded the number of colors available in the terminal. The terminal only supports " << COLORS << " colors."; - return 0; - } - - int result = static_cast(_color_map.size()); - - short r, g, b; - r = static_cast(clr.r * 1000); - g = static_cast(clr.g * 1000); - b = static_cast(clr.b * 1000); - - init_color(result, r, g, b); - _color_map[clr] = result; - - return result; - } - - int map_color_pair(color fg, color bg) - { - pair clr_pair = pair(fg, bg); - - // Find it? - if ( _color_pair_map.count(clr_pair) > 0 ) - return _color_pair_map[clr_pair]; - - // Create it - int result = static_cast(_color_pair_map.size() + 1); - _color_pair_map[clr_pair] = result; - - init_pair(result, map_color(fg), map_color(bg)); - - return result; - } - - color color_black(); - color color_cyan(); - color color_dark_red(); - color color_green(); - color color_dark_blue(); - color color_dark_cyan(); - color color_dark_gray(); - color color_dark_green(); - color color_yellow(); - color color_light_yellow(); - color color_magenta(); - color color_dark_magenta(); - color color_white(); - color color_gray(); - color color_red(); - color color_blue(); - - void move_cursor_to(int x, int y); - void set_terminal_colors(color foreground, color background); - void set_terminal_bold(bool value); - void set_terminal_echo_input(bool value); - void set_terminal_clear_color(color background); - - void activate_advanced_terminal() - { - if ( _ncurses_active ) return; - - if ( initscr() != nullptr ) - { - _ncurses_active = true; - if ( has_colors() ) - { - start_color(); - use_default_colors(); - - _color_pair_map.clear(); - _color_map.clear(); - - //dull - map_color( color_black() ); - map_color( color_dark_red() ); - map_color( color_dark_green() ); - map_color( color_yellow() ); - map_color( color_dark_blue() ); - map_color( color_dark_magenta() ); - map_color( color_dark_cyan() ); - map_color( color_gray() ); - - //bright - map_color( color_dark_gray() ); - map_color( color_red() ); - map_color( color_green() ); - map_color( color_light_yellow() ); - map_color( color_blue() ); - map_color( color_magenta() ); - map_color( color_cyan() ); - map_color( color_white() ); - - } - else - LOG(WARNING) << "The terminal you are using does not support colors"; - - keypad(stdscr, true); - - set_terminal_echo_input(true); - set_terminal_bold(false); - move_cursor_to(0, 0); - attron(COLOR_PAIR(0)); - bkgdset(COLOR_PAIR(0)); - clear(); - } - else - { - LOG(WARNING) << "Failed to activate advanced terminal."; - } - } - - void set_terminal_echo_input(bool value) - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to set echo status"; - return; - } - - if ( value ) echo(); - else noecho(); - } - - void clear_terminal() - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to clear the terminal"; - return; - } - - clear(); - } - - void refresh_terminal() - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to refresh the terminal"; - return; - } - - refresh(); - } - - bool advanced_terminal_active() - { - return _ncurses_active; - } - - void end_advanced_terminal() - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must have activated advanced terminal before ending them"; - return; - } - - endwin(); - _ncurses_active = false; - } - void write(string text) { - if ( _ncurses_active ) - printw("%s", text.c_str()); - else - cout << text; + cout << text; } void write(int data) @@ -243,18 +42,12 @@ namespace splashkit_lib void write_line() { - if (_ncurses_active ) - printw("\n"); - else - cout << endl; + cout << endl; } void write_line(string line) { - if (_ncurses_active ) - printw("%s\n", line.c_str()); - else - cout << line << endl; + cout << line << endl; } void write_line(int data) @@ -272,103 +65,17 @@ namespace splashkit_lib write_line(string("") + data); } - int terminal_width() - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to get terminal width"; - return 0; - } - - int x, y; - getmaxyx(stdscr,y,x); - - return x; - } - - int terminal_height() - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to get terminal height"; - return 0; - } - int x, y; - getmaxyx(stdscr,y,x); - return y; - } - - void set_terminal_colors(color foreground, color background) - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to print bold text"; - return; - } - if ( not can_change_color() ) - { - LOG(WARNING) << "Unable to change terminal colors in this Terminal"; - return; - } - - int pair = map_color_pair(foreground, background); - attron(COLOR_PAIR(pair)); - bkgdset(COLOR_PAIR(pair)); - } - - void set_terminal_bold(bool value) - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to print bold text"; - return; - } - - if (value) attron(A_BOLD); - else attroff(A_BOLD); - } - - void move_cursor_to(int x, int y) - { - if ( not _ncurses_active ) - { - LOG(WARNING) << "You must activate advanced terminal features to move within the terminal"; - return; - } - - move(y, x); - } - - void write_at(string text, int x, int y) - { - move_cursor_to(x, y); - write(text); - } - string read_line() { - if ( not _ncurses_active ) - { - string result; - getline(std::cin, result); - return result; - } - else - { - char line[2096]; - getnstr(line, 2095); - return string(line); - } + string result; + getline(std::cin, result); + return result; } char read_char() { char result = 0; - if ( not _ncurses_active ) - cin >> result; - else - result = getch(); - + cin >> result; return result; } } diff --git a/coresdk/src/coresdk/terminal.h b/coresdk/src/coresdk/terminal.h index 1c38dcb4..8f568577 100644 --- a/coresdk/src/coresdk/terminal.h +++ b/coresdk/src/coresdk/terminal.h @@ -18,82 +18,6 @@ using std::string; namespace splashkit_lib { - /** - * Start using the advanced terminal. Once you call this you will need - * to make sure you call `refresh_terminal` to show anything you have - * written. This will allow use of colors, bold, positioning, and other - * advanced options. - */ - void activate_advanced_terminal(); - - /** - * Is the terminal currently in advanced mode? - * - * @return True if the terminal is in advanced mode. - */ - bool advanced_terminal_active(); - - /** - * Finish using advanced mode. The existing terminal display will be lost - * and the user will see what was in the terminal before you called - * `activate_advanced_terminal`. - */ - void end_advanced_terminal(); - - /** - * In advanced mode, this will move the cursor to a given col, row of the - * terminal. You can check the terminal size using `terminal_width` and - * `terminal_height`. If you try to move outside this bounds then then move - * will not occur. - * - * @param x The column to move to, must be between 0 and `terminal_width` - * @param y The row to move to, must be between 0 and `terminal_height` - */ - void move_cursor_to(int x, int y); - - /** - * In advanced mode, this will display what has been written to the - * terminal. You need to call this for anything to be shown in advanced - * mode. - */ - void refresh_terminal(); - - /** - * In advanced mode, this will clear the terminal to the background color - * you set in `set_terminal_color`. - */ - void clear_terminal(); - - /** - * In advanced mode, this gives you the number of columns in the terminal. - * - * @return The number of columns in the terminal - */ - int terminal_width(); - - /** - * In advanced mode, this gives you the number of rows in the terminal. - * - * @return The number of rows in the terminal - */ - int terminal_height(); - - /** - * In advanced mode, this allows you to set if the text should draw as bold. - * - * @param value Pass true to have the terminal write in bold - */ - void set_terminal_bold(bool value); - - /** - * In advanced mode, this allows you to stop text read with `read_char` - * appearing on the terminal. You can use this for reading passwords, or to - * control what is written. - * - * @param value Pass true if you want characters to appear as typed. - */ - void set_terminal_echo_input(bool value); - /** * Write the supplied text to the Terminal. * @@ -169,77 +93,6 @@ namespace splashkit_lib */ void write_line(char data); - /** - * In advanced mode, this will write the supplied text at the indicated - * column and row. - * - * @param text The text to write - * @param x The row to position the text at - * @param y The column to position the text at - */ - void write_at(string text, int x, int y); - - /** - * In advanced mode this allows you to set the color of the foreground and - * the background. The foreground is the color of the text. - * - * - * Note that only the following colors are guaranteed to work on all - * Terminals (others may work): - * - * - * - `color_black` - * - * - * - `color_dark_gray` - * - * - * - `color_gray` - * - * - * - `color_white` - * - * - * - `color_red` - * - * - * - `color_dark_red` - * - * - * - `color_green` - * - * - * - `color_dark_green` - * - * - * - `color_blue` - * - * - * - `color_dark_blue` - * - * - * - `color_cyan` - * - * - * - `color_dark_cyan` - * - * - * - `color_light_yellow` - * - * - * - `color_yellow` - * - * - * - `color_magenta` - * - * - * - `color_dark_magenta` - * - * - * @param foreground The color of text that is drawn. - * @param background The color of the background behind drawn text. - */ - void set_terminal_colors(color foreground, color background); /** * Read a line of text from the terminal. The user will see the text as @@ -250,9 +103,7 @@ namespace splashkit_lib string read_line(); /** - * Get a single character input by the user. This works in both standard and - * advanced modes. In advanced mode, you can set if the character should - * also be echoed to the terminal using `set_terminal_echo_input`. + * Get a single character input by the user. * * @return The character typed by the user. */ diff --git a/coresdk/src/coresdk/types.h b/coresdk/src/coresdk/types.h index 569c4076..3ee82206 100644 --- a/coresdk/src/coresdk/types.h +++ b/coresdk/src/coresdk/types.h @@ -61,10 +61,10 @@ namespace splashkit_lib */ enum font_style { - NORMAL_FONT = 0, - BOLD_FONT = 1, - ITALIC_FONT = 2, - UNDERLINE_FONT = 4 + NORMAL_FONT = 0, + BOLD_FONT = 1, + ITALIC_FONT = 2, + UNDERLINE_FONT = 4 }; /** @@ -219,9 +219,9 @@ namespace splashkit_lib */ enum drawing_dest { - DRAW_TO_SCREEN, // no camera effect - DRAW_TO_WORLD, // camera effect - DRAW_DEFAULT // camera effect on screen, but not on bitmaps + DRAW_TO_SCREEN, // no camera effect + DRAW_TO_WORLD, // camera effect + DRAW_DEFAULT // camera effect on screen, but not on bitmaps }; /** @@ -249,20 +249,20 @@ namespace splashkit_lib */ struct drawing_options { - void *dest; // The bitmap or window used to draw on to - float scale_x; // Scale data - float scale_y; // - float angle; // Angle for rotations - float anchor_offset_x; // Centre point for rotations - float anchor_offset_y; // - bool flip_x; // Flip data - bool flip_y; // - bool is_part; // Draw just a part? - rectangle part; // Part to draw - int draw_cell; // The cell to draw - overridden by animation or part - drawing_dest camera; // Draw to world or screen coordinates (camera has effect?) - int line_width; // Specify the width of line drawings. - animation anim; // The animation for bitmap drawing + void *dest; // The bitmap or window used to draw on to + float scale_x; // Scale data + float scale_y; // + float angle; // Angle for rotations + float anchor_offset_x; // Centre point for rotations + float anchor_offset_y; // + bool flip_x; // Flip data + bool flip_y; // + bool is_part; // Draw just a part? + rectangle part; // Part to draw + int draw_cell; // The cell to draw - overridden by animation or part + drawing_dest camera; // Draw to world or screen coordinates (camera has effect?) + int line_width; // Specify the width of line drawings. + animation anim; // The animation for bitmap drawing }; /** @@ -316,4 +316,141 @@ namespace splashkit_lib HTTP_STATUS_SERVICE_UNAVAILABLE = 503 }; } +/** + * Raspberry Pi GPIO Board Pin Descriptions: + * + * @constant PIN_1 - 3.3V Power Supply + * @constant PIN_2 - 5V Power Supply + * @constant PIN_3 - GPIO2 / SDA (I2C) + * @constant PIN_4 - 5V Power Supply + * @constant PIN_5 - GPIO3 / SCL (I2C) + * @constant PIN_6 - Ground + * @constant PIN_7 - GPIO4 + * @constant PIN_8 - GPIO14 / TXD (UART) + * @constant PIN_9 - Ground + * @constant PIN_10 - GPIO15 / RXD (UART) + * @constant PIN_11 - GPIO17 + * @constant PIN_12 - GPIO18 / PCM_CLK + * @constant PIN_13 - GPIO27 + * @constant PIN_14 - Ground + * @constant PIN_15 - GPIO22 + * @constant PIN_16 - GPIO23 + * @constant PIN_17 - 3.3V Power Supply + * @constant PIN_18 - GPIO24 + * @constant PIN_19 - GPIO10 / MOSI (SPI) + * @constant PIN_20 - Ground + * @constant PIN_21 - GPIO9 / MISO (SPI) + * @constant PIN_22 - GPIO25 + * @constant PIN_23 - GPIO11 / SCLK (SPI) + * @constant PIN_24 - GPIO8 / CE0 (SPI) + * @constant PIN_25 - Ground + * @constant PIN_26 - GPIO7 / CE1 (SPI) + * @constant PIN_27 - ID_SD (I2C ID EEPROM) + * @constant PIN_28 - ID_SC (I2C ID EEPROM) + * @constant PIN_29 - GPIO5 + * @constant PIN_30 - Ground + * @constant PIN_31 - GPIO6 + * @constant PIN_32 - GPIO12 + * @constant PIN_33 - GPIO13 + * @constant PIN_34 - Ground + * @constant PIN_35 - GPIO19 / MISO (PCM) + * @constant PIN_36 - GPIO16 / CE0 (PCM) + * @constant PIN_37 - GPIO26 + * @constant PIN_38 - GPIO20 / MOSI (PCM) + * @constant PIN_39 - Ground + * @constant PIN_40 - GPIO21 / SCLK (PCM) + */ +enum pins +{ + PIN_1 = 1, + PIN_2 = 2, + PIN_3 = 3, + PIN_4 = 4, + PIN_5 = 5, + PIN_6 = 6, + PIN_7 = 7, + PIN_8 = 8, + PIN_9 = 9, + PIN_10 = 10, + PIN_11 = 11, + PIN_12 = 12, + PIN_13 = 13, + PIN_14 = 14, + PIN_15 = 15, + PIN_16 = 16, + PIN_17 = 17, + PIN_18 = 18, + PIN_19 = 19, + PIN_20 = 20, + PIN_21 = 21, + PIN_22 = 22, + PIN_23 = 23, + PIN_24 = 24, + PIN_25 = 25, + PIN_26 = 26, + PIN_27 = 27, + PIN_28 = 28, + PIN_29 = 29, + PIN_30 = 30, + PIN_31 = 31, + PIN_32 = 32, + PIN_33 = 33, + PIN_34 = 34, + PIN_35 = 35, + PIN_36 = 36, + PIN_37 = 37, + PIN_38 = 38, + PIN_39 = 39, + PIN_40 = 40, +}; +/** + * GPIO Pin Modes: + * + * @constant INPUT - Input mode. + * @constant OUTPUT - Output mode. + * @constant ALT0 - Alternate function mode 0. + * @constant ALT1 - Alternate function mode 1. + * @constant ALT2 - Alternate function mode 2. + * @constant ALT3 - Alternate function mode 3. + * @constant ALT4 - Alternate function mode 4. + * @constant ALT5 - Alternate function mode 5. + */ + +enum pin_modes +{ + INPUT = 0, + OUTPUT = 1, + ALT0 = 4, + ALT1 = 5, + ALT2 = 6, + ALT3 = 7, + ALT4 = 3, + ALT5 = 2 +}; + +/** + * GPIO Pin Values: + * + * @constant LOW - Logic low (0). + * @constant HIGH - Logic high (1). + */ +enum pin_values +{ + LOW = 0, + HIGH = 1 +}; +/** + * GPIO Pull-up/Pull-down Configurations: + * + * @constant PUD_OFF - No pull-up or pull-down resistor. + * @constant PUD_DOWN - Enable pull-down resistor. + * @constant PUD_UP - Enable pull-up resistor. + */ +enum pull_up_down +{ + PUD_OFF = 0, + PUD_DOWN = 1, + PUD_UP = 2 +}; + #endif /* types_hpp */ diff --git a/coresdk/src/coresdk/vector_2d.cpp b/coresdk/src/coresdk/vector_2d.cpp index 18f4a6be..bc013818 100644 --- a/coresdk/src/coresdk/vector_2d.cpp +++ b/coresdk/src/coresdk/vector_2d.cpp @@ -12,7 +12,6 @@ #include "line_geometry.h" #include "circle_geometry.h" #include "utility_functions.h" - #include using std::to_string; diff --git a/coresdk/src/keynote_code.cpp b/coresdk/src/keynote_code.cpp index a5aeff6e..89db4ee0 100644 --- a/coresdk/src/keynote_code.cpp +++ b/coresdk/src/keynote_code.cpp @@ -10,7 +10,6 @@ void test_bitmaps() draw_bitmap("background", 0, 0); - refresh_screen(); } diff --git a/coresdk/src/test/test_main.cpp b/coresdk/src/test/test_main.cpp index 2071f2b3..5afe93b8 100644 --- a/coresdk/src/test/test_main.cpp +++ b/coresdk/src/test/test_main.cpp @@ -52,6 +52,7 @@ void setup_tests() add_test("RESTful Web Service", run_restful_web_service); add_test("UDP Networking Test", run_udp_networking_test); add_test("TCP Networking Test", run_tcp_networking_test); + add_test("GPIO Tests", run_gpio_tests); } diff --git a/coresdk/src/test/test_main.h b/coresdk/src/test/test_main.h index 2a44834a..7e1924f7 100644 --- a/coresdk/src/test/test_main.h +++ b/coresdk/src/test/test_main.h @@ -32,7 +32,7 @@ void run_networking_test(); void run_restful_web_service(); void run_udp_networking_test(); void run_tcp_networking_test(); - +void run_gpio_tests(); void run_terminal_test(); void run_logging_test(); diff --git a/coresdk/src/test/test_raspi_gpio.cpp b/coresdk/src/test/test_raspi_gpio.cpp new file mode 100644 index 00000000..58fc6862 --- /dev/null +++ b/coresdk/src/test/test_raspi_gpio.cpp @@ -0,0 +1,44 @@ +/*********************************************** +* XQuestCode || Aditya Parmar +* Code with Creativity +* 🚀 © 2024 Aditya Parmar. All Rights Reserved. +***********************************************/ +#include +#include "raspi_gpio.h" +using namespace std; +using namespace splashkit_lib; + +// Function to run GPIO tests +void run_gpio_tests() +{ + // Initialize the GPIO + cout << "Initializing GPIO" << endl; + raspi_init(); + + // Set GPIO pin 11 as an output + cout << "Setting GPIO pin 11 as an output" << endl; + raspi_set_mode(PIN_11, OUTPUT); + + // Read the initial value of GPIO pin 11 + int defaultValue = raspi_read(PIN_11); + cout << "Value of Pin 11: " << defaultValue << endl; + + // Write HIGH to GPIO pin 11 + cout << "Writing HIGH to GPIO pin 11" << endl; + raspi_write(PIN_11, HIGH); + + // Read the value of GPIO pin 11 + int value = raspi_read(PIN_11); + cout << "GPIO 11 value: " << value << endl; + + // Write HIGH to GPIO pin 17 + cout << "Writing HIGH to GPIO pin 17" << endl; + raspi_write(PIN_17, HIGH); + + // Write HIGH to Ground PIN + cout << "Writing HIGH to Ground PIN" << endl; + raspi_write(PIN_6, HIGH); + + // Clean up the GPIO + raspi_cleanup(); +} \ No newline at end of file diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index b26648ff..8920a344 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -8,16 +8,14 @@ #include "terminal.h" #include "utils.h" -#include "color.h" #include -using namespace std; +using namespace std; using namespace splashkit_lib; void test_simple_terminal() { write_line("Hello World!" + to_string(10)); - write("Hello"); write(" "); write("World!"); @@ -26,56 +24,10 @@ void test_simple_terminal() write('a'); write_line(); write_line('c'); - - if ( advanced_terminal_active() ) - { - refresh_terminal(); - } - - delay(1000); -} - -void test_advanced_terminal() -{ - move_cursor_to(34, 10); - - set_terminal_colors(COLOR_RED, COLOR_GREEN); - clear_terminal(); - write_line("Hello World!"); - - write_at("Enter Name:", 34, 11); - move_cursor_to(34, 12); - refresh_terminal(); - - set_terminal_colors(COLOR_WHITE, COLOR_GREEN); - string name = read_line(); - - clear_terminal(); - - - write_at("HELLO", (terminal_width() - 5) / 2, 1); - set_terminal_bold(true); - write_at(name, static_cast(terminal_width() - name.length()) / 2 , terminal_height() / 2); - set_terminal_bold(false); - - refresh_terminal(); - delay(1000); - end_advanced_terminal(); } void run_terminal_test() { - int go = 0; - - cout << "Activate advanced terminal (1-yes, 0-no): "; - cin >> go; - - if ( go != 0 ) - { - activate_advanced_terminal(); - } - test_simple_terminal(); - test_advanced_terminal(); } diff --git a/projects/Xcode/splashkit.xcodeproj/project.pbxproj b/projects/Xcode/splashkit.xcodeproj/project.pbxproj index 7a43a24f..058a2b13 100644 --- a/projects/Xcode/splashkit.xcodeproj/project.pbxproj +++ b/projects/Xcode/splashkit.xcodeproj/project.pbxproj @@ -2232,7 +2232,7 @@ ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-static", - "-lncurses", + ); PRODUCT_NAME = "$(TARGET_NAME)"; WARNING_CFLAGS = "-Wall"; @@ -2277,7 +2277,7 @@ ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-static", - "-lncurses", + ); PRODUCT_NAME = "$(TARGET_NAME)"; WARNING_CFLAGS = "-Wall"; @@ -2297,7 +2297,6 @@ ); OTHER_LDFLAGS = ( "-lcurl", - "-lncurses", ); PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2316,7 +2315,6 @@ ); OTHER_LDFLAGS = ( "-lcurl", - "-lncurses", ); PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2532,7 +2530,6 @@ "-ferror-limit=9999", ); OTHER_LDFLAGS = ( - "-lncurses", "-lcurl", ); PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2564,7 +2561,6 @@ "-ferror-limit=9999", ); OTHER_LDFLAGS = ( - "-lncurses", "-lcurl", ); PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/projects/cmake/CMakeLists.txt b/projects/cmake/CMakeLists.txt index a80ecdaa..85a1cc26 100644 --- a/projects/cmake/CMakeLists.txt +++ b/projects/cmake/CMakeLists.txt @@ -17,6 +17,9 @@ if (WIN32 OR MSYS OR MINGW) add_definitions(-DWINDOWS) endif() +# Check for Raspberry Pi +include(CheckIncludeFile) +find_path(BCM_HOST_INCLUDE_DIR bcm_host.h PATHS "/opt/vc/include") #### SETUP #### if (APPLE) # MAC OS PROJECT FLAGS @@ -97,6 +100,60 @@ else() -lstdc++fs") endif() +if (BCM_HOST_INCLUDE_DIR) + message("Raspberry Pi detected") + + find_path(pigpio_INCLUDE_DIR NAMES pigpio.h pigpiod_if.h pigpiod_if2.h HINTS /usr/include) + + # Find the pigpio libraries. + find_library(pigpio_LIBRARY NAMES libpigpio.so HINTS /usr/lib) + + find_library(pigpiod_if_LIBRARY NAMES libpigpiod_if.so HINTS /usr/lib) + find_library(pigpiod_if2_LIBRARY NAMES libpigpiod_if2.so HINTS /usr/lib) + if(pigpiod_if2_LIBRARY) + set(pigpiod_if_LIBRARY ${pigpiod_if2_LIBRARY}) + # target_link_libraries(SplashKitBackend ${LIB_FLAGS} pigpiod_if2) + endif() + + + + # Add necessary directories for Raspberry Pi + include_directories(/usr/include) + # target_link_libraries(/usr/lib) + # target_link_libraries(SplashKitBackend ${LIB_FLAGS} pigpio) + link_directories(/user/lib) + # include_directories("/opt/vc/include") + + # link_directories("/opt/vc/lib") + set(LIB_FLAGS "-lSDL2 \ + -lSDL2_mixer \ + -lSDL2_ttf \ + -lSDL2_gfx \ + -lSDL2_image \ + -lSDL2_net \ + -lpthread \ + -lbz2 \ + -lFLAC \ + -lvorbis \ + -lz \ + -lpng16 \ + -lvorbisfile \ + -logg \ + -lwebp \ + -lfreetype \ + -lcurl \ + -ldl \ + -lstdc++fs\ + -lpigpiod_if2") +# Add -Wall and -pthread options +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") + # Define RASPBERRY_PI + add_definitions(-DRASPBERRY_PI) +else() + message("Raspberry Pi not detected") +endif() + + # FLAGS set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") From cfeda36c8a43aa2b11b5cfeb41a59f168cd9f15d Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Tue, 23 Jan 2024 13:42:09 +1100 Subject: [PATCH 2/6] Update GPIO pin modes and values --- coresdk/src/coresdk/raspi_gpio.cpp | 10 +++---- coresdk/src/coresdk/types.h | 43 ++++++++++++++-------------- coresdk/src/test/test_raspi_gpio.cpp | 8 +++--- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/coresdk/src/coresdk/raspi_gpio.cpp b/coresdk/src/coresdk/raspi_gpio.cpp index 926a82bb..58927354 100644 --- a/coresdk/src/coresdk/raspi_gpio.cpp +++ b/coresdk/src/coresdk/raspi_gpio.cpp @@ -65,7 +65,7 @@ namespace splashkit_lib { return static_cast(sk_gpio_get_mode(bcmPin)); } - return INPUT; + return GPIO_INPUT; } // Write a value to the given pin @@ -93,13 +93,13 @@ namespace splashkit_lib if (bcmPin == -1) { cout << "Reading of PIN: " << pin << " would always be HIGH" << endl; - return HIGH; + return GPIO_HIGH; } else if (bcmPin == -2) { cout << "Reading of PIN: " << pin << " would always be LOW" << endl; - return LOW; + return GPIO_LOW; } return static_cast(sk_gpio_read(bcmPin)); } @@ -177,8 +177,8 @@ namespace splashkit_lib int bcmPin = boardToBCM(static_cast(i)); if (bcmPin > 0) { - raspi_set_mode(static_cast(bcmPin), INPUT); - raspi_write(static_cast(bcmPin), LOW); + raspi_set_mode(static_cast(bcmPin), GPIO_INPUT); + raspi_write(static_cast(bcmPin), GPIO_LOW); } } sk_gpio_cleanup(); diff --git a/coresdk/src/coresdk/types.h b/coresdk/src/coresdk/types.h index 3ee82206..16119fd5 100644 --- a/coresdk/src/coresdk/types.h +++ b/coresdk/src/coresdk/types.h @@ -403,41 +403,42 @@ enum pins PIN_39 = 39, PIN_40 = 40, }; +#include + /** * GPIO Pin Modes: * - * @constant INPUT - Input mode. - * @constant OUTPUT - Output mode. - * @constant ALT0 - Alternate function mode 0. - * @constant ALT1 - Alternate function mode 1. - * @constant ALT2 - Alternate function mode 2. - * @constant ALT3 - Alternate function mode 3. - * @constant ALT4 - Alternate function mode 4. - * @constant ALT5 - Alternate function mode 5. + * @constant GPIO_INPUT - Input mode. + * @constant GPIO_OUTPUT - Output mode. + * @constant GPIO_ALT0 - Alternate function mode 0. + * @constant GPIO_ALT1 - Alternate function mode 1. + * @constant GPIO_ALT2 - Alternate function mode 2. + * @constant GPIO_ALT3 - Alternate function mode 3. + * @constant GPIO_ALT4 - Alternate function mode 4. + * @constant GPIO_ALT5 - Alternate function mode 5. */ - enum pin_modes { - INPUT = 0, - OUTPUT = 1, - ALT0 = 4, - ALT1 = 5, - ALT2 = 6, - ALT3 = 7, - ALT4 = 3, - ALT5 = 2 + GPIO_INPUT = 0, + GPIO_OUTPUT = 1, + GPIO_ALT0 = 4, + GPIO_ALT1 = 5, + GPIO_ALT2 = 6, + GPIO_ALT3 = 7, + GPIO_ALT4 = 3, + GPIO_ALT5 = 2 }; /** * GPIO Pin Values: * - * @constant LOW - Logic low (0). - * @constant HIGH - Logic high (1). + * @constant GPIO_LOW - Logic low (0). + * @constant GPIO_HIGH - Logic high (1). */ enum pin_values { - LOW = 0, - HIGH = 1 + GPIO_LOW = 0, + GPIO_HIGH = 1 }; /** * GPIO Pull-up/Pull-down Configurations: diff --git a/coresdk/src/test/test_raspi_gpio.cpp b/coresdk/src/test/test_raspi_gpio.cpp index 58fc6862..a32924cd 100644 --- a/coresdk/src/test/test_raspi_gpio.cpp +++ b/coresdk/src/test/test_raspi_gpio.cpp @@ -17,7 +17,7 @@ void run_gpio_tests() // Set GPIO pin 11 as an output cout << "Setting GPIO pin 11 as an output" << endl; - raspi_set_mode(PIN_11, OUTPUT); + raspi_set_mode(PIN_11, GPIO_OUTPUT); // Read the initial value of GPIO pin 11 int defaultValue = raspi_read(PIN_11); @@ -25,7 +25,7 @@ void run_gpio_tests() // Write HIGH to GPIO pin 11 cout << "Writing HIGH to GPIO pin 11" << endl; - raspi_write(PIN_11, HIGH); + raspi_write(PIN_11, GPIO_HIGH); // Read the value of GPIO pin 11 int value = raspi_read(PIN_11); @@ -33,11 +33,11 @@ void run_gpio_tests() // Write HIGH to GPIO pin 17 cout << "Writing HIGH to GPIO pin 17" << endl; - raspi_write(PIN_17, HIGH); + raspi_write(PIN_17, GPIO_HIGH); // Write HIGH to Ground PIN cout << "Writing HIGH to Ground PIN" << endl; - raspi_write(PIN_6, HIGH); + raspi_write(PIN_6, GPIO_HIGH); // Clean up the GPIO raspi_cleanup(); From a4bf1076372ec0a4ebab367bf6b99704c3c475f0 Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Tue, 23 Jan 2024 16:04:34 +1100 Subject: [PATCH 3/6] Update pin mode and value mappings --- generated/clib/lib_type_mapper.cpp | 24 + generated/clib/lib_type_mapper.h | 8 + generated/clib/sk_clib.cpp | 48 -- generated/clib/sk_clib.h | 16 +- generated/cpp/adapter_type_mapper.cpp | 24 + generated/cpp/adapter_type_mapper.h | 8 + generated/cpp/splashkit.cpp | 49 -- generated/cpp/terminal.h | 13 - generated/cpp/types.h | 61 ++ generated/csharp/SplashKit.cs | 194 +++--- generated/docs/api.json | 885 ++++++++------------------ generated/pascal/splashkit.pas | 197 +++--- generated/python/splashkit.py | 149 +++-- generated/translator_cache.json | 757 +++++++++------------- tools/scripts/deploy-website.sh | 8 + 15 files changed, 986 insertions(+), 1455 deletions(-) diff --git a/generated/clib/lib_type_mapper.cpp b/generated/clib/lib_type_mapper.cpp index 5aee98b4..b729922e 100644 --- a/generated/clib/lib_type_mapper.cpp +++ b/generated/clib/lib_type_mapper.cpp @@ -257,6 +257,30 @@ int __sklib__to_sklib_http_status_code(http_status_code v) { http_status_code __sklib__to_http_status_code(int v) { return static_cast(v); } +int __sklib__to_sklib_pin_modes(pin_modes v) { + return static_cast(v); +} +pin_modes __sklib__to_pin_modes(int v) { + return static_cast(v); +} +int __sklib__to_sklib_pin_values(pin_values v) { + return static_cast(v); +} +pin_values __sklib__to_pin_values(int v) { + return static_cast(v); +} +int __sklib__to_sklib_pins(pins v) { + return static_cast(v); +} +pins __sklib__to_pins(int v) { + return static_cast(v); +} +int __sklib__to_sklib_pull_up_down(pull_up_down v) { + return static_cast(v); +} +pull_up_down __sklib__to_pull_up_down(int v) { + return static_cast(v); +} int __sklib__to_sklib_http_method(http_method v) { return static_cast(v); } diff --git a/generated/clib/lib_type_mapper.h b/generated/clib/lib_type_mapper.h index 6ffc7a76..7698cd10 100644 --- a/generated/clib/lib_type_mapper.h +++ b/generated/clib/lib_type_mapper.h @@ -144,6 +144,14 @@ int __sklib__to_sklib_font_style(font_style v); font_style __sklib__to_font_style(int v); int __sklib__to_sklib_http_status_code(http_status_code v); http_status_code __sklib__to_http_status_code(int v); +int __sklib__to_sklib_pin_modes(pin_modes v); +pin_modes __sklib__to_pin_modes(int v); +int __sklib__to_sklib_pin_values(pin_values v); +pin_values __sklib__to_pin_values(int v); +int __sklib__to_sklib_pins(pins v); +pins __sklib__to_pins(int v); +int __sklib__to_sklib_pull_up_down(pull_up_down v); +pull_up_down __sklib__to_pull_up_down(int v); int __sklib__to_sklib_http_method(http_method v); http_method __sklib__to_http_method(int v); __sklib_matrix_2d __sklib__to_sklib_matrix_2d(matrix_2d v); diff --git a/generated/clib/sk_clib.cpp b/generated/clib/sk_clib.cpp index da97571b..3421af56 100644 --- a/generated/clib/sk_clib.cpp +++ b/generated/clib/sk_clib.cpp @@ -4915,24 +4915,6 @@ __sklib_vector_2d __sklib__vector_from_to__sprite__sprite(__sklib_sprite s1, __s vector_2d __skreturn = vector_from_to(__skparam__s1, __skparam__s2); return __sklib__to_sklib_vector_2d(__skreturn); } -void __sklib__activate_advanced_terminal() { - activate_advanced_terminal(); -} -int __sklib__advanced_terminal_active() { - bool __skreturn = advanced_terminal_active(); - return __sklib__to_int(__skreturn); -} -void __sklib__clear_terminal() { - clear_terminal(); -} -void __sklib__end_advanced_terminal() { - end_advanced_terminal(); -} -void __sklib__move_cursor_to__int__int(int x, int y) { - int __skparam__x = __sklib__to_int(x); - int __skparam__y = __sklib__to_int(y); - move_cursor_to(__skparam__x, __skparam__y); -} char __sklib__read_char() { char __skreturn = read_char(); return __sklib__to_char(__skreturn); @@ -4941,30 +4923,6 @@ __sklib_string __sklib__read_line() { string __skreturn = read_line(); return __sklib__to_sklib_string(__skreturn); } -void __sklib__refresh_terminal() { - refresh_terminal(); -} -void __sklib__set_terminal_bold__bool(int value) { - bool __skparam__value = __sklib__to_bool(value); - set_terminal_bold(__skparam__value); -} -void __sklib__set_terminal_colors__color__color(__sklib_color foreground, __sklib_color background) { - color __skparam__foreground = __sklib__to_color(foreground); - color __skparam__background = __sklib__to_color(background); - set_terminal_colors(__skparam__foreground, __skparam__background); -} -void __sklib__set_terminal_echo_input__bool(int value) { - bool __skparam__value = __sklib__to_bool(value); - set_terminal_echo_input(__skparam__value); -} -int __sklib__terminal_height() { - int __skreturn = terminal_height(); - return __sklib__to_int(__skreturn); -} -int __sklib__terminal_width() { - int __skreturn = terminal_width(); - return __sklib__to_int(__skreturn); -} void __sklib__write__char(char data) { char __skparam__data = __sklib__to_char(data); write(__skparam__data); @@ -4981,12 +4939,6 @@ void __sklib__write__string(__sklib_string text) { string __skparam__text = __sklib__to_string(text); write(__skparam__text); } -void __sklib__write_at__string__int__int(__sklib_string text, int x, int y) { - string __skparam__text = __sklib__to_string(text); - int __skparam__x = __sklib__to_int(x); - int __skparam__y = __sklib__to_int(y); - write_at(__skparam__text, __skparam__x, __skparam__y); -} void __sklib__write_line__char(char data) { char __skparam__data = __sklib__to_char(data); write_line(__skparam__data); diff --git a/generated/clib/sk_clib.h b/generated/clib/sk_clib.h index b2c2f5c0..f9a91f88 100644 --- a/generated/clib/sk_clib.h +++ b/generated/clib/sk_clib.h @@ -58,6 +58,10 @@ typedef int __sklib_sprite_event_kind; typedef int __sklib_drawing_dest; typedef int __sklib_font_style; typedef int __sklib_http_status_code; +typedef int __sklib_pin_modes; +typedef int __sklib_pin_values; +typedef int __sklib_pins; +typedef int __sklib_pull_up_down; typedef int __sklib_http_method; typedef struct { __sklib_double elements[9]; @@ -1081,24 +1085,12 @@ void __sklib__update_sprite_animation__sprite__float(__sklib_sprite s, float pct void __sklib__update_sprite_animation__sprite__float__bool(__sklib_sprite s, float pct, int with_sound); __sklib_vector_2d __sklib__vector_from_center_sprite_to_point__sprite__point_2d_ref(__sklib_sprite s, const __sklib_point_2d pt); __sklib_vector_2d __sklib__vector_from_to__sprite__sprite(__sklib_sprite s1, __sklib_sprite s2); -void __sklib__activate_advanced_terminal(); -int __sklib__advanced_terminal_active(); -void __sklib__clear_terminal(); -void __sklib__end_advanced_terminal(); -void __sklib__move_cursor_to__int__int(int x, int y); char __sklib__read_char(); __sklib_string __sklib__read_line(); -void __sklib__refresh_terminal(); -void __sklib__set_terminal_bold__bool(int value); -void __sklib__set_terminal_colors__color__color(__sklib_color foreground, __sklib_color background); -void __sklib__set_terminal_echo_input__bool(int value); -int __sklib__terminal_height(); -int __sklib__terminal_width(); void __sklib__write__char(char data); void __sklib__write__double(double data); void __sklib__write__int(int data); void __sklib__write__string(__sklib_string text); -void __sklib__write_at__string__int__int(__sklib_string text, int x, int y); void __sklib__write_line__char(char data); void __sklib__write_line(); void __sklib__write_line__double(double data); diff --git a/generated/cpp/adapter_type_mapper.cpp b/generated/cpp/adapter_type_mapper.cpp index 7af93681..ff8884d2 100644 --- a/generated/cpp/adapter_type_mapper.cpp +++ b/generated/cpp/adapter_type_mapper.cpp @@ -258,6 +258,30 @@ int __skadapter__to_sklib_http_status_code(http_status_code v) { http_status_code __skadapter__to_http_status_code(int v) { return static_cast(v); } +int __skadapter__to_sklib_pin_modes(pin_modes v) { + return static_cast(v); +} +pin_modes __skadapter__to_pin_modes(int v) { + return static_cast(v); +} +int __skadapter__to_sklib_pin_values(pin_values v) { + return static_cast(v); +} +pin_values __skadapter__to_pin_values(int v) { + return static_cast(v); +} +int __skadapter__to_sklib_pins(pins v) { + return static_cast(v); +} +pins __skadapter__to_pins(int v) { + return static_cast(v); +} +int __skadapter__to_sklib_pull_up_down(pull_up_down v) { + return static_cast(v); +} +pull_up_down __skadapter__to_pull_up_down(int v) { + return static_cast(v); +} int __skadapter__to_sklib_http_method(http_method v) { return static_cast(v); } diff --git a/generated/cpp/adapter_type_mapper.h b/generated/cpp/adapter_type_mapper.h index 5e1442f6..4f32a3c3 100644 --- a/generated/cpp/adapter_type_mapper.h +++ b/generated/cpp/adapter_type_mapper.h @@ -95,6 +95,14 @@ int __skadapter__to_sklib_font_style(font_style v); font_style __skadapter__to_font_style(int v); int __skadapter__to_sklib_http_status_code(http_status_code v); http_status_code __skadapter__to_http_status_code(int v); +int __skadapter__to_sklib_pin_modes(pin_modes v); +pin_modes __skadapter__to_pin_modes(int v); +int __skadapter__to_sklib_pin_values(pin_values v); +pin_values __skadapter__to_pin_values(int v); +int __skadapter__to_sklib_pins(pins v); +pins __skadapter__to_pins(int v); +int __skadapter__to_sklib_pull_up_down(pull_up_down v); +pull_up_down __skadapter__to_pull_up_down(int v); int __skadapter__to_sklib_http_method(http_method v); http_method __skadapter__to_http_method(int v); __sklib_matrix_2d __skadapter__to_sklib_matrix_2d(matrix_2d v); diff --git a/generated/cpp/splashkit.cpp b/generated/cpp/splashkit.cpp index 001cef13..e2ff3fea 100644 --- a/generated/cpp/splashkit.cpp +++ b/generated/cpp/splashkit.cpp @@ -5089,24 +5089,6 @@ vector_2d vector_from_to(sprite s1, sprite s2) { __sklib_vector_2d __skreturn = __sklib__vector_from_to__sprite__sprite(__skparam__s1, __skparam__s2); return __skadapter__to_vector_2d(__skreturn); } -void activate_advanced_terminal() { - __sklib__activate_advanced_terminal(); -} -bool advanced_terminal_active() { - int __skreturn = __sklib__advanced_terminal_active(); - return __skadapter__to_bool(__skreturn); -} -void clear_terminal() { - __sklib__clear_terminal(); -} -void end_advanced_terminal() { - __sklib__end_advanced_terminal(); -} -void move_cursor_to(int x, int y) { - int __skparam__x = __skadapter__to_int(x); - int __skparam__y = __skadapter__to_int(y); - __sklib__move_cursor_to__int__int(__skparam__x, __skparam__y); -} char read_char() { char __skreturn = __sklib__read_char(); return __skadapter__to_char(__skreturn); @@ -5115,30 +5097,6 @@ string read_line() { __sklib_string __skreturn = __sklib__read_line(); return __skadapter__to_string(__skreturn); } -void refresh_terminal() { - __sklib__refresh_terminal(); -} -void set_terminal_bold(bool value) { - int __skparam__value = __skadapter__to_int(value); - __sklib__set_terminal_bold__bool(__skparam__value); -} -void set_terminal_colors(color foreground, color background) { - __sklib_color __skparam__foreground = __skadapter__to_sklib_color(foreground); - __sklib_color __skparam__background = __skadapter__to_sklib_color(background); - __sklib__set_terminal_colors__color__color(__skparam__foreground, __skparam__background); -} -void set_terminal_echo_input(bool value) { - int __skparam__value = __skadapter__to_int(value); - __sklib__set_terminal_echo_input__bool(__skparam__value); -} -int terminal_height() { - int __skreturn = __sklib__terminal_height(); - return __skadapter__to_int(__skreturn); -} -int terminal_width() { - int __skreturn = __sklib__terminal_width(); - return __skadapter__to_int(__skreturn); -} void write(char data) { char __skparam__data = __skadapter__to_char(data); __sklib__write__char(__skparam__data); @@ -5156,13 +5114,6 @@ void write(string text) { __sklib__write__string(__skparam__text); __skadapter__free__sklib_string(__skparam__text); } -void write_at(string text, int x, int y) { - __sklib_string __skparam__text = __skadapter__to_sklib_string(text); - int __skparam__x = __skadapter__to_int(x); - int __skparam__y = __skadapter__to_int(y); - __sklib__write_at__string__int__int(__skparam__text, __skparam__x, __skparam__y); - __skadapter__free__sklib_string(__skparam__text); -} void write_line(char data) { char __skparam__data = __skadapter__to_char(data); __sklib__write_line__char(__skparam__data); diff --git a/generated/cpp/terminal.h b/generated/cpp/terminal.h index c21013c5..0b38a6be 100644 --- a/generated/cpp/terminal.h +++ b/generated/cpp/terminal.h @@ -6,31 +6,18 @@ #ifndef __terminal_h #define __terminal_h -#include "types.h" #include #include #include using std::string; using std::vector; -void activate_advanced_terminal(); -bool advanced_terminal_active(); -void clear_terminal(); -void end_advanced_terminal(); -void move_cursor_to(int x, int y); char read_char(); string read_line(); -void refresh_terminal(); -void set_terminal_bold(bool value); -void set_terminal_colors(color foreground, color background); -void set_terminal_echo_input(bool value); -int terminal_height(); -int terminal_width(); void write(char data); void write(double data); void write(int data); void write(string text); -void write_at(string text, int x, int y); void write_line(char data); void write_line(); void write_line(double data); diff --git a/generated/cpp/types.h b/generated/cpp/types.h index b2d2b8f4..fd6dce76 100644 --- a/generated/cpp/types.h +++ b/generated/cpp/types.h @@ -51,6 +51,67 @@ typedef enum { HTTP_STATUS_NOT_IMPLEMENTED = 501, HTTP_STATUS_SERVICE_UNAVAILABLE = 503 } http_status_code; +typedef enum { + GPIO_INPUT = 0, + GPIO_OUTPUT = 1, + GPIO_ALT0 = 4, + GPIO_ALT1 = 5, + GPIO_ALT2 = 6, + GPIO_ALT3 = 7, + GPIO_ALT4 = 3, + GPIO_ALT5 = 2 +} pin_modes; +typedef enum { + GPIO_LOW = 0, + GPIO_HIGH = 1 +} pin_values; +typedef enum { + PIN_1 = 1, + PIN_2 = 2, + PIN_3 = 3, + PIN_4 = 4, + PIN_5 = 5, + PIN_6 = 6, + PIN_7 = 7, + PIN_8 = 8, + PIN_9 = 9, + PIN_10 = 10, + PIN_11 = 11, + PIN_12 = 12, + PIN_13 = 13, + PIN_14 = 14, + PIN_15 = 15, + PIN_16 = 16, + PIN_17 = 17, + PIN_18 = 18, + PIN_19 = 19, + PIN_20 = 20, + PIN_21 = 21, + PIN_22 = 22, + PIN_23 = 23, + PIN_24 = 24, + PIN_25 = 25, + PIN_26 = 26, + PIN_27 = 27, + PIN_28 = 28, + PIN_29 = 29, + PIN_30 = 30, + PIN_31 = 31, + PIN_32 = 32, + PIN_33 = 33, + PIN_34 = 34, + PIN_35 = 35, + PIN_36 = 36, + PIN_37 = 37, + PIN_38 = 38, + PIN_39 = 39, + PIN_40 = 40 +} pins; +typedef enum { + PUD_OFF = 0, + PUD_DOWN = 1, + PUD_UP = 2 +} pull_up_down; typedef struct { double x; double y; diff --git a/generated/csharp/SplashKit.cs b/generated/csharp/SplashKit.cs index d9073c33..bd71bf4e 100644 --- a/generated/csharp/SplashKit.cs +++ b/generated/csharp/SplashKit.cs @@ -118,6 +118,26 @@ public static class SplashKit [MethodImpl(MethodImplOptions.AggressiveInlining)] private static HttpStatusCode __skadapter__to_http_status_code(int v) { return (HttpStatusCode)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int __skadapter__to_sklib_pin_modes(PinModes v) { return (int)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static PinModes __skadapter__to_pin_modes(int v) { return (PinModes)v; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int __skadapter__to_sklib_pin_values(PinValues v) { return (int)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static PinValues __skadapter__to_pin_values(int v) { return (PinValues)v; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int __skadapter__to_sklib_pins(Pins v) { return (int)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static Pins __skadapter__to_pins(int v) { return (Pins)v; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int __skadapter__to_sklib_pull_up_down(PullUpDown v) { return (int)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static PullUpDown __skadapter__to_pull_up_down(int v) { return (PullUpDown)v; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int __skadapter__to_sklib_http_method(HttpMethod v) { return (int)v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -3752,45 +3772,12 @@ private static void __skadapter__update_from_vector_bool(ref __sklib_vector_bool [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__vector_from_to__sprite__sprite", CharSet=CharSet.Ansi)] private static extern __sklib_vector_2d __sklib__vector_from_to__sprite__sprite(__sklib_ptr s1, __sklib_ptr s2); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__activate_advanced_terminal", CharSet=CharSet.Ansi)] - private static extern void __sklib__activate_advanced_terminal(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__advanced_terminal_active", CharSet=CharSet.Ansi)] - private static extern int __sklib__advanced_terminal_active(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__clear_terminal", CharSet=CharSet.Ansi)] - private static extern void __sklib__clear_terminal(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__end_advanced_terminal", CharSet=CharSet.Ansi)] - private static extern void __sklib__end_advanced_terminal(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__move_cursor_to__int__int", CharSet=CharSet.Ansi)] - private static extern void __sklib__move_cursor_to__int__int(int x, int y); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__read_char", CharSet=CharSet.Ansi)] private static extern char __sklib__read_char(); [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__read_line", CharSet=CharSet.Ansi)] private static extern __sklib_string __sklib__read_line(); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__refresh_terminal", CharSet=CharSet.Ansi)] - private static extern void __sklib__refresh_terminal(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__set_terminal_bold__bool", CharSet=CharSet.Ansi)] - private static extern void __sklib__set_terminal_bold__bool(int value); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__set_terminal_colors__color__color", CharSet=CharSet.Ansi)] - private static extern void __sklib__set_terminal_colors__color__color(__sklib_color foreground, __sklib_color background); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__set_terminal_echo_input__bool", CharSet=CharSet.Ansi)] - private static extern void __sklib__set_terminal_echo_input__bool(int value); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__terminal_height", CharSet=CharSet.Ansi)] - private static extern int __sklib__terminal_height(); - - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__terminal_width", CharSet=CharSet.Ansi)] - private static extern int __sklib__terminal_width(); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__write__char", CharSet=CharSet.Ansi)] private static extern void __sklib__write__char(char data); @@ -3803,9 +3790,6 @@ private static void __skadapter__update_from_vector_bool(ref __sklib_vector_bool [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__write__string", CharSet=CharSet.Ansi)] private static extern void __sklib__write__string(__sklib_string text); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__write_at__string__int__int", CharSet=CharSet.Ansi)] - private static extern void __sklib__write_at__string__int__int(__sklib_string text, int x, int y); - [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__write_line__char", CharSet=CharSet.Ansi)] private static extern void __sklib__write_line__char(char data); @@ -12649,32 +12633,6 @@ public static Vector2D VectorFromTo(Sprite s1, Sprite s2) __skreturn = __sklib__vector_from_to__sprite__sprite(__skparam__s1, __skparam__s2); return __skadapter__to_vector_2d(__skreturn); } - public static void ActivateAdvancedTerminal() - { - __sklib__activate_advanced_terminal(); - } - public static bool AdvancedTerminalActive() - { - int __skreturn; - __skreturn = __sklib__advanced_terminal_active(); - return __skadapter__to_bool(__skreturn); - } - public static void ClearTerminal() - { - __sklib__clear_terminal(); - } - public static void EndAdvancedTerminal() - { - __sklib__end_advanced_terminal(); - } - public static void MoveCursorTo(int x, int y) - { - int __skparam__x; - int __skparam__y; - __skparam__x = __skadapter__to_sklib_int(x); - __skparam__y = __skadapter__to_sklib_int(y); - __sklib__move_cursor_to__int__int(__skparam__x, __skparam__y); - } public static char ReadChar() { char __skreturn; @@ -12687,42 +12645,6 @@ public static string ReadLine() __skreturn = __sklib__read_line(); return __skadapter__to_string(__skreturn); } - public static void RefreshTerminal() - { - __sklib__refresh_terminal(); - } - public static void SetTerminalBold(bool value) - { - int __skparam__value; - __skparam__value = __skadapter__to_sklib_bool(value); - __sklib__set_terminal_bold__bool(__skparam__value); - } - public static void SetTerminalColors(Color foreground, Color background) - { - __sklib_color __skparam__foreground; - __sklib_color __skparam__background; - __skparam__foreground = __skadapter__to_sklib_color(foreground); - __skparam__background = __skadapter__to_sklib_color(background); - __sklib__set_terminal_colors__color__color(__skparam__foreground, __skparam__background); - } - public static void SetTerminalEchoInput(bool value) - { - int __skparam__value; - __skparam__value = __skadapter__to_sklib_bool(value); - __sklib__set_terminal_echo_input__bool(__skparam__value); - } - public static int TerminalHeight() - { - int __skreturn; - __skreturn = __sklib__terminal_height(); - return __skadapter__to_int(__skreturn); - } - public static int TerminalWidth() - { - int __skreturn; - __skreturn = __sklib__terminal_width(); - return __skadapter__to_int(__skreturn); - } public static void Write(char data) { char __skparam__data; @@ -12748,17 +12670,6 @@ public static void Write(string text) __sklib__write__string(__skparam__text); __skadapter__free__sklib_string(ref __skparam__text); } - public static void WriteAt(string text, int x, int y) - { - __sklib_string __skparam__text; - int __skparam__x; - int __skparam__y; - __skparam__text = __skadapter__to_sklib_string(text); - __skparam__x = __skadapter__to_sklib_int(x); - __skparam__y = __skadapter__to_sklib_int(y); - __sklib__write_at__string__int__int(__skparam__text, __skparam__x, __skparam__y); - __skadapter__free__sklib_string(ref __skparam__text); - } public static void WriteLine(char data) { char __skparam__data; @@ -15341,6 +15252,71 @@ public enum HttpStatusCode HttpStatusNotImplemented = 501, HttpStatusServiceUnavailable = 503 } + public enum PinModes + { + GpioInput = 0, + GpioOutput = 1, + GpioAlt0 = 4, + GpioAlt1 = 5, + GpioAlt2 = 6, + GpioAlt3 = 7, + GpioAlt4 = 3, + GpioAlt5 = 2 + } + public enum PinValues + { + GpioLow = 0, + GpioHigh = 1 + } + public enum Pins + { + Pin1 = 1, + Pin2 = 2, + Pin3 = 3, + Pin4 = 4, + Pin5 = 5, + Pin6 = 6, + Pin7 = 7, + Pin8 = 8, + Pin9 = 9, + Pin10 = 10, + Pin11 = 11, + Pin12 = 12, + Pin13 = 13, + Pin14 = 14, + Pin15 = 15, + Pin16 = 16, + Pin17 = 17, + Pin18 = 18, + Pin19 = 19, + Pin20 = 20, + Pin21 = 21, + Pin22 = 22, + Pin23 = 23, + Pin24 = 24, + Pin25 = 25, + Pin26 = 26, + Pin27 = 27, + Pin28 = 28, + Pin29 = 29, + Pin30 = 30, + Pin31 = 31, + Pin32 = 32, + Pin33 = 33, + Pin34 = 34, + Pin35 = 35, + Pin36 = 36, + Pin37 = 37, + Pin38 = 38, + Pin39 = 39, + Pin40 = 40 + } + public enum PullUpDown + { + PudOff = 0, + PudDown = 1, + PudUp = 2 + } public enum HttpMethod { HttpGetMethod, diff --git a/generated/docs/api.json b/generated/docs/api.json index 800107de..3f16960b 100644 --- a/generated/docs/api.json +++ b/generated/docs/api.json @@ -70957,524 +70957,17 @@ "description": "", "functions": [ { - "signature": "void activate_advanced_terminal();", - "name": "activate_advanced_terminal", - "method_name": null, - "unique_global_name": "activate_advanced_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "Start using the advanced terminal. Once you call this you will need\nto make sure you call `refresh_terminal` to show anything you have\nwritten. This will allow use of colors, bold, positioning, and other\nadvanced options.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def activate_advanced_terminal():" - ], - "pascal": [ - "procedure ActivateAdvancedTerminal()" - ], - "csharp": [ - "public static void Terminal.ActivateAdvancedTerminal();", - "public static void SplashKit.ActivateAdvancedTerminal();" - ], - "cpp": [ - "void activate_advanced_terminal()" - ] - } - }, - { - "signature": "bool advanced_terminal_active();", - "name": "advanced_terminal_active", - "method_name": null, - "unique_global_name": "advanced_terminal_active", - "unique_method_name": null, - "suffix_name": null, - "description": "Is the terminal currently in advanced mode?", - "brief": null, - "return": { - "type": "bool", - "description": "True if the terminal is in advanced mode.", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def advanced_terminal_active():" - ], - "pascal": [ - "function AdvancedTerminalActive(): Boolean" - ], - "csharp": [ - "public static bool Terminal.AdvancedTerminalActive();", - "public static bool SplashKit.AdvancedTerminalActive();" - ], - "cpp": [ - "bool advanced_terminal_active()" - ] - } - }, - { - "signature": "void clear_terminal();", - "name": "clear_terminal", - "method_name": null, - "unique_global_name": "clear_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will clear the terminal to the background color\nyou set in `set_terminal_color`.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def clear_terminal():" - ], - "pascal": [ - "procedure ClearTerminal()" - ], - "csharp": [ - "public static void Terminal.ClearTerminal();", - "public static void SplashKit.ClearTerminal();" - ], - "cpp": [ - "void clear_terminal()" - ] - } - }, - { - "signature": "void end_advanced_terminal();", - "name": "end_advanced_terminal", - "method_name": null, - "unique_global_name": "end_advanced_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "Finish using advanced mode. The existing terminal display will be lost\nand the user will see what was in the terminal before you called\n`activate_advanced_terminal`.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def end_advanced_terminal():" - ], - "pascal": [ - "procedure EndAdvancedTerminal()" - ], - "csharp": [ - "public static void Terminal.EndAdvancedTerminal();", - "public static void SplashKit.EndAdvancedTerminal();" - ], - "cpp": [ - "void end_advanced_terminal()" - ] - } - }, - { - "signature": "void move_cursor_to(int x,int y);", - "name": "move_cursor_to", - "method_name": null, - "unique_global_name": "move_cursor_to", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will move the cursor to a given col, row of the\nterminal. You can check the terminal size using `terminal_width` and\n`terminal_height`. If you try to move outside this bounds then then move\nwill not occur.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "x": { - "type": "int", - "description": "The column to move to, must be between 0 and `terminal_width`", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "y": { - "type": "int", - "description": "The row to move to, must be between 0 and `terminal_height`", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def move_cursor_to(x, y):" - ], - "pascal": [ - "procedure MoveCursorTo(x: Integer; y: Integer)" - ], - "csharp": [ - "public static void Terminal.MoveCursorTo(int x, int y);", - "public static void SplashKit.MoveCursorTo(int x, int y);" - ], - "cpp": [ - "void move_cursor_to(int x, int y)" - ] - } - }, - { - "signature": "char read_char();", - "name": "read_char", - "method_name": null, - "unique_global_name": "read_char", - "unique_method_name": null, - "suffix_name": null, - "description": "Get a single character input by the user. This works in both standard and\nadvanced modes. In advanced mode, you can set if the character should\nalso be echoed to the terminal using `set_terminal_echo_input`.", - "brief": null, - "return": { - "type": "char", - "description": "The character typed by the user.", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def read_char():" - ], - "pascal": [ - "function ReadChar(): Char" - ], - "csharp": [ - "public static char Terminal.ReadChar();", - "public static char SplashKit.ReadChar();" - ], - "cpp": [ - "char read_char()" - ] - } - }, - { - "signature": "string read_line();", - "name": "read_line", - "method_name": null, - "unique_global_name": "read_line", - "unique_method_name": null, - "suffix_name": null, - "description": "Read a line of text from the terminal. The user will see the text as\nthey type it.", - "brief": null, - "return": { - "type": "string", - "description": "The text entered by the user.", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def read_line():" - ], - "pascal": [ - "function ReadLine(): String" - ], - "csharp": [ - "public static string Terminal.ReadLine();", - "public static string SplashKit.ReadLine();" - ], - "cpp": [ - "string read_line()" - ] - } - }, - { - "signature": "void refresh_terminal();", - "name": "refresh_terminal", - "method_name": null, - "unique_global_name": "refresh_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will display what has been written to the\nterminal. You need to call this for anything to be shown in advanced\nmode.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def refresh_terminal():" - ], - "pascal": [ - "procedure RefreshTerminal()" - ], - "csharp": [ - "public static void Terminal.RefreshTerminal();", - "public static void SplashKit.RefreshTerminal();" - ], - "cpp": [ - "void refresh_terminal()" - ] - } - }, - { - "signature": "void set_terminal_bold(bool value);", - "name": "set_terminal_bold", - "method_name": null, - "unique_global_name": "set_terminal_bold", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this allows you to set if the text should draw as bold.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "value": { - "type": "bool", - "description": "Pass true to have the terminal write in bold", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def set_terminal_bold(value):" - ], - "pascal": [ - "procedure SetTerminalBold(value: Boolean)" - ], - "csharp": [ - "public static void Terminal.SetTerminalBold(bool value);", - "public static void SplashKit.SetTerminalBold(bool value);" - ], - "cpp": [ - "void set_terminal_bold(bool value)" - ] - } - }, - { - "signature": "void set_terminal_colors(color foreground,color background);", - "name": "set_terminal_colors", - "method_name": null, - "unique_global_name": "set_terminal_colors", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode this allows you to set the color of the foreground and\nthe background. The foreground is the color of the text.\n\n\nNote that only the following colors are guaranteed to work on all\nTerminals (others may work):\n\n\n- `color_black`\n\n\n- `color_dark_gray`\n\n\n- `color_gray`\n\n\n- `color_white`\n\n\n- `color_red`\n\n\n- `color_dark_red`\n\n\n- `color_green`\n\n\n- `color_dark_green`\n\n\n- `color_blue`\n\n\n- `color_dark_blue`\n\n\n- `color_cyan`\n\n\n- `color_dark_cyan`\n\n\n- `color_light_yellow`\n\n\n- `color_yellow`\n\n\n- `color_magenta`\n\n\n- `color_dark_magenta`", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "foreground": { - "type": "color", - "description": "The color of text that is drawn.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "background": { - "type": "color", - "description": "The color of the background behind drawn text.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def set_terminal_colors(foreground, background):" - ], - "pascal": [ - "procedure SetTerminalColors(foreground: Color; background: Color)" - ], - "csharp": [ - "public static void Terminal.SetTerminalColors(Color foreground, Color background);", - "public static void SplashKit.SetTerminalColors(Color foreground, Color background);" - ], - "cpp": [ - "void set_terminal_colors(color foreground, color background)" - ] - } - }, - { - "signature": "void set_terminal_echo_input(bool value);", - "name": "set_terminal_echo_input", - "method_name": null, - "unique_global_name": "set_terminal_echo_input", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this allows you to stop text read with `read_char`\nappearing on the terminal. You can use this for reading passwords, or to\ncontrol what is written.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "value": { - "type": "bool", - "description": "Pass true if you want characters to appear as typed.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def set_terminal_echo_input(value):" - ], - "pascal": [ - "procedure SetTerminalEchoInput(value: Boolean)" - ], - "csharp": [ - "public static void Terminal.SetTerminalEchoInput(bool value);", - "public static void SplashKit.SetTerminalEchoInput(bool value);" - ], - "cpp": [ - "void set_terminal_echo_input(bool value)" - ] - } - }, - { - "signature": "int terminal_height();", - "name": "terminal_height", + "signature": "char read_char();", + "name": "read_char", "method_name": null, - "unique_global_name": "terminal_height", + "unique_global_name": "read_char", "unique_method_name": null, "suffix_name": null, - "description": "In advanced mode, this gives you the number of rows in the terminal.", + "description": "Get a single character input by the user.", "brief": null, "return": { - "type": "int", - "description": "The number of rows in the terminal", + "type": "char", + "description": "The character typed by the user.", "is_pointer": false, "is_reference": false, "is_vector": false, @@ -71488,32 +70981,32 @@ }, "signatures": { "python": [ - "def terminal_height():" + "def read_char():" ], "pascal": [ - "function TerminalHeight(): Integer" + "function ReadChar(): Char" ], "csharp": [ - "public static int Terminal.TerminalHeight();", - "public static int SplashKit.TerminalHeight();" + "public static char Terminal.ReadChar();", + "public static char SplashKit.ReadChar();" ], "cpp": [ - "int terminal_height()" + "char read_char()" ] } }, { - "signature": "int terminal_width();", - "name": "terminal_width", + "signature": "string read_line();", + "name": "read_line", "method_name": null, - "unique_global_name": "terminal_width", + "unique_global_name": "read_line", "unique_method_name": null, "suffix_name": null, - "description": "In advanced mode, this gives you the number of columns in the terminal.", + "description": "Read a line of text from the terminal. The user will see the text as\nthey type it.", "brief": null, "return": { - "type": "int", - "description": "The number of columns in the terminal", + "type": "string", + "description": "The text entered by the user.", "is_pointer": false, "is_reference": false, "is_vector": false, @@ -71527,17 +71020,17 @@ }, "signatures": { "python": [ - "def terminal_width():" + "def read_line():" ], "pascal": [ - "function TerminalWidth(): Integer" + "function ReadLine(): String" ], "csharp": [ - "public static int Terminal.TerminalWidth();", - "public static int SplashKit.TerminalWidth();" + "public static string Terminal.ReadLine();", + "public static string SplashKit.ReadLine();" ], "cpp": [ - "int terminal_width()" + "string read_line()" ] } }, @@ -71752,84 +71245,6 @@ ] } }, - { - "signature": "void write_at(string text,int x,int y);", - "name": "write_at", - "method_name": null, - "unique_global_name": "write_at", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will write the supplied text at the indicated\ncolumn and row.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "text": { - "type": "string", - "description": "The text to write", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "x": { - "type": "int", - "description": "The row to position the text at", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "y": { - "type": "int", - "description": "The column to position the text at", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - }, - "signatures": { - "python": [ - "def write_at(text, x, y):" - ], - "pascal": [ - "procedure WriteAt(text: String; x: Integer; y: Integer)" - ], - "csharp": [ - "public static void Terminal.WriteAt(string text, int x, int y);", - "public static void SplashKit.WriteAt(string text, int x, int y);" - ], - "cpp": [ - "void write_at(string text, int x, int y)" - ] - } - }, { "signature": "void write_line(char data);", "name": "write_line", @@ -81162,6 +80577,262 @@ "attributes": { "group": "types" } + }, + { + "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2};", + "name": "pin_modes", + "description": "GPIO Pin Modes:", + "brief": null, + "constants": { + "GPIO_INPUT": { + "description": "- Input mode.", + "number": 0 + }, + "GPIO_OUTPUT": { + "description": "- Output mode.", + "number": 1 + }, + "GPIO_ALT0": { + "description": "- Alternate function mode 0.", + "number": 4 + }, + "GPIO_ALT1": { + "description": "- Alternate function mode 1.", + "number": 5 + }, + "GPIO_ALT2": { + "description": "- Alternate function mode 2.", + "number": 6 + }, + "GPIO_ALT3": { + "description": "- Alternate function mode 3.", + "number": 7 + }, + "GPIO_ALT4": { + "description": "- Alternate function mode 4.", + "number": 3 + }, + "GPIO_ALT5": { + "description": "- Alternate function mode 5.", + "number": 2 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1};", + "name": "pin_values", + "description": "GPIO Pin Values:", + "brief": null, + "constants": { + "GPIO_LOW": { + "description": "- Logic low (0).", + "number": 0 + }, + "GPIO_HIGH": { + "description": "- Logic high (1).", + "number": 1 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pins {PIN_1 = 1,PIN_2 = 2,PIN_3 = 3,PIN_4 = 4,PIN_5 = 5,PIN_6 = 6,PIN_7 = 7,PIN_8 = 8,PIN_9 = 9,PIN_10 = 10,PIN_11 = 11,PIN_12 = 12,PIN_13 = 13,PIN_14 = 14,PIN_15 = 15,PIN_16 = 16,PIN_17 = 17,PIN_18 = 18,PIN_19 = 19,PIN_20 = 20,PIN_21 = 21,PIN_22 = 22,PIN_23 = 23,PIN_24 = 24,PIN_25 = 25,PIN_26 = 26,PIN_27 = 27,PIN_28 = 28,PIN_29 = 29,PIN_30 = 30,PIN_31 = 31,PIN_32 = 32,PIN_33 = 33,PIN_34 = 34,PIN_35 = 35,PIN_36 = 36,PIN_37 = 37,PIN_38 = 38,PIN_39 = 39,PIN_40 = 40,};", + "name": "pins", + "description": "Raspberry Pi GPIO Board Pin Descriptions:", + "brief": null, + "constants": { + "PIN_1": { + "description": "- 3.3V Power Supply", + "number": 1 + }, + "PIN_2": { + "description": "- 5V Power Supply", + "number": 2 + }, + "PIN_3": { + "description": "- GPIO2 / SDA (I2C)", + "number": 3 + }, + "PIN_4": { + "description": "- 5V Power Supply", + "number": 4 + }, + "PIN_5": { + "description": "- GPIO3 / SCL (I2C)", + "number": 5 + }, + "PIN_6": { + "description": "- Ground", + "number": 6 + }, + "PIN_7": { + "description": "- GPIO4", + "number": 7 + }, + "PIN_8": { + "description": "- GPIO14 / TXD (UART)", + "number": 8 + }, + "PIN_9": { + "description": "- Ground", + "number": 9 + }, + "PIN_10": { + "description": "- GPIO15 / RXD (UART)", + "number": 10 + }, + "PIN_11": { + "description": "- GPIO17", + "number": 11 + }, + "PIN_12": { + "description": "- GPIO18 / PCM_CLK", + "number": 12 + }, + "PIN_13": { + "description": "- GPIO27", + "number": 13 + }, + "PIN_14": { + "description": "- Ground", + "number": 14 + }, + "PIN_15": { + "description": "- GPIO22", + "number": 15 + }, + "PIN_16": { + "description": "- GPIO23", + "number": 16 + }, + "PIN_17": { + "description": "- 3.3V Power Supply", + "number": 17 + }, + "PIN_18": { + "description": "- GPIO24", + "number": 18 + }, + "PIN_19": { + "description": "- GPIO10 / MOSI (SPI)", + "number": 19 + }, + "PIN_20": { + "description": "- Ground", + "number": 20 + }, + "PIN_21": { + "description": "- GPIO9 / MISO (SPI)", + "number": 21 + }, + "PIN_22": { + "description": "- GPIO25", + "number": 22 + }, + "PIN_23": { + "description": "- GPIO11 / SCLK (SPI)", + "number": 23 + }, + "PIN_24": { + "description": "- GPIO8 / CE0 (SPI)", + "number": 24 + }, + "PIN_25": { + "description": "- Ground", + "number": 25 + }, + "PIN_26": { + "description": "- GPIO7 / CE1 (SPI)", + "number": 26 + }, + "PIN_27": { + "description": "- ID_SD (I2C ID EEPROM)", + "number": 27 + }, + "PIN_28": { + "description": "- ID_SC (I2C ID EEPROM)", + "number": 28 + }, + "PIN_29": { + "description": "- GPIO5", + "number": 29 + }, + "PIN_30": { + "description": "- Ground", + "number": 30 + }, + "PIN_31": { + "description": "- GPIO6", + "number": 31 + }, + "PIN_32": { + "description": "- GPIO12", + "number": 32 + }, + "PIN_33": { + "description": "- GPIO13", + "number": 33 + }, + "PIN_34": { + "description": "- Ground", + "number": 34 + }, + "PIN_35": { + "description": "- GPIO19 / MISO (PCM)", + "number": 35 + }, + "PIN_36": { + "description": "- GPIO16 / CE0 (PCM)", + "number": 36 + }, + "PIN_37": { + "description": "- GPIO26", + "number": 37 + }, + "PIN_38": { + "description": "- GPIO20 / MOSI (PCM)", + "number": 38 + }, + "PIN_39": { + "description": "- Ground", + "number": 39 + }, + "PIN_40": { + "description": "- GPIO21 / SCLK (PCM)", + "number": 40 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pull_up_down {PUD_OFF = 0,PUD_DOWN = 1,PUD_UP = 2};", + "name": "pull_up_down", + "description": "GPIO Pull-up/Pull-down Configurations:", + "brief": null, + "constants": { + "PUD_OFF": { + "description": "- No pull-up or pull-down resistor.", + "number": 0 + }, + "PUD_DOWN": { + "description": "- Enable pull-down resistor.", + "number": 1 + }, + "PUD_UP": { + "description": "- Enable pull-up resistor.", + "number": 2 + } + }, + "attributes": { + "group": "types" + } } ], "defines": [ diff --git a/generated/pascal/splashkit.pas b/generated/pascal/splashkit.pas index d33af015..ab306274 100644 --- a/generated/pascal/splashkit.pas +++ b/generated/pascal/splashkit.pas @@ -245,6 +245,67 @@ type __sklib_window__record_type = record end; HTTP_STATUS_NOT_IMPLEMENTED = 501, HTTP_STATUS_SERVICE_UNAVAILABLE = 503 ); +type PinModes = ( + GPIO_INPUT = 0, + GPIO_OUTPUT = 1, + GPIO_ALT0 = 4, + GPIO_ALT1 = 5, + GPIO_ALT2 = 6, + GPIO_ALT3 = 7, + GPIO_ALT4 = 3, + GPIO_ALT5 = 2 +); +type PinValues = ( + GPIO_LOW = 0, + GPIO_HIGH = 1 +); +type Pins = ( + PIN_1 = 1, + PIN_2 = 2, + PIN_3 = 3, + PIN_4 = 4, + PIN_5 = 5, + PIN_6 = 6, + PIN_7 = 7, + PIN_8 = 8, + PIN_9 = 9, + PIN_10 = 10, + PIN_11 = 11, + PIN_12 = 12, + PIN_13 = 13, + PIN_14 = 14, + PIN_15 = 15, + PIN_16 = 16, + PIN_17 = 17, + PIN_18 = 18, + PIN_19 = 19, + PIN_20 = 20, + PIN_21 = 21, + PIN_22 = 22, + PIN_23 = 23, + PIN_24 = 24, + PIN_25 = 25, + PIN_26 = 26, + PIN_27 = 27, + PIN_28 = 28, + PIN_29 = 29, + PIN_30 = 30, + PIN_31 = 31, + PIN_32 = 32, + PIN_33 = 33, + PIN_34 = 34, + PIN_35 = 35, + PIN_36 = 36, + PIN_37 = 37, + PIN_38 = 38, + PIN_39 = 39, + PIN_40 = 40 +); +type PullUpDown = ( + PUD_OFF = 0, + PUD_DOWN = 1, + PUD_UP = 2 +); type HttpMethod = ( HTTP_GET_METHOD, HTTP_POST_METHOD, @@ -1234,24 +1295,12 @@ procedure UpdateSpriteAnimation(s: Sprite; pct: Single); procedure UpdateSpriteAnimation(s: Sprite; pct: Single; withSound: Boolean); function VectorFromCenterSpriteToPoint(s: Sprite; const pt: Point2D): Vector2D; function VectorFromTo(s1: Sprite; s2: Sprite): Vector2D; -procedure ActivateAdvancedTerminal(); -function AdvancedTerminalActive(): Boolean; -procedure ClearTerminal(); -procedure EndAdvancedTerminal(); -procedure MoveCursorTo(x: Integer; y: Integer); function ReadChar(): Char; function ReadLine(): String; -procedure RefreshTerminal(); -procedure SetTerminalBold(value: Boolean); -procedure SetTerminalColors(foreground: Color; background: Color); -procedure SetTerminalEchoInput(value: Boolean); -function TerminalHeight(): Integer; -function TerminalWidth(): Integer; procedure Write(data: Char); procedure Write(data: Double); procedure Write(data: Integer); procedure Write(text: String); -procedure WriteAt(text: String; x: Integer; y: Integer); procedure WriteLine(data: Char); procedure WriteLine(); procedure WriteLine(data: Double); @@ -1748,6 +1797,38 @@ function __skadapter__to_sklib_http_status_code(v: HttpStatusCode): LongInt; begin result := Integer(v); end; +function __skadapter__to_pin_modes(v: LongInt): PinModes; +begin + result := PinModes(v); +end; +function __skadapter__to_sklib_pin_modes(v: PinModes): LongInt; +begin + result := Integer(v); +end; +function __skadapter__to_pin_values(v: LongInt): PinValues; +begin + result := PinValues(v); +end; +function __skadapter__to_sklib_pin_values(v: PinValues): LongInt; +begin + result := Integer(v); +end; +function __skadapter__to_pins(v: LongInt): Pins; +begin + result := Pins(v); +end; +function __skadapter__to_sklib_pins(v: Pins): LongInt; +begin + result := Integer(v); +end; +function __skadapter__to_pull_up_down(v: LongInt): PullUpDown; +begin + result := PullUpDown(v); +end; +function __skadapter__to_sklib_pull_up_down(v: PullUpDown): LongInt; +begin + result := Integer(v); +end; function __skadapter__to_http_method(v: LongInt): HttpMethod; begin result := HttpMethod(v); @@ -3320,24 +3401,12 @@ procedure __sklib__update_sprite_animation__sprite__float(s: __sklib_ptr; pct: S procedure __sklib__update_sprite_animation__sprite__float__bool(s: __sklib_ptr; pct: Single; withSound: LongInt); cdecl; external; function __sklib__vector_from_center_sprite_to_point__sprite__point_2d_ref(s: __sklib_ptr; const pt: __sklib_point_2d): __sklib_vector_2d; cdecl; external; function __sklib__vector_from_to__sprite__sprite(s1: __sklib_ptr; s2: __sklib_ptr): __sklib_vector_2d; cdecl; external; -procedure __sklib__activate_advanced_terminal(); cdecl; external; -function __sklib__advanced_terminal_active(): LongInt; cdecl; external; -procedure __sklib__clear_terminal(); cdecl; external; -procedure __sklib__end_advanced_terminal(); cdecl; external; -procedure __sklib__move_cursor_to__int__int(x: Integer; y: Integer); cdecl; external; function __sklib__read_char(): Char; cdecl; external; function __sklib__read_line(): __sklib_string; cdecl; external; -procedure __sklib__refresh_terminal(); cdecl; external; -procedure __sklib__set_terminal_bold__bool(value: LongInt); cdecl; external; -procedure __sklib__set_terminal_colors__color__color(foreground: __sklib_color; background: __sklib_color); cdecl; external; -procedure __sklib__set_terminal_echo_input__bool(value: LongInt); cdecl; external; -function __sklib__terminal_height(): Integer; cdecl; external; -function __sklib__terminal_width(): Integer; cdecl; external; procedure __sklib__write__char(data: Char); cdecl; external; procedure __sklib__write__double(data: Double); cdecl; external; procedure __sklib__write__int(data: Integer); cdecl; external; procedure __sklib__write__string(text: __sklib_string); cdecl; external; -procedure __sklib__write_at__string__int__int(text: __sklib_string; x: Integer; y: Integer); cdecl; external; procedure __sklib__write_line__char(data: Char); cdecl; external; procedure __sklib__write_line(); cdecl; external; procedure __sklib__write_line__double(data: Double); cdecl; external; @@ -12433,34 +12502,6 @@ function VectorFromTo(s1: Sprite; s2: Sprite): Vector2D; __skreturn := __sklib__vector_from_to__sprite__sprite(__skparam__s1, __skparam__s2); result := __skadapter__to_vector_2d(__skreturn); end; -procedure ActivateAdvancedTerminal(); -begin - __sklib__activate_advanced_terminal(); -end; -function AdvancedTerminalActive(): Boolean; -var - __skreturn: LongInt; -begin - __skreturn := __sklib__advanced_terminal_active(); - result := __skadapter__to_bool(__skreturn); -end; -procedure ClearTerminal(); -begin - __sklib__clear_terminal(); -end; -procedure EndAdvancedTerminal(); -begin - __sklib__end_advanced_terminal(); -end; -procedure MoveCursorTo(x: Integer; y: Integer); -var - __skparam__x: Integer; - __skparam__y: Integer; -begin - __skparam__x := __skadapter__to_sklib_int(x); - __skparam__y := __skadapter__to_sklib_int(y); - __sklib__move_cursor_to__int__int(__skparam__x, __skparam__y); -end; function ReadChar(): Char; var __skreturn: Char; @@ -12475,47 +12516,6 @@ function ReadLine(): String; __skreturn := __sklib__read_line(); result := __skadapter__to_string(__skreturn); end; -procedure RefreshTerminal(); -begin - __sklib__refresh_terminal(); -end; -procedure SetTerminalBold(value: Boolean); -var - __skparam__value: LongInt; -begin - __skparam__value := __skadapter__to_sklib_bool(value); - __sklib__set_terminal_bold__bool(__skparam__value); -end; -procedure SetTerminalColors(foreground: Color; background: Color); -var - __skparam__foreground: __sklib_color; - __skparam__background: __sklib_color; -begin - __skparam__foreground := __skadapter__to_sklib_color(foreground); - __skparam__background := __skadapter__to_sklib_color(background); - __sklib__set_terminal_colors__color__color(__skparam__foreground, __skparam__background); -end; -procedure SetTerminalEchoInput(value: Boolean); -var - __skparam__value: LongInt; -begin - __skparam__value := __skadapter__to_sklib_bool(value); - __sklib__set_terminal_echo_input__bool(__skparam__value); -end; -function TerminalHeight(): Integer; -var - __skreturn: Integer; -begin - __skreturn := __sklib__terminal_height(); - result := __skadapter__to_int(__skreturn); -end; -function TerminalWidth(): Integer; -var - __skreturn: Integer; -begin - __skreturn := __sklib__terminal_width(); - result := __skadapter__to_int(__skreturn); -end; procedure Write(data: Char); var __skparam__data: Char; @@ -12544,17 +12544,6 @@ procedure Write(text: String); __skparam__text := __skadapter__to_sklib_string(text); __sklib__write__string(__skparam__text); end; -procedure WriteAt(text: String; x: Integer; y: Integer); -var - __skparam__text: __sklib_string; - __skparam__x: Integer; - __skparam__y: Integer; -begin - __skparam__text := __skadapter__to_sklib_string(text); - __skparam__x := __skadapter__to_sklib_int(x); - __skparam__y := __skadapter__to_sklib_int(y); - __sklib__write_at__string__int__int(__skparam__text, __skparam__x, __skparam__y); -end; procedure WriteLine(data: Char); var __skparam__data: Char; diff --git a/generated/python/splashkit.py b/generated/python/splashkit.py index 1a107e34..b4ea5e71 100644 --- a/generated/python/splashkit.py +++ b/generated/python/splashkit.py @@ -225,6 +225,63 @@ class HttpStatusCode(Enum): http_status_internal_server_error = 500 http_status_not_implemented = 501 http_status_service_unavailable = 503 +class PinModes(Enum): + gpio_input = 0 + gpio_output = 1 + gpio_alt0 = 4 + gpio_alt1 = 5 + gpio_alt2 = 6 + gpio_alt3 = 7 + gpio_alt4 = 3 + gpio_alt5 = 2 +class PinValues(Enum): + gpio_low = 0 + gpio_high = 1 +class Pins(Enum): + pin_1 = 1 + pin_2 = 2 + pin_3 = 3 + pin_4 = 4 + pin_5 = 5 + pin_6 = 6 + pin_7 = 7 + pin_8 = 8 + pin_9 = 9 + pin_10 = 10 + pin_11 = 11 + pin_12 = 12 + pin_13 = 13 + pin_14 = 14 + pin_15 = 15 + pin_16 = 16 + pin_17 = 17 + pin_18 = 18 + pin_19 = 19 + pin_20 = 20 + pin_21 = 21 + pin_22 = 22 + pin_23 = 23 + pin_24 = 24 + pin_25 = 25 + pin_26 = 26 + pin_27 = 27 + pin_28 = 28 + pin_29 = 29 + pin_30 = 30 + pin_31 = 31 + pin_32 = 32 + pin_33 = 33 + pin_34 = 34 + pin_35 = 35 + pin_36 = 36 + pin_37 = 37 + pin_38 = 38 + pin_39 = 39 + pin_40 = 40 +class PullUpDown(Enum): + pud_off = 0 + pud_down = 1 + pud_up = 2 class HttpMethod(Enum): http_get_method = 0 http_post_method = 1 @@ -638,6 +695,38 @@ def __skadapter__to_http_status_code(v): def __skadapter__to_sklib_http_status_code(v): return c_int(v.value) +def __skadapter__to_pin_modes(v): + if isinstance(v, PinModes): + return v + return PinModes(v) + +def __skadapter__to_sklib_pin_modes(v): + return c_int(v.value) + +def __skadapter__to_pin_values(v): + if isinstance(v, PinValues): + return v + return PinValues(v) + +def __skadapter__to_sklib_pin_values(v): + return c_int(v.value) + +def __skadapter__to_pins(v): + if isinstance(v, Pins): + return v + return Pins(v) + +def __skadapter__to_sklib_pins(v): + return c_int(v.value) + +def __skadapter__to_pull_up_down(v): + if isinstance(v, PullUpDown): + return v + return PullUpDown(v) + +def __skadapter__to_sklib_pull_up_down(v): + return c_int(v.value) + def __skadapter__to_http_method(v): if isinstance(v, HttpMethod): return v @@ -3108,32 +3197,10 @@ def __skadapter__to_sklib_window(v): sklib.__sklib__vector_from_center_sprite_to_point__sprite__point_2d_ref.restype = _sklib_vector_2d sklib.__sklib__vector_from_to__sprite__sprite.argtypes = [ c_void_p, c_void_p ] sklib.__sklib__vector_from_to__sprite__sprite.restype = _sklib_vector_2d -sklib.__sklib__activate_advanced_terminal.argtypes = [ ] -sklib.__sklib__activate_advanced_terminal.restype = None -sklib.__sklib__advanced_terminal_active.argtypes = [ ] -sklib.__sklib__advanced_terminal_active.restype = c_bool -sklib.__sklib__clear_terminal.argtypes = [ ] -sklib.__sklib__clear_terminal.restype = None -sklib.__sklib__end_advanced_terminal.argtypes = [ ] -sklib.__sklib__end_advanced_terminal.restype = None -sklib.__sklib__move_cursor_to__int__int.argtypes = [ c_int, c_int ] -sklib.__sklib__move_cursor_to__int__int.restype = None sklib.__sklib__read_char.argtypes = [ ] sklib.__sklib__read_char.restype = c_char sklib.__sklib__read_line.argtypes = [ ] sklib.__sklib__read_line.restype = _sklib_string -sklib.__sklib__refresh_terminal.argtypes = [ ] -sklib.__sklib__refresh_terminal.restype = None -sklib.__sklib__set_terminal_bold__bool.argtypes = [ c_bool ] -sklib.__sklib__set_terminal_bold__bool.restype = None -sklib.__sklib__set_terminal_colors__color__color.argtypes = [ _sklib_color, _sklib_color ] -sklib.__sklib__set_terminal_colors__color__color.restype = None -sklib.__sklib__set_terminal_echo_input__bool.argtypes = [ c_bool ] -sklib.__sklib__set_terminal_echo_input__bool.restype = None -sklib.__sklib__terminal_height.argtypes = [ ] -sklib.__sklib__terminal_height.restype = c_int -sklib.__sklib__terminal_width.argtypes = [ ] -sklib.__sklib__terminal_width.restype = c_int sklib.__sklib__write__char.argtypes = [ c_char ] sklib.__sklib__write__char.restype = None sklib.__sklib__write__double.argtypes = [ c_double ] @@ -3142,8 +3209,6 @@ def __skadapter__to_sklib_window(v): sklib.__sklib__write__int.restype = None sklib.__sklib__write__string.argtypes = [ _sklib_string ] sklib.__sklib__write__string.restype = None -sklib.__sklib__write_at__string__int__int.argtypes = [ _sklib_string, c_int, c_int ] -sklib.__sklib__write_at__string__int__int.restype = None sklib.__sklib__write_line__char.argtypes = [ c_char ] sklib.__sklib__write_line__char.restype = None sklib.__sklib__write_line.argtypes = [ ] @@ -7603,43 +7668,12 @@ def vector_from_to ( s1, s2 ): __skparam__s2 = __skadapter__to_sklib_sprite(s2) __skreturn = sklib.__sklib__vector_from_to__sprite__sprite(__skparam__s1, __skparam__s2) return __skadapter__to_vector_2d(__skreturn) -def activate_advanced_terminal ( ): - sklib.__sklib__activate_advanced_terminal() -def advanced_terminal_active ( ): - __skreturn = sklib.__sklib__advanced_terminal_active() - return __skadapter__to_bool(__skreturn) -def clear_terminal ( ): - sklib.__sklib__clear_terminal() -def end_advanced_terminal ( ): - sklib.__sklib__end_advanced_terminal() -def move_cursor_to ( x, y ): - __skparam__x = __skadapter__to_sklib_int(x) - __skparam__y = __skadapter__to_sklib_int(y) - sklib.__sklib__move_cursor_to__int__int(__skparam__x, __skparam__y) def read_char ( ): __skreturn = sklib.__sklib__read_char() return __skadapter__to_char(__skreturn) def read_line ( ): __skreturn = sklib.__sklib__read_line() return __skadapter__to_string(__skreturn) -def refresh_terminal ( ): - sklib.__sklib__refresh_terminal() -def set_terminal_bold ( value ): - __skparam__value = __skadapter__to_sklib_bool(value) - sklib.__sklib__set_terminal_bold__bool(__skparam__value) -def set_terminal_colors ( foreground, background ): - __skparam__foreground = __skadapter__to_sklib_color(foreground) - __skparam__background = __skadapter__to_sklib_color(background) - sklib.__sklib__set_terminal_colors__color__color(__skparam__foreground, __skparam__background) -def set_terminal_echo_input ( value ): - __skparam__value = __skadapter__to_sklib_bool(value) - sklib.__sklib__set_terminal_echo_input__bool(__skparam__value) -def terminal_height ( ): - __skreturn = sklib.__sklib__terminal_height() - return __skadapter__to_int(__skreturn) -def terminal_width ( ): - __skreturn = sklib.__sklib__terminal_width() - return __skadapter__to_int(__skreturn) def write_char ( data ): __skparam__data = __skadapter__to_sklib_char(data) sklib.__sklib__write__char(__skparam__data) @@ -7652,11 +7686,6 @@ def write_int ( data ): def write ( text ): __skparam__text = __skadapter__to_sklib_string(text) sklib.__sklib__write__string(__skparam__text) -def write_at ( text, x, y ): - __skparam__text = __skadapter__to_sklib_string(text) - __skparam__x = __skadapter__to_sklib_int(x) - __skparam__y = __skadapter__to_sklib_int(y) - sklib.__sklib__write_at__string__int__int(__skparam__text, __skparam__x, __skparam__y) def write_line_char ( data ): __skparam__data = __skadapter__to_sklib_char(data) sklib.__sklib__write_line__char(__skparam__data) diff --git a/generated/translator_cache.json b/generated/translator_cache.json index 9c5f6985..325a1cb7 100644 --- a/generated/translator_cache.json +++ b/generated/translator_cache.json @@ -3,7 +3,7 @@ "group": "animations", "brief": "Animations in SplashKit can be used to move between cells in\nbitmaps and sprites. Each animation generates a number sequence\nthat can then be used when drawing bitmaps.", "description": null, - "parsed_at": 1703651012, + "parsed_at": 1705981404, "path": "coresdk/src/coresdk/animations.h", "functions": [ { @@ -1951,7 +1951,7 @@ "group": "audio", "brief": "SplashKit Audio allows you to load and play music and sound effects.", "description": "SplashKit's audio library allows you to easily load and play music and\nsound effects within your programs. To get started with audio the first\nthing you need to do is load a sound effect or music file. You can do this\nby calling the `load_sound_effect(string name)` function to the\n`load_music(string name)` function.", - "parsed_at": 1703651012, + "parsed_at": 1705981405, "path": "coresdk/src/coresdk/audio.h", "functions": [ { @@ -2045,7 +2045,7 @@ "group": "utilities", "brief": "SplashKit provides some basic data manipulation functions to\nhelp make it easy to get some basic tasks performed.", "description": null, - "parsed_at": 1703651014, + "parsed_at": 1705981405, "path": "coresdk/src/coresdk/basics.h", "functions": [ { @@ -2362,7 +2362,7 @@ "group": "resource_bundles", "brief": "SplashKit resource bundles allow you to quickly and easily load a\nnumber of resources in the `Resources` folder.", "description": "Supports the loading and freeing of game resource bundles. Resource types\ninclude images, sounds, music and animation files to name a few. Resource\nfiles must be saved in specific locations of a `Resources` folder for\nyour game.", - "parsed_at": 1703651014, + "parsed_at": 1705981405, "path": "coresdk/src/coresdk/bundles.h", "functions": [ { @@ -2507,7 +2507,7 @@ "group": "camera", "brief": "SplashKit camera functionality allows you to move a virtual camera\naround in your world.", "description": "Splashkit camera functionality allows you to move a virtual camera around in\nyour world. This camera projects to the users window, allowing you to\ndraw things to the screen in your world coordinates.", - "parsed_at": 1703651018, + "parsed_at": 1705981406, "path": "coresdk/src/coresdk/camera.h", "functions": [ { @@ -3574,7 +3574,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651022, + "parsed_at": 1705981407, "path": "coresdk/src/coresdk/circle_drawing.h", "functions": [ { @@ -4945,7 +4945,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651025, + "parsed_at": 1705981408, "path": "coresdk/src/coresdk/circle_geometry.h", "functions": [ { @@ -5872,7 +5872,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651028, + "parsed_at": 1705981408, "path": "coresdk/src/coresdk/clipping.h", "functions": [ { @@ -6456,7 +6456,7 @@ "group": "physics", "brief": "SplashKit Collisions library allow you to perform tests between\nbitmaps, sprites and shapes to determin if a collision has occured.", "description": null, - "parsed_at": 1703651034, + "parsed_at": 1705981410, "path": "coresdk/src/coresdk/collisions.h", "functions": [ { @@ -8707,7 +8707,7 @@ "group": "color", "brief": "SplashKit simplifies color manipulation in graphical applications for developers, ensuring ease of use and efficiency.", "description": null, - "parsed_at": 1703651059, + "parsed_at": 1705981414, "path": "coresdk/src/coresdk/color.h", "functions": [ { @@ -13907,7 +13907,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651064, + "parsed_at": 1705981416, "path": "coresdk/src/coresdk/drawing_options.h", "functions": [ { @@ -15271,7 +15271,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651071, + "parsed_at": 1705981417, "path": "coresdk/src/coresdk/ellipse_drawing.h", "functions": [ { @@ -17366,7 +17366,7 @@ "group": "geometry", "brief": "SplashKit's geometry functions assist with geometry-related computations.", "description": null, - "parsed_at": 1703651071, + "parsed_at": 1705981417, "path": "coresdk/src/coresdk/geometry.h", "functions": [ { @@ -17498,7 +17498,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651074, + "parsed_at": 1705981418, "path": "coresdk/src/coresdk/graphics.h", "functions": [ { @@ -18074,7 +18074,7 @@ "group": "graphics", "brief": "SplashKit Images allow drawing of bitmaps and sprites to graphic windows.", "description": null, - "parsed_at": 1703651082, + "parsed_at": 1705981419, "path": "coresdk/src/coresdk/images.h", "functions": [ { @@ -20562,7 +20562,7 @@ "group": "input", "brief": "Input handles user interaction and events such as keypresses.", "description": null, - "parsed_at": 1703651082, + "parsed_at": 1705981419, "path": "coresdk/src/coresdk/input.h", "functions": [ { @@ -20655,7 +20655,7 @@ "group": "json", "brief": "SplashKit Json allows you to create and read JSON objects.", "description": "Splashkit's JSON library allows you to easily create or read JSON objects and\nmanipulate them to/from a JSON string or from a file containing a JSON\nstring. Create a new JSON object with a call to `create_json()` and\nread or write data to it by calling methods like\n`json_add_string(json j, string key, string value)` and\n`json_read_string(json j, string key)`.", - "parsed_at": 1703651088, + "parsed_at": 1705981421, "path": "coresdk/src/coresdk/json.h", "functions": [ { @@ -22407,7 +22407,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1703651095, + "parsed_at": 1705981422, "path": "coresdk/src/coresdk/keyboard_input.h", "functions": [ { @@ -23405,7 +23405,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651100, + "parsed_at": 1705981423, "path": "coresdk/src/coresdk/line_drawing.h", "functions": [ { @@ -24944,7 +24944,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651104, + "parsed_at": 1705981424, "path": "coresdk/src/coresdk/line_geometry.h", "functions": [ { @@ -25818,7 +25818,7 @@ "group": "logging", "brief": "SplashKit Logging facilitates streamlined logging with customizable severity levels and modes.", "description": "SplashKit Logging module, allows users to initialize a custom logger with specified log levels and modes (console, file, or both). \nThe module provides functions to log messages at different severity levels (INFO, DEBUG, WARNING, ERROR, FATAL) with timestamped entries. \nUsers can close the logging process as needed, and the module handles customization for console and file output.", - "parsed_at": 1703651105, + "parsed_at": 1705981425, "path": "coresdk/src/coresdk/logging.h", "functions": [ { @@ -26067,7 +26067,7 @@ "group": "physics", "brief": "Provides matrix functions to work on 2d coordinates.", "description": null, - "parsed_at": 1703651108, + "parsed_at": 1705981425, "path": "coresdk/src/coresdk/matrix_2d.h", "functions": [ { @@ -26805,7 +26805,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1703651110, + "parsed_at": 1705981426, "path": "coresdk/src/coresdk/mouse_input.h", "functions": [ { @@ -27292,7 +27292,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1703651113, + "parsed_at": 1705981427, "path": "coresdk/src/coresdk/music.h", "functions": [ { @@ -28285,7 +28285,7 @@ "group": "networking", "brief": "SplashKit's network-related functions allow you to communicate data\nacross networks.", "description": null, - "parsed_at": 1703651124, + "parsed_at": 1705981430, "path": "coresdk/src/coresdk/networking.h", "functions": [ { @@ -31429,7 +31429,7 @@ "group": "physics", "brief": null, "description": null, - "parsed_at": 1703651124, + "parsed_at": 1705981430, "path": "coresdk/src/coresdk/physics.h", "functions": [ @@ -31451,7 +31451,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651128, + "parsed_at": 1705981431, "path": "coresdk/src/coresdk/point_drawing.h", "functions": [ { @@ -32771,7 +32771,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651132, + "parsed_at": 1705981432, "path": "coresdk/src/coresdk/point_geometry.h", "functions": [ { @@ -33795,7 +33795,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651134, + "parsed_at": 1705981433, "path": "coresdk/src/coresdk/quad_geometry.h", "functions": [ { @@ -34260,7 +34260,7 @@ "group": "utilities", "brief": "SplashKit random provides a simple implementation of random.", "description": "The SplashKit`s random library provides two rnd methods, a `rnd()` which generates\na random number between 0 and 1, and `rnd(int ubound)` which\ngenerates a random number between 0 and the value scpeficied in `ubound`.", - "parsed_at": 1703651135, + "parsed_at": 1705981434, "path": "coresdk/src/coresdk/random.h", "functions": [ { @@ -34394,7 +34394,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651144, + "parsed_at": 1705981436, "path": "coresdk/src/coresdk/rectangle_drawing.h", "functions": [ { @@ -37287,7 +37287,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651147, + "parsed_at": 1705981437, "path": "coresdk/src/coresdk/rectangle_geometry.h", "functions": [ { @@ -38073,7 +38073,7 @@ "group": "resources", "brief": "SplashKit resource functions allow you to locate resources in a\nproject's `Resources` folder.", "description": null, - "parsed_at": 1703651148, + "parsed_at": 1705981438, "path": "coresdk/src/coresdk/resources.h", "functions": [ { @@ -38391,7 +38391,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1703651152, + "parsed_at": 1705981440, "path": "coresdk/src/coresdk/sound.h", "functions": [ { @@ -39363,7 +39363,7 @@ "group": "sprites", "brief": "SplashKit Sprites allows you to create images you can easily\nmove and animate.", "description": "SplashKit sprites are game elements that can be moved, and animated. Sprites\nare located at a position in the game, have a velocity, and an animation.\nThe sprite can also have arbitary data associated with it for game specific\npurposes.", - "parsed_at": 1703651173, + "parsed_at": 1705981445, "path": "coresdk/src/coresdk/sprites.h", "functions": [ { @@ -46239,155 +46239,9 @@ "group": "terminal", "brief": "SplashKit Terminal allows you to read and write values to the\nterminal in a consistent manner.", "description": null, - "parsed_at": 1703651176, + "parsed_at": 1705981446, "path": "coresdk/src/coresdk/terminal.h", "functions": [ - { - "signature": "void activate_advanced_terminal();", - "name": "activate_advanced_terminal", - "method_name": null, - "unique_global_name": "activate_advanced_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "Start using the advanced terminal. Once you call this you will need\nto make sure you call `refresh_terminal` to show anything you have\nwritten. This will allow use of colors, bold, positioning, and other\nadvanced options.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "bool advanced_terminal_active();", - "name": "advanced_terminal_active", - "method_name": null, - "unique_global_name": "advanced_terminal_active", - "unique_method_name": null, - "suffix_name": null, - "description": "Is the terminal currently in advanced mode?", - "brief": null, - "return": { - "type": "bool", - "description": "True if the terminal is in advanced mode.", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void clear_terminal();", - "name": "clear_terminal", - "method_name": null, - "unique_global_name": "clear_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will clear the terminal to the background color\nyou set in `set_terminal_color`.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void end_advanced_terminal();", - "name": "end_advanced_terminal", - "method_name": null, - "unique_global_name": "end_advanced_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "Finish using advanced mode. The existing terminal display will be lost\nand the user will see what was in the terminal before you called\n`activate_advanced_terminal`.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void move_cursor_to(int x,int y);", - "name": "move_cursor_to", - "method_name": null, - "unique_global_name": "move_cursor_to", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will move the cursor to a given col, row of the\nterminal. You can check the terminal size using `terminal_width` and\n`terminal_height`. If you try to move outside this bounds then then move\nwill not occur.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "x": { - "type": "int", - "description": "The column to move to, must be between 0 and `terminal_width`", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "y": { - "type": "int", - "description": "The row to move to, must be between 0 and `terminal_height`", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, { "signature": "char read_char();", "name": "read_char", @@ -46395,7 +46249,7 @@ "unique_global_name": "read_char", "unique_method_name": null, "suffix_name": null, - "description": "Get a single character input by the user. This works in both standard and\nadvanced modes. In advanced mode, you can set if the character should\nalso be echoed to the terminal using `set_terminal_echo_input`.", + "description": "Get a single character input by the user.", "brief": null, "return": { "type": "char", @@ -46436,202 +46290,6 @@ "static": "terminal" } }, - { - "signature": "void refresh_terminal();", - "name": "refresh_terminal", - "method_name": null, - "unique_global_name": "refresh_terminal", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will display what has been written to the\nterminal. You need to call this for anything to be shown in advanced\nmode.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void set_terminal_bold(bool value);", - "name": "set_terminal_bold", - "method_name": null, - "unique_global_name": "set_terminal_bold", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this allows you to set if the text should draw as bold.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "value": { - "type": "bool", - "description": "Pass true to have the terminal write in bold", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void set_terminal_colors(color foreground,color background);", - "name": "set_terminal_colors", - "method_name": null, - "unique_global_name": "set_terminal_colors", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode this allows you to set the color of the foreground and\nthe background. The foreground is the color of the text.\n\n\nNote that only the following colors are guaranteed to work on all\nTerminals (others may work):\n\n\n- `color_black`\n\n\n- `color_dark_gray`\n\n\n- `color_gray`\n\n\n- `color_white`\n\n\n- `color_red`\n\n\n- `color_dark_red`\n\n\n- `color_green`\n\n\n- `color_dark_green`\n\n\n- `color_blue`\n\n\n- `color_dark_blue`\n\n\n- `color_cyan`\n\n\n- `color_dark_cyan`\n\n\n- `color_light_yellow`\n\n\n- `color_yellow`\n\n\n- `color_magenta`\n\n\n- `color_dark_magenta`", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "foreground": { - "type": "color", - "description": "The color of text that is drawn.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "background": { - "type": "color", - "description": "The color of the background behind drawn text.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "void set_terminal_echo_input(bool value);", - "name": "set_terminal_echo_input", - "method_name": null, - "unique_global_name": "set_terminal_echo_input", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this allows you to stop text read with `read_char`\nappearing on the terminal. You can use this for reading passwords, or to\ncontrol what is written.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "value": { - "type": "bool", - "description": "Pass true if you want characters to appear as typed.", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "int terminal_height();", - "name": "terminal_height", - "method_name": null, - "unique_global_name": "terminal_height", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this gives you the number of rows in the terminal.", - "brief": null, - "return": { - "type": "int", - "description": "The number of rows in the terminal", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, - { - "signature": "int terminal_width();", - "name": "terminal_width", - "method_name": null, - "unique_global_name": "terminal_width", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this gives you the number of columns in the terminal.", - "brief": null, - "return": { - "type": "int", - "description": "The number of columns in the terminal", - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, { "signature": "void write(char data);", "name": "write", @@ -46783,69 +46441,6 @@ "static": "terminal" } }, - { - "signature": "void write_at(string text,int x,int y);", - "name": "write_at", - "method_name": null, - "unique_global_name": "write_at", - "unique_method_name": null, - "suffix_name": null, - "description": "In advanced mode, this will write the supplied text at the indicated\ncolumn and row.", - "brief": null, - "return": { - "type": "void", - "description": null, - "is_pointer": false, - "is_reference": false, - "is_vector": false, - "type_parameter": null - }, - "parameters": { - "text": { - "type": "string", - "description": "The text to write", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "x": { - "type": "int", - "description": "The row to position the text at", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - }, - "y": { - "type": "int", - "description": "The column to position the text at", - "is_pointer": false, - "is_const": false, - "is_reference": false, - "is_array": false, - "array_dimension_sizes": [ - - ], - "is_vector": false, - "type_parameter": null - } - }, - "attributes": { - "group": "terminal", - "static": "terminal" - } - }, { "signature": "void write_line(char data);", "name": "write_line", @@ -47040,7 +46635,7 @@ "group": "graphics", "brief": "SplashKit Text allows for drawing text in a variety of ways to\ngraphic windows.", "description": null, - "parsed_at": 1703651185, + "parsed_at": 1705981448, "path": "coresdk/src/coresdk/text.h", "functions": [ { @@ -49943,7 +49538,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1703651188, + "parsed_at": 1705981449, "path": "coresdk/src/coresdk/text_input.h", "functions": [ { @@ -50478,7 +50073,7 @@ "group": "timers", "brief": "Timers in SplashKit can be used to track the passing of time.", "description": null, - "parsed_at": 1703651190, + "parsed_at": 1705981450, "path": "coresdk/src/coresdk/timers.h", "functions": [ { @@ -51316,7 +50911,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1703651198, + "parsed_at": 1705981452, "path": "coresdk/src/coresdk/triangle_drawing.h", "functions": [ { @@ -53723,7 +53318,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1703651200, + "parsed_at": 1705981453, "path": "coresdk/src/coresdk/triangle_geometry.h", "functions": [ { @@ -54084,7 +53679,7 @@ "group": "types", "brief": "SplashKit Types simplifies data type creation and management for streamlined programming.", "description": null, - "parsed_at": 1703651204, + "parsed_at": 1705981455, "path": "coresdk/src/coresdk/types.h", "functions": [ @@ -54806,6 +54401,262 @@ "attributes": { "group": "types" } + }, + { + "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2};", + "name": "pin_modes", + "description": "GPIO Pin Modes:", + "brief": null, + "constants": { + "GPIO_INPUT": { + "description": "- Input mode.", + "number": 0 + }, + "GPIO_OUTPUT": { + "description": "- Output mode.", + "number": 1 + }, + "GPIO_ALT0": { + "description": "- Alternate function mode 0.", + "number": 4 + }, + "GPIO_ALT1": { + "description": "- Alternate function mode 1.", + "number": 5 + }, + "GPIO_ALT2": { + "description": "- Alternate function mode 2.", + "number": 6 + }, + "GPIO_ALT3": { + "description": "- Alternate function mode 3.", + "number": 7 + }, + "GPIO_ALT4": { + "description": "- Alternate function mode 4.", + "number": 3 + }, + "GPIO_ALT5": { + "description": "- Alternate function mode 5.", + "number": 2 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1};", + "name": "pin_values", + "description": "GPIO Pin Values:", + "brief": null, + "constants": { + "GPIO_LOW": { + "description": "- Logic low (0).", + "number": 0 + }, + "GPIO_HIGH": { + "description": "- Logic high (1).", + "number": 1 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pins {PIN_1 = 1,PIN_2 = 2,PIN_3 = 3,PIN_4 = 4,PIN_5 = 5,PIN_6 = 6,PIN_7 = 7,PIN_8 = 8,PIN_9 = 9,PIN_10 = 10,PIN_11 = 11,PIN_12 = 12,PIN_13 = 13,PIN_14 = 14,PIN_15 = 15,PIN_16 = 16,PIN_17 = 17,PIN_18 = 18,PIN_19 = 19,PIN_20 = 20,PIN_21 = 21,PIN_22 = 22,PIN_23 = 23,PIN_24 = 24,PIN_25 = 25,PIN_26 = 26,PIN_27 = 27,PIN_28 = 28,PIN_29 = 29,PIN_30 = 30,PIN_31 = 31,PIN_32 = 32,PIN_33 = 33,PIN_34 = 34,PIN_35 = 35,PIN_36 = 36,PIN_37 = 37,PIN_38 = 38,PIN_39 = 39,PIN_40 = 40,};", + "name": "pins", + "description": "Raspberry Pi GPIO Board Pin Descriptions:", + "brief": null, + "constants": { + "PIN_1": { + "description": "- 3.3V Power Supply", + "number": 1 + }, + "PIN_2": { + "description": "- 5V Power Supply", + "number": 2 + }, + "PIN_3": { + "description": "- GPIO2 / SDA (I2C)", + "number": 3 + }, + "PIN_4": { + "description": "- 5V Power Supply", + "number": 4 + }, + "PIN_5": { + "description": "- GPIO3 / SCL (I2C)", + "number": 5 + }, + "PIN_6": { + "description": "- Ground", + "number": 6 + }, + "PIN_7": { + "description": "- GPIO4", + "number": 7 + }, + "PIN_8": { + "description": "- GPIO14 / TXD (UART)", + "number": 8 + }, + "PIN_9": { + "description": "- Ground", + "number": 9 + }, + "PIN_10": { + "description": "- GPIO15 / RXD (UART)", + "number": 10 + }, + "PIN_11": { + "description": "- GPIO17", + "number": 11 + }, + "PIN_12": { + "description": "- GPIO18 / PCM_CLK", + "number": 12 + }, + "PIN_13": { + "description": "- GPIO27", + "number": 13 + }, + "PIN_14": { + "description": "- Ground", + "number": 14 + }, + "PIN_15": { + "description": "- GPIO22", + "number": 15 + }, + "PIN_16": { + "description": "- GPIO23", + "number": 16 + }, + "PIN_17": { + "description": "- 3.3V Power Supply", + "number": 17 + }, + "PIN_18": { + "description": "- GPIO24", + "number": 18 + }, + "PIN_19": { + "description": "- GPIO10 / MOSI (SPI)", + "number": 19 + }, + "PIN_20": { + "description": "- Ground", + "number": 20 + }, + "PIN_21": { + "description": "- GPIO9 / MISO (SPI)", + "number": 21 + }, + "PIN_22": { + "description": "- GPIO25", + "number": 22 + }, + "PIN_23": { + "description": "- GPIO11 / SCLK (SPI)", + "number": 23 + }, + "PIN_24": { + "description": "- GPIO8 / CE0 (SPI)", + "number": 24 + }, + "PIN_25": { + "description": "- Ground", + "number": 25 + }, + "PIN_26": { + "description": "- GPIO7 / CE1 (SPI)", + "number": 26 + }, + "PIN_27": { + "description": "- ID_SD (I2C ID EEPROM)", + "number": 27 + }, + "PIN_28": { + "description": "- ID_SC (I2C ID EEPROM)", + "number": 28 + }, + "PIN_29": { + "description": "- GPIO5", + "number": 29 + }, + "PIN_30": { + "description": "- Ground", + "number": 30 + }, + "PIN_31": { + "description": "- GPIO6", + "number": 31 + }, + "PIN_32": { + "description": "- GPIO12", + "number": 32 + }, + "PIN_33": { + "description": "- GPIO13", + "number": 33 + }, + "PIN_34": { + "description": "- Ground", + "number": 34 + }, + "PIN_35": { + "description": "- GPIO19 / MISO (PCM)", + "number": 35 + }, + "PIN_36": { + "description": "- GPIO16 / CE0 (PCM)", + "number": 36 + }, + "PIN_37": { + "description": "- GPIO26", + "number": 37 + }, + "PIN_38": { + "description": "- GPIO20 / MOSI (PCM)", + "number": 38 + }, + "PIN_39": { + "description": "- Ground", + "number": 39 + }, + "PIN_40": { + "description": "- GPIO21 / SCLK (PCM)", + "number": 40 + } + }, + "attributes": { + "group": "types" + } + }, + { + "signature": "enum pull_up_down {PUD_OFF = 0,PUD_DOWN = 1,PUD_UP = 2};", + "name": "pull_up_down", + "description": "GPIO Pull-up/Pull-down Configurations:", + "brief": null, + "constants": { + "PUD_OFF": { + "description": "- No pull-up or pull-down resistor.", + "number": 0 + }, + "PUD_DOWN": { + "description": "- Enable pull-down resistor.", + "number": 1 + }, + "PUD_UP": { + "description": "- Enable pull-up resistor.", + "number": 2 + } + }, + "attributes": { + "group": "types" + } } ], "defines": [ @@ -54816,7 +54667,7 @@ "group": "utilities", "brief": "SplashKit provides miscellaneous utilities for unclassified functionality.", "description": null, - "parsed_at": 1703651205, + "parsed_at": 1705981455, "path": "coresdk/src/coresdk/utils.h", "functions": [ { @@ -55024,7 +54875,7 @@ "group": "physics", "brief": "Provides vector functions to work on vectors.", "description": null, - "parsed_at": 1703651210, + "parsed_at": 1705981456, "path": "coresdk/src/coresdk/vector_2d.h", "functions": [ { @@ -56457,7 +56308,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1703651212, + "parsed_at": 1705981457, "path": "coresdk/src/coresdk/web_client.h", "functions": [ { @@ -57052,7 +56903,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1703651217, + "parsed_at": 1705981458, "path": "coresdk/src/coresdk/web_server.h", "functions": [ { @@ -58771,7 +58622,7 @@ "group": "windows", "brief": "Window Manager in SplashKit can be used create, and manipulate\ngraphics windows", "description": null, - "parsed_at": 1703651224, + "parsed_at": 1705981460, "path": "coresdk/src/coresdk/window_manager.h", "functions": [ { diff --git a/tools/scripts/deploy-website.sh b/tools/scripts/deploy-website.sh index e42fe805..1959ab9f 100644 --- a/tools/scripts/deploy-website.sh +++ b/tools/scripts/deploy-website.sh @@ -2,7 +2,15 @@ # Website Redeployment Script # Purpose: Automate the redeployment of the website after api.json is regenerated. + # Configuration +## If you face any issues with the script, like $'\r': command not found +## try running the following command in your terminal: +## sudo apt-get install dos2unix +## dos2unix deploy-website.sh +## chmod +x deploy-website.sh +## ./deploy-website.sh + USER="splashkit" SK_ROOT="$(cd ../../ && pwd)" SK_GENERATED="$SK_ROOT/generated" From 7b675f4c345b7950d8c795a7481246e9aafd27c7 Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Wed, 24 Jan 2024 13:21:19 +1100 Subject: [PATCH 4/6] Fixed translator. --- coresdk/src/backend/gpio_driver.cpp | 2 +- coresdk/src/backend/gpio_driver.h | 4 +- coresdk/src/coresdk/raspi_gpio.cpp | 14 +- coresdk/src/coresdk/raspi_gpio.h | 49 +- coresdk/src/coresdk/types.h | 106 ++--- generated/clib/lib_type_mapper.h | 1 + generated/clib/sk_clib.cpp | 46 ++ generated/clib/sk_clib.h | 10 + generated/cpp/raspi_gpio.h | 27 ++ generated/cpp/splashkit.cpp | 46 ++ generated/cpp/splashkit.h | 1 + generated/csharp/SplashKit.cs | 102 ++++ generated/docs/api.json | 696 +++++++++++++++++++++++++--- generated/pascal/splashkit.pas | 100 ++++ generated/python/splashkit.py | 56 +++ generated/translator_cache.json | 643 +++++++++++++++++++++---- 16 files changed, 1669 insertions(+), 234 deletions(-) create mode 100644 generated/cpp/raspi_gpio.h diff --git a/coresdk/src/backend/gpio_driver.cpp b/coresdk/src/backend/gpio_driver.cpp index 67196390..b53d7d75 100644 --- a/coresdk/src/backend/gpio_driver.cpp +++ b/coresdk/src/backend/gpio_driver.cpp @@ -1,6 +1,6 @@ /*********************************************** * XQuestCode || Aditya Parmar - * 🚀 © 2024 Aditya Parmar. All Rights Reserved. + * © 2024 Aditya Parmar. All Rights Reserved. * This file is part of the SplashKit Core Library. * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference ***********************************************/ diff --git a/coresdk/src/backend/gpio_driver.h b/coresdk/src/backend/gpio_driver.h index 3e265979..8bd317c4 100644 --- a/coresdk/src/backend/gpio_driver.h +++ b/coresdk/src/backend/gpio_driver.h @@ -1,6 +1,6 @@ /*********************************************** * XQuestCode || Aditya Parmar - * 🚀 © 2024 Aditya Parmar. All Rights Reserved. + * © 2024 Aditya Parmar. All Rights Reserved. * This file is part of the SplashKit Core Library. * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference ***********************************************/ @@ -21,4 +21,4 @@ namespace splashkit_lib void sk_set_pwm_dutycycle(int pin, int dutycycle); void sk_gpio_cleanup(); } -#endif // SPLASHKIT_sk_gpio_H \ No newline at end of file +#endif /* defined(gpio_driver) */ \ No newline at end of file diff --git a/coresdk/src/coresdk/raspi_gpio.cpp b/coresdk/src/coresdk/raspi_gpio.cpp index 58927354..215221c7 100644 --- a/coresdk/src/coresdk/raspi_gpio.cpp +++ b/coresdk/src/coresdk/raspi_gpio.cpp @@ -1,19 +1,15 @@ -// raspi_gpio.c -/*********************************************** - * XQuestCode || Aditya Parmar - * 🚀 © 2024 Aditya Parmar. All Rights Reserved. - * This file is part of the SplashKit Core Library. - * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference - ***********************************************/ - +// raspi_gpio.cpp +// splashkit +// Created by Aditya Parmar on 20/01/2024. +// Copyright © 2024 XQuestCode. All rights reserved. #include "raspi_gpio.h" #include "gpio_driver.h" #include using namespace std; -// Each index points to PIN_1, PIN_2, PIN_3, etc. namespace splashkit_lib { + // Each index points to PIN_1, PIN_2, PIN_3, etc. int BCMpinData[] = { -1, -1, 2, -1, 3, -2, 4, 14, -2, 15, 17, 18, 27, -2, 22, 23, -1, 24, 10, -2, 9, 25, 11, 8, -2, 7, 0, 1, 5, -2, -6, 12, 13, -2, 19, 16, 26, 20, -2, 21}; diff --git a/coresdk/src/coresdk/raspi_gpio.h b/coresdk/src/coresdk/raspi_gpio.h index cb327d9a..b4277c87 100644 --- a/coresdk/src/coresdk/raspi_gpio.h +++ b/coresdk/src/coresdk/raspi_gpio.h @@ -1,16 +1,15 @@ /** - * @header raspberry - * @author Aditya Parmar - * @brief Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi. - * - * @attribute group raspberry + * @header raspi_gpio + * @brief Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi. + * @author Aditya Parmar + * @attribute group raspberry * @attribute static raspberry */ -#ifndef raspi_gpio_h -#define raspi_gpio_h +#ifndef raspi_gpio_hpp +#define raspi_gpio_hpp -#include // Include the appropriate header file for stdint.h +#include #include "gpio_driver.h" #include "types.h" @@ -18,12 +17,16 @@ namespace splashkit_lib { /** * @brief Initializes the GPIO library. + * + * This function initializes the GPIO library for use. It should be called before any other GPIO functions. */ void raspi_init(); /** * @brief Sets the mode of the specified pin. * + * This function sets the mode of the specified pin to the specified mode. + * * @param pin The pin to set the mode for. * @param mode The mode to set for the pin. */ @@ -32,6 +35,8 @@ namespace splashkit_lib /** * @brief Gets the mode of the specified pin. * + * This function retrieves the mode of the specified pin. + * * @param pin The pin to get the mode for. * @returns The mode of the pin. */ @@ -40,6 +45,8 @@ namespace splashkit_lib /** * @brief Writes a value to the specified pin. * + * This function writes the specified value to the specified pin. + * * @param pin The pin to write the value to. * @param value The value to write to the pin. */ @@ -48,13 +55,17 @@ namespace splashkit_lib /** * @brief Sets the pull up/down mode for the specified pin. * + * This function sets the pull-up/down mode for the specified pin. + * * @param pin The pin to set the pull up/down mode for. * @param pud The pull up/down mode to set for the pin. */ void raspi_set_pull_up_down(pins pin, pull_up_down pud); /** - * Sets the PWM range for the specified pin. + * @brief Sets the PWM range for the specified pin. + * + * This function sets the PWM range for the specified pin. * * @param pin The pin to set the PWM range for. * @param range The PWM range to set for the pin. @@ -62,7 +73,9 @@ namespace splashkit_lib void raspi_set_pwm_range(pins pin, int range); /** - * Sets the PWM frequency for the specified pin. + * @brief Sets the PWM frequency for the specified pin. + * + * This function sets the PWM frequency for the specified pin. * * @param pin The pin to set the PWM frequency for. * @param frequency The PWM frequency to set for the pin. @@ -70,7 +83,9 @@ namespace splashkit_lib void raspi_set_pwm_frequency(pins pin, int frequency); /** - * Sets the PWM duty cycle for the specified pin. + * @brief Sets the PWM duty cycle for the specified pin. + * + * This function sets the PWM duty cycle for the specified pin. * * @param pin The pin to set the PWM duty cycle for. * @param dutycycle The PWM duty cycle to set for the pin. @@ -78,18 +93,20 @@ namespace splashkit_lib void raspi_set_pwm_dutycycle(pins pin, int dutycycle); /** - * Reads the value from the specified pin. + * @brief Reads the value from the specified pin. + * + * This function reads the value from the specified pin. * * @param pin The pin to read the value from. * @returns The value read from the pin. */ pin_values raspi_read(pins pin); - - /** - * Cleans up and releases any resources used by the GPIO library ( sets all pin modes to INPUT and values to LOW ). This should be called when you are finished using the GPIO library. + * @brief Cleans up and releases any resources used by the GPIO library. + * + * This function should be called when you are finished using the GPIO library. It sets all pin modes to INPUT and values to LOW. */ void raspi_cleanup(); } -#endif // RASPI_GPIO_H \ No newline at end of file +#endif /* raspi_gpio_hpp */ diff --git a/coresdk/src/coresdk/types.h b/coresdk/src/coresdk/types.h index 16119fd5..c6b3faa7 100644 --- a/coresdk/src/coresdk/types.h +++ b/coresdk/src/coresdk/types.h @@ -319,46 +319,46 @@ namespace splashkit_lib /** * Raspberry Pi GPIO Board Pin Descriptions: * - * @constant PIN_1 - 3.3V Power Supply - * @constant PIN_2 - 5V Power Supply - * @constant PIN_3 - GPIO2 / SDA (I2C) - * @constant PIN_4 - 5V Power Supply - * @constant PIN_5 - GPIO3 / SCL (I2C) - * @constant PIN_6 - Ground - * @constant PIN_7 - GPIO4 - * @constant PIN_8 - GPIO14 / TXD (UART) - * @constant PIN_9 - Ground - * @constant PIN_10 - GPIO15 / RXD (UART) - * @constant PIN_11 - GPIO17 - * @constant PIN_12 - GPIO18 / PCM_CLK - * @constant PIN_13 - GPIO27 - * @constant PIN_14 - Ground - * @constant PIN_15 - GPIO22 - * @constant PIN_16 - GPIO23 - * @constant PIN_17 - 3.3V Power Supply - * @constant PIN_18 - GPIO24 - * @constant PIN_19 - GPIO10 / MOSI (SPI) - * @constant PIN_20 - Ground - * @constant PIN_21 - GPIO9 / MISO (SPI) - * @constant PIN_22 - GPIO25 - * @constant PIN_23 - GPIO11 / SCLK (SPI) - * @constant PIN_24 - GPIO8 / CE0 (SPI) - * @constant PIN_25 - Ground - * @constant PIN_26 - GPIO7 / CE1 (SPI) - * @constant PIN_27 - ID_SD (I2C ID EEPROM) - * @constant PIN_28 - ID_SC (I2C ID EEPROM) - * @constant PIN_29 - GPIO5 - * @constant PIN_30 - Ground - * @constant PIN_31 - GPIO6 - * @constant PIN_32 - GPIO12 - * @constant PIN_33 - GPIO13 - * @constant PIN_34 - Ground - * @constant PIN_35 - GPIO19 / MISO (PCM) - * @constant PIN_36 - GPIO16 / CE0 (PCM) - * @constant PIN_37 - GPIO26 - * @constant PIN_38 - GPIO20 / MOSI (PCM) - * @constant PIN_39 - Ground - * @constant PIN_40 - GPIO21 / SCLK (PCM) + * @constant PIN_1 3.3V Power Supply + * @constant PIN_2 5V Power Supply + * @constant PIN_3 GPIO2 / SDA (I2C) + * @constant PIN_4 5V Power Supply + * @constant PIN_5 GPIO3 / SCL (I2C) + * @constant PIN_6 Ground + * @constant PIN_7 GPIO4 + * @constant PIN_8 GPIO14 / TXD (UART) + * @constant PIN_9 Ground + * @constant PIN_10 GPIO15 / RXD (UART) + * @constant PIN_11 GPIO17 + * @constant PIN_12 GPIO18 / PCM_CLK + * @constant PIN_13 GPIO27 + * @constant PIN_14 Ground + * @constant PIN_15 GPIO22 + * @constant PIN_16 GPIO23 + * @constant PIN_17 3.3V Power Supply + * @constant PIN_18 GPIO24 + * @constant PIN_19 GPIO10 / MOSI (SPI) + * @constant PIN_20 Ground + * @constant PIN_21 GPIO9 / MISO (SPI) + * @constant PIN_22 GPIO25 + * @constant PIN_23 GPIO11 / SCLK (SPI) + * @constant PIN_24 GPIO8 / CE0 (SPI) + * @constant PIN_25 Ground + * @constant PIN_26 GPIO7 / CE1 (SPI) + * @constant PIN_27 ID_SD (I2C ID EEPROM) + * @constant PIN_28 ID_SC (I2C ID EEPROM) + * @constant PIN_29 GPIO5 + * @constant PIN_30 Ground + * @constant PIN_31 GPIO6 + * @constant PIN_32 GPIO12 + * @constant PIN_33 GPIO13 + * @constant PIN_34 Ground + * @constant PIN_35 GPIO19 / MISO (PCM) + * @constant PIN_36 GPIO16 / CE0 (PCM) + * @constant PIN_37 GPIO26 + * @constant PIN_38 GPIO20 / MOSI (PCM) + * @constant PIN_39 Ground + * @constant PIN_40 GPIO21 / SCLK (PCM) */ enum pins { @@ -408,14 +408,14 @@ enum pins /** * GPIO Pin Modes: * - * @constant GPIO_INPUT - Input mode. - * @constant GPIO_OUTPUT - Output mode. - * @constant GPIO_ALT0 - Alternate function mode 0. - * @constant GPIO_ALT1 - Alternate function mode 1. - * @constant GPIO_ALT2 - Alternate function mode 2. - * @constant GPIO_ALT3 - Alternate function mode 3. - * @constant GPIO_ALT4 - Alternate function mode 4. - * @constant GPIO_ALT5 - Alternate function mode 5. + * @constant GPIO_INPUT Input mode. + * @constant GPIO_OUTPUT Output mode. + * @constant GPIO_ALT0 Alternate function mode 0. + * @constant GPIO_ALT1 Alternate function mode 1. + * @constant GPIO_ALT2 Alternate function mode 2. + * @constant GPIO_ALT3 Alternate function mode 3. + * @constant GPIO_ALT4 Alternate function mode 4. + * @constant GPIO_ALT5 Alternate function mode 5. */ enum pin_modes { @@ -432,8 +432,8 @@ enum pin_modes /** * GPIO Pin Values: * - * @constant GPIO_LOW - Logic low (0). - * @constant GPIO_HIGH - Logic high (1). + * @constant GPIO_LOW Logic low (0). + * @constant GPIO_HIGH Logic high (1). */ enum pin_values { @@ -443,9 +443,9 @@ enum pin_values /** * GPIO Pull-up/Pull-down Configurations: * - * @constant PUD_OFF - No pull-up or pull-down resistor. - * @constant PUD_DOWN - Enable pull-down resistor. - * @constant PUD_UP - Enable pull-up resistor. + * @constant PUD_OFF No pull-up or pull-down resistor. + * @constant PUD_DOWN Enable pull-down resistor. + * @constant PUD_UP Enable pull-up resistor. */ enum pull_up_down { diff --git a/generated/clib/lib_type_mapper.h b/generated/clib/lib_type_mapper.h index 7698cd10..25063f4b 100644 --- a/generated/clib/lib_type_mapper.h +++ b/generated/clib/lib_type_mapper.h @@ -41,6 +41,7 @@ #include "point_geometry.h" #include "quad_geometry.h" #include "random.h" +#include "raspi_gpio.h" #include "rectangle_drawing.h" #include "rectangle_geometry.h" #include "resources.h" diff --git a/generated/clib/sk_clib.cpp b/generated/clib/sk_clib.cpp index 3421af56..d177aa18 100644 --- a/generated/clib/sk_clib.cpp +++ b/generated/clib/sk_clib.cpp @@ -3723,6 +3723,52 @@ int __sklib__rnd__int(int ubound) { int __skreturn = rnd(__skparam__ubound); return __sklib__to_int(__skreturn); } +void __sklib__raspi_cleanup() { + raspi_cleanup(); +} +int __sklib__raspi_get_mode__pins(int pin) { + pins __skparam__pin = __sklib__to_pins(pin); + pin_modes __skreturn = raspi_get_mode(__skparam__pin); + return __sklib__to_int(__skreturn); +} +void __sklib__raspi_init() { + raspi_init(); +} +int __sklib__raspi_read__pins(int pin) { + pins __skparam__pin = __sklib__to_pins(pin); + pin_values __skreturn = raspi_read(__skparam__pin); + return __sklib__to_int(__skreturn); +} +void __sklib__raspi_set_mode__pins__pin_modes(int pin, int mode) { + pins __skparam__pin = __sklib__to_pins(pin); + pin_modes __skparam__mode = __sklib__to_pin_modes(mode); + raspi_set_mode(__skparam__pin, __skparam__mode); +} +void __sklib__raspi_set_pull_up_down__pins__pull_up_down(int pin, int pud) { + pins __skparam__pin = __sklib__to_pins(pin); + pull_up_down __skparam__pud = __sklib__to_pull_up_down(pud); + raspi_set_pull_up_down(__skparam__pin, __skparam__pud); +} +void __sklib__raspi_set_pwm_dutycycle__pins__int(int pin, int dutycycle) { + pins __skparam__pin = __sklib__to_pins(pin); + int __skparam__dutycycle = __sklib__to_int(dutycycle); + raspi_set_pwm_dutycycle(__skparam__pin, __skparam__dutycycle); +} +void __sklib__raspi_set_pwm_frequency__pins__int(int pin, int frequency) { + pins __skparam__pin = __sklib__to_pins(pin); + int __skparam__frequency = __sklib__to_int(frequency); + raspi_set_pwm_frequency(__skparam__pin, __skparam__frequency); +} +void __sklib__raspi_set_pwm_range__pins__int(int pin, int range) { + pins __skparam__pin = __sklib__to_pins(pin); + int __skparam__range = __sklib__to_int(range); + raspi_set_pwm_range(__skparam__pin, __skparam__range); +} +void __sklib__raspi_write__pins__pin_values(int pin, int value) { + pins __skparam__pin = __sklib__to_pins(pin); + pin_values __skparam__value = __sklib__to_pin_values(value); + raspi_write(__skparam__pin, __skparam__value); +} void __sklib__draw_quad__color__quad_ref(__sklib_color clr, const __sklib_quad q) { color __skparam__clr = __sklib__to_color(clr); quad __skparam__q = __sklib__to_quad(q); diff --git a/generated/clib/sk_clib.h b/generated/clib/sk_clib.h index f9a91f88..8f223cc0 100644 --- a/generated/clib/sk_clib.h +++ b/generated/clib/sk_clib.h @@ -868,6 +868,16 @@ __sklib_vector_triangle __sklib__triangles_from__quad_ref(const __sklib_quad q); int __sklib__rnd__int__int(int min, int max); float __sklib__rnd(); int __sklib__rnd__int(int ubound); +void __sklib__raspi_cleanup(); +int __sklib__raspi_get_mode__pins(int pin); +void __sklib__raspi_init(); +int __sklib__raspi_read__pins(int pin); +void __sklib__raspi_set_mode__pins__pin_modes(int pin, int mode); +void __sklib__raspi_set_pull_up_down__pins__pull_up_down(int pin, int pud); +void __sklib__raspi_set_pwm_dutycycle__pins__int(int pin, int dutycycle); +void __sklib__raspi_set_pwm_frequency__pins__int(int pin, int frequency); +void __sklib__raspi_set_pwm_range__pins__int(int pin, int range); +void __sklib__raspi_write__pins__pin_values(int pin, int value); void __sklib__draw_quad__color__quad_ref(__sklib_color clr, const __sklib_quad q); void __sklib__draw_quad__color__quad_ref__drawing_options_ref(__sklib_color clr, const __sklib_quad q, const __sklib_drawing_options opts); void __sklib__draw_quad_on_bitmap__bitmap__color__quad_ref(__sklib_bitmap destination, __sklib_color clr, const __sklib_quad q); diff --git a/generated/cpp/raspi_gpio.h b/generated/cpp/raspi_gpio.h new file mode 100644 index 00000000..460743ee --- /dev/null +++ b/generated/cpp/raspi_gpio.h @@ -0,0 +1,27 @@ +// +// SplashKit Generated Raspi Gpio C++ Code +// DO NOT MODIFY +// + +#ifndef __raspi_gpio_h +#define __raspi_gpio_h + +#include "types.h" +#include +#include +#include +using std::string; +using std::vector; + +void raspi_cleanup(); +pin_modes raspi_get_mode(pins pin); +void raspi_init(); +pin_values raspi_read(pins pin); +void raspi_set_mode(pins pin, pin_modes mode); +void raspi_set_pull_up_down(pins pin, pull_up_down pud); +void raspi_set_pwm_dutycycle(pins pin, int dutycycle); +void raspi_set_pwm_frequency(pins pin, int frequency); +void raspi_set_pwm_range(pins pin, int range); +void raspi_write(pins pin, pin_values value); + +#endif /* __raspi_gpio_h */ diff --git a/generated/cpp/splashkit.cpp b/generated/cpp/splashkit.cpp index e2ff3fea..fd75b11c 100644 --- a/generated/cpp/splashkit.cpp +++ b/generated/cpp/splashkit.cpp @@ -3854,6 +3854,52 @@ int rnd(int ubound) { int __skreturn = __sklib__rnd__int(__skparam__ubound); return __skadapter__to_int(__skreturn); } +void raspi_cleanup() { + __sklib__raspi_cleanup(); +} +pin_modes raspi_get_mode(pins pin) { + int __skparam__pin = __skadapter__to_int(pin); + int __skreturn = __sklib__raspi_get_mode__pins(__skparam__pin); + return __skadapter__to_pin_modes(__skreturn); +} +void raspi_init() { + __sklib__raspi_init(); +} +pin_values raspi_read(pins pin) { + int __skparam__pin = __skadapter__to_int(pin); + int __skreturn = __sklib__raspi_read__pins(__skparam__pin); + return __skadapter__to_pin_values(__skreturn); +} +void raspi_set_mode(pins pin, pin_modes mode) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__mode = __skadapter__to_int(mode); + __sklib__raspi_set_mode__pins__pin_modes(__skparam__pin, __skparam__mode); +} +void raspi_set_pull_up_down(pins pin, pull_up_down pud) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__pud = __skadapter__to_int(pud); + __sklib__raspi_set_pull_up_down__pins__pull_up_down(__skparam__pin, __skparam__pud); +} +void raspi_set_pwm_dutycycle(pins pin, int dutycycle) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__dutycycle = __skadapter__to_int(dutycycle); + __sklib__raspi_set_pwm_dutycycle__pins__int(__skparam__pin, __skparam__dutycycle); +} +void raspi_set_pwm_frequency(pins pin, int frequency) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__frequency = __skadapter__to_int(frequency); + __sklib__raspi_set_pwm_frequency__pins__int(__skparam__pin, __skparam__frequency); +} +void raspi_set_pwm_range(pins pin, int range) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__range = __skadapter__to_int(range); + __sklib__raspi_set_pwm_range__pins__int(__skparam__pin, __skparam__range); +} +void raspi_write(pins pin, pin_values value) { + int __skparam__pin = __skadapter__to_int(pin); + int __skparam__value = __skadapter__to_int(value); + __sklib__raspi_write__pins__pin_values(__skparam__pin, __skparam__value); +} void draw_quad(color clr, const quad &q) { __sklib_color __skparam__clr = __skadapter__to_sklib_color(clr); const __sklib_quad __skparam__q = __skadapter__to_sklib_quad(q); diff --git a/generated/cpp/splashkit.h b/generated/cpp/splashkit.h index c907249f..ce78318f 100644 --- a/generated/cpp/splashkit.h +++ b/generated/cpp/splashkit.h @@ -33,6 +33,7 @@ #include "point_geometry.h" #include "quad_geometry.h" #include "random.h" +#include "raspi_gpio.h" #include "rectangle_drawing.h" #include "rectangle_geometry.h" #include "resources.h" diff --git a/generated/csharp/SplashKit.cs b/generated/csharp/SplashKit.cs index bd71bf4e..3b5039b0 100644 --- a/generated/csharp/SplashKit.cs +++ b/generated/csharp/SplashKit.cs @@ -3121,6 +3121,36 @@ private static void __skadapter__update_from_vector_bool(ref __sklib_vector_bool [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__rnd__int", CharSet=CharSet.Ansi)] private static extern int __sklib__rnd__int(int ubound); + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_cleanup", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_cleanup(); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_get_mode__pins", CharSet=CharSet.Ansi)] + private static extern int __sklib__raspi_get_mode__pins(int pin); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_init", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_init(); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_read__pins", CharSet=CharSet.Ansi)] + private static extern int __sklib__raspi_read__pins(int pin); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_set_mode__pins__pin_modes", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_set_mode__pins__pin_modes(int pin, int mode); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_set_pull_up_down__pins__pull_up_down", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_set_pull_up_down__pins__pull_up_down(int pin, int pud); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_set_pwm_dutycycle__pins__int", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_set_pwm_dutycycle__pins__int(int pin, int dutycycle); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_set_pwm_frequency__pins__int", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_set_pwm_frequency__pins__int(int pin, int frequency); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_set_pwm_range__pins__int", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_set_pwm_range__pins__int(int pin, int range); + + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_write__pins__pin_values", CharSet=CharSet.Ansi)] + private static extern void __sklib__raspi_write__pins__pin_values(int pin, int value); + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__draw_quad__color__quad_ref", CharSet=CharSet.Ansi)] private static extern void __sklib__draw_quad__color__quad_ref(__sklib_color clr, __sklib_quad q); @@ -10640,6 +10670,78 @@ public static int Rnd(int ubound) __skreturn = __sklib__rnd__int(__skparam__ubound); return __skadapter__to_int(__skreturn); } + public static void RaspiCleanup() + { + __sklib__raspi_cleanup(); + } + public static PinModes RaspiGetMode(Pins pin) + { + int __skparam__pin; + int __skreturn; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skreturn = __sklib__raspi_get_mode__pins(__skparam__pin); + return __skadapter__to_pin_modes(__skreturn); + } + public static void RaspiInit() + { + __sklib__raspi_init(); + } + public static PinValues RaspiRead(Pins pin) + { + int __skparam__pin; + int __skreturn; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skreturn = __sklib__raspi_read__pins(__skparam__pin); + return __skadapter__to_pin_values(__skreturn); + } + public static void RaspiSetMode(Pins pin, PinModes mode) + { + int __skparam__pin; + int __skparam__mode; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__mode = __skadapter__to_sklib_pin_modes(mode); + __sklib__raspi_set_mode__pins__pin_modes(__skparam__pin, __skparam__mode); + } + public static void RaspiSetPullUpDown(Pins pin, PullUpDown pud) + { + int __skparam__pin; + int __skparam__pud; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__pud = __skadapter__to_sklib_pull_up_down(pud); + __sklib__raspi_set_pull_up_down__pins__pull_up_down(__skparam__pin, __skparam__pud); + } + public static void RaspiSetPwmDutycycle(Pins pin, int dutycycle) + { + int __skparam__pin; + int __skparam__dutycycle; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__dutycycle = __skadapter__to_sklib_int(dutycycle); + __sklib__raspi_set_pwm_dutycycle__pins__int(__skparam__pin, __skparam__dutycycle); + } + public static void RaspiSetPwmFrequency(Pins pin, int frequency) + { + int __skparam__pin; + int __skparam__frequency; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__frequency = __skadapter__to_sklib_int(frequency); + __sklib__raspi_set_pwm_frequency__pins__int(__skparam__pin, __skparam__frequency); + } + public static void RaspiSetPwmRange(Pins pin, int range) + { + int __skparam__pin; + int __skparam__range; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__range = __skadapter__to_sklib_int(range); + __sklib__raspi_set_pwm_range__pins__int(__skparam__pin, __skparam__range); + } + public static void RaspiWrite(Pins pin, PinValues value) + { + int __skparam__pin; + int __skparam__value; + __skparam__pin = __skadapter__to_sklib_pins(pin); + __skparam__value = __skadapter__to_sklib_pin_values(value); + __sklib__raspi_write__pins__pin_values(__skparam__pin, __skparam__value); + } public static void DrawQuad(Color clr, Quad q) { __sklib_color __skparam__clr; diff --git a/generated/docs/api.json b/generated/docs/api.json index 3f16960b..d50cdfc6 100644 --- a/generated/docs/api.json +++ b/generated/docs/api.json @@ -61432,6 +61432,596 @@ ] }, + "raspberry": { + "brief": "Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi.", + "description": "", + "functions": [ + { + "signature": "void raspi_cleanup();", + "name": "raspi_cleanup", + "method_name": null, + "unique_global_name": "raspi_cleanup", + "unique_method_name": null, + "suffix_name": null, + "description": "This function should be called when you are finished using the GPIO library. It sets all pin modes to INPUT and values to LOW.", + "brief": "Cleans up and releases any resources used by the GPIO library.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_cleanup():" + ], + "pascal": [ + "procedure RaspiCleanup()" + ], + "csharp": [ + "public static void Raspberry.RaspiCleanup();", + "public static void SplashKit.RaspiCleanup();" + ], + "cpp": [ + "void raspi_cleanup()" + ] + } + }, + { + "signature": "pin_modes raspi_get_mode(pins pin);", + "name": "raspi_get_mode", + "method_name": null, + "unique_global_name": "raspi_get_mode", + "unique_method_name": null, + "suffix_name": null, + "description": "This function retrieves the mode of the specified pin.", + "brief": "Gets the mode of the specified pin.", + "return": { + "type": "pin_modes", + "description": "The mode of the pin.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to get the mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_get_mode(pin):" + ], + "pascal": [ + "function RaspiGetMode(pin: Pins): PinModes" + ], + "csharp": [ + "public static PinModes Raspberry.RaspiGetMode(Pins pin);", + "public static PinModes SplashKit.RaspiGetMode(Pins pin);" + ], + "cpp": [ + "pin_modes raspi_get_mode(pins pin)" + ] + } + }, + { + "signature": "void raspi_init();", + "name": "raspi_init", + "method_name": null, + "unique_global_name": "raspi_init", + "unique_method_name": null, + "suffix_name": null, + "description": "This function initializes the GPIO library for use. It should be called before any other GPIO functions.", + "brief": "Initializes the GPIO library.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_init():" + ], + "pascal": [ + "procedure RaspiInit()" + ], + "csharp": [ + "public static void Raspberry.RaspiInit();", + "public static void SplashKit.RaspiInit();" + ], + "cpp": [ + "void raspi_init()" + ] + } + }, + { + "signature": "pin_values raspi_read(pins pin);", + "name": "raspi_read", + "method_name": null, + "unique_global_name": "raspi_read", + "unique_method_name": null, + "suffix_name": null, + "description": "This function reads the value from the specified pin.", + "brief": "Reads the value from the specified pin.", + "return": { + "type": "pin_values", + "description": "The value read from the pin.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to read the value from.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_read(pin):" + ], + "pascal": [ + "function RaspiRead(pin: Pins): PinValues" + ], + "csharp": [ + "public static PinValues Raspberry.RaspiRead(Pins pin);", + "public static PinValues SplashKit.RaspiRead(Pins pin);" + ], + "cpp": [ + "pin_values raspi_read(pins pin)" + ] + } + }, + { + "signature": "void raspi_set_mode(pins pin,pin_modes mode);", + "name": "raspi_set_mode", + "method_name": null, + "unique_global_name": "raspi_set_mode", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the mode of the specified pin to the specified mode.", + "brief": "Sets the mode of the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "mode": { + "type": "pin_modes", + "description": "The mode to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_set_mode(pin, mode):" + ], + "pascal": [ + "procedure RaspiSetMode(pin: Pins; mode: PinModes)" + ], + "csharp": [ + "public static void Raspberry.RaspiSetMode(Pins pin, PinModes mode);", + "public static void SplashKit.RaspiSetMode(Pins pin, PinModes mode);" + ], + "cpp": [ + "void raspi_set_mode(pins pin, pin_modes mode)" + ] + } + }, + { + "signature": "void raspi_set_pull_up_down(pins pin,pull_up_down pud);", + "name": "raspi_set_pull_up_down", + "method_name": null, + "unique_global_name": "raspi_set_pull_up_down", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the pull-up/down mode for the specified pin.", + "brief": "Sets the pull up/down mode for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the pull up/down mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "pud": { + "type": "pull_up_down", + "description": "The pull up/down mode to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_set_pull_up_down(pin, pud):" + ], + "pascal": [ + "procedure RaspiSetPullUpDown(pin: Pins; pud: PullUpDown)" + ], + "csharp": [ + "public static void Raspberry.RaspiSetPullUpDown(Pins pin, PullUpDown pud);", + "public static void SplashKit.RaspiSetPullUpDown(Pins pin, PullUpDown pud);" + ], + "cpp": [ + "void raspi_set_pull_up_down(pins pin, pull_up_down pud)" + ] + } + }, + { + "signature": "void raspi_set_pwm_dutycycle(pins pin,int dutycycle);", + "name": "raspi_set_pwm_dutycycle", + "method_name": null, + "unique_global_name": "raspi_set_pwm_dutycycle", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM duty cycle for the specified pin.", + "brief": "Sets the PWM duty cycle for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM duty cycle for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "dutycycle": { + "type": "int", + "description": "The PWM duty cycle to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_set_pwm_dutycycle(pin, dutycycle):" + ], + "pascal": [ + "procedure RaspiSetPwmDutycycle(pin: Pins; dutycycle: Integer)" + ], + "csharp": [ + "public static void Raspberry.RaspiSetPwmDutycycle(Pins pin, int dutycycle);", + "public static void SplashKit.RaspiSetPwmDutycycle(Pins pin, int dutycycle);" + ], + "cpp": [ + "void raspi_set_pwm_dutycycle(pins pin, int dutycycle)" + ] + } + }, + { + "signature": "void raspi_set_pwm_frequency(pins pin,int frequency);", + "name": "raspi_set_pwm_frequency", + "method_name": null, + "unique_global_name": "raspi_set_pwm_frequency", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM frequency for the specified pin.", + "brief": "Sets the PWM frequency for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM frequency for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "frequency": { + "type": "int", + "description": "The PWM frequency to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_set_pwm_frequency(pin, frequency):" + ], + "pascal": [ + "procedure RaspiSetPwmFrequency(pin: Pins; frequency: Integer)" + ], + "csharp": [ + "public static void Raspberry.RaspiSetPwmFrequency(Pins pin, int frequency);", + "public static void SplashKit.RaspiSetPwmFrequency(Pins pin, int frequency);" + ], + "cpp": [ + "void raspi_set_pwm_frequency(pins pin, int frequency)" + ] + } + }, + { + "signature": "void raspi_set_pwm_range(pins pin,int range);", + "name": "raspi_set_pwm_range", + "method_name": null, + "unique_global_name": "raspi_set_pwm_range", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM range for the specified pin.", + "brief": "Sets the PWM range for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM range for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "range": { + "type": "int", + "description": "The PWM range to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_set_pwm_range(pin, range):" + ], + "pascal": [ + "procedure RaspiSetPwmRange(pin: Pins; range: Integer)" + ], + "csharp": [ + "public static void Raspberry.RaspiSetPwmRange(Pins pin, int range);", + "public static void SplashKit.RaspiSetPwmRange(Pins pin, int range);" + ], + "cpp": [ + "void raspi_set_pwm_range(pins pin, int range)" + ] + } + }, + { + "signature": "void raspi_write(pins pin,pin_values value);", + "name": "raspi_write", + "method_name": null, + "unique_global_name": "raspi_write", + "unique_method_name": null, + "suffix_name": null, + "description": "This function writes the specified value to the specified pin.", + "brief": "Writes a value to the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to write the value to.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "value": { + "type": "pin_values", + "description": "The value to write to the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def raspi_write(pin, value):" + ], + "pascal": [ + "procedure RaspiWrite(pin: Pins; value: PinValues)" + ], + "csharp": [ + "public static void Raspberry.RaspiWrite(Pins pin, PinValues value);", + "public static void SplashKit.RaspiWrite(Pins pin, PinValues value);" + ], + "cpp": [ + "void raspi_write(pins pin, pin_values value)" + ] + } + } + ], + "typedefs": [ + + ], + "structs": [ + + ], + "enums": [ + + ], + "defines": [ + + ] + }, "resource_bundles": { "brief": "SplashKit resource bundles allow you to quickly and easily load a\nnumber of resources in the `Resources` folder.", "description": "Supports the loading and freeing of game resource bundles. Resource types\ninclude images, sounds, music and animation files to name a few. Resource\nfiles must be saved in specific locations of a `Resources` folder for\nyour game.", @@ -80585,35 +81175,35 @@ "brief": null, "constants": { "GPIO_INPUT": { - "description": "- Input mode.", + "description": "Input mode.", "number": 0 }, "GPIO_OUTPUT": { - "description": "- Output mode.", + "description": "Output mode.", "number": 1 }, "GPIO_ALT0": { - "description": "- Alternate function mode 0.", + "description": "Alternate function mode 0.", "number": 4 }, "GPIO_ALT1": { - "description": "- Alternate function mode 1.", + "description": "Alternate function mode 1.", "number": 5 }, "GPIO_ALT2": { - "description": "- Alternate function mode 2.", + "description": "Alternate function mode 2.", "number": 6 }, "GPIO_ALT3": { - "description": "- Alternate function mode 3.", + "description": "Alternate function mode 3.", "number": 7 }, "GPIO_ALT4": { - "description": "- Alternate function mode 4.", + "description": "Alternate function mode 4.", "number": 3 }, "GPIO_ALT5": { - "description": "- Alternate function mode 5.", + "description": "Alternate function mode 5.", "number": 2 } }, @@ -80628,11 +81218,11 @@ "brief": null, "constants": { "GPIO_LOW": { - "description": "- Logic low (0).", + "description": "Logic low (0).", "number": 0 }, "GPIO_HIGH": { - "description": "- Logic high (1).", + "description": "Logic high (1).", "number": 1 } }, @@ -80647,163 +81237,163 @@ "brief": null, "constants": { "PIN_1": { - "description": "- 3.3V Power Supply", + "description": "3.3V Power Supply", "number": 1 }, "PIN_2": { - "description": "- 5V Power Supply", + "description": "5V Power Supply", "number": 2 }, "PIN_3": { - "description": "- GPIO2 / SDA (I2C)", + "description": "GPIO2 / SDA (I2C)", "number": 3 }, "PIN_4": { - "description": "- 5V Power Supply", + "description": "5V Power Supply", "number": 4 }, "PIN_5": { - "description": "- GPIO3 / SCL (I2C)", + "description": "GPIO3 / SCL (I2C)", "number": 5 }, "PIN_6": { - "description": "- Ground", + "description": "Ground", "number": 6 }, "PIN_7": { - "description": "- GPIO4", + "description": "GPIO4", "number": 7 }, "PIN_8": { - "description": "- GPIO14 / TXD (UART)", + "description": "GPIO14 / TXD (UART)", "number": 8 }, "PIN_9": { - "description": "- Ground", + "description": "Ground", "number": 9 }, "PIN_10": { - "description": "- GPIO15 / RXD (UART)", + "description": "GPIO15 / RXD (UART)", "number": 10 }, "PIN_11": { - "description": "- GPIO17", + "description": "GPIO17", "number": 11 }, "PIN_12": { - "description": "- GPIO18 / PCM_CLK", + "description": "GPIO18 / PCM_CLK", "number": 12 }, "PIN_13": { - "description": "- GPIO27", + "description": "GPIO27", "number": 13 }, "PIN_14": { - "description": "- Ground", + "description": "Ground", "number": 14 }, "PIN_15": { - "description": "- GPIO22", + "description": "GPIO22", "number": 15 }, "PIN_16": { - "description": "- GPIO23", + "description": "GPIO23", "number": 16 }, "PIN_17": { - "description": "- 3.3V Power Supply", + "description": "3.3V Power Supply", "number": 17 }, "PIN_18": { - "description": "- GPIO24", + "description": "GPIO24", "number": 18 }, "PIN_19": { - "description": "- GPIO10 / MOSI (SPI)", + "description": "GPIO10 / MOSI (SPI)", "number": 19 }, "PIN_20": { - "description": "- Ground", + "description": "Ground", "number": 20 }, "PIN_21": { - "description": "- GPIO9 / MISO (SPI)", + "description": "GPIO9 / MISO (SPI)", "number": 21 }, "PIN_22": { - "description": "- GPIO25", + "description": "GPIO25", "number": 22 }, "PIN_23": { - "description": "- GPIO11 / SCLK (SPI)", + "description": "GPIO11 / SCLK (SPI)", "number": 23 }, "PIN_24": { - "description": "- GPIO8 / CE0 (SPI)", + "description": "GPIO8 / CE0 (SPI)", "number": 24 }, "PIN_25": { - "description": "- Ground", + "description": "Ground", "number": 25 }, "PIN_26": { - "description": "- GPIO7 / CE1 (SPI)", + "description": "GPIO7 / CE1 (SPI)", "number": 26 }, "PIN_27": { - "description": "- ID_SD (I2C ID EEPROM)", + "description": "ID_SD (I2C ID EEPROM)", "number": 27 }, "PIN_28": { - "description": "- ID_SC (I2C ID EEPROM)", + "description": "ID_SC (I2C ID EEPROM)", "number": 28 }, "PIN_29": { - "description": "- GPIO5", + "description": "GPIO5", "number": 29 }, "PIN_30": { - "description": "- Ground", + "description": "Ground", "number": 30 }, "PIN_31": { - "description": "- GPIO6", + "description": "GPIO6", "number": 31 }, "PIN_32": { - "description": "- GPIO12", + "description": "GPIO12", "number": 32 }, "PIN_33": { - "description": "- GPIO13", + "description": "GPIO13", "number": 33 }, "PIN_34": { - "description": "- Ground", + "description": "Ground", "number": 34 }, "PIN_35": { - "description": "- GPIO19 / MISO (PCM)", + "description": "GPIO19 / MISO (PCM)", "number": 35 }, "PIN_36": { - "description": "- GPIO16 / CE0 (PCM)", + "description": "GPIO16 / CE0 (PCM)", "number": 36 }, "PIN_37": { - "description": "- GPIO26", + "description": "GPIO26", "number": 37 }, "PIN_38": { - "description": "- GPIO20 / MOSI (PCM)", + "description": "GPIO20 / MOSI (PCM)", "number": 38 }, "PIN_39": { - "description": "- Ground", + "description": "Ground", "number": 39 }, "PIN_40": { - "description": "- GPIO21 / SCLK (PCM)", + "description": "GPIO21 / SCLK (PCM)", "number": 40 } }, @@ -80818,15 +81408,15 @@ "brief": null, "constants": { "PUD_OFF": { - "description": "- No pull-up or pull-down resistor.", + "description": "No pull-up or pull-down resistor.", "number": 0 }, "PUD_DOWN": { - "description": "- Enable pull-down resistor.", + "description": "Enable pull-down resistor.", "number": 1 }, "PUD_UP": { - "description": "- Enable pull-up resistor.", + "description": "Enable pull-up resistor.", "number": 2 } }, diff --git a/generated/pascal/splashkit.pas b/generated/pascal/splashkit.pas index ab306274..6a835f13 100644 --- a/generated/pascal/splashkit.pas +++ b/generated/pascal/splashkit.pas @@ -1078,6 +1078,16 @@ function TrianglesFrom(const q: Quad): ArrayOfTriangle; function Rnd(min: Integer; max: Integer): Integer; function Rnd(): Single; function Rnd(ubound: Integer): Integer; +procedure RaspiCleanup(); +function RaspiGetMode(pin: Pins): PinModes; +procedure RaspiInit(); +function RaspiRead(pin: Pins): PinValues; +procedure RaspiSetMode(pin: Pins; mode: PinModes); +procedure RaspiSetPullUpDown(pin: Pins; pud: PullUpDown); +procedure RaspiSetPwmDutycycle(pin: Pins; dutycycle: Integer); +procedure RaspiSetPwmFrequency(pin: Pins; frequency: Integer); +procedure RaspiSetPwmRange(pin: Pins; range: Integer); +procedure RaspiWrite(pin: Pins; value: PinValues); procedure DrawQuad(clr: Color; const q: Quad); procedure DrawQuad(clr: Color; const q: Quad; const opts: DrawingOptions); procedure DrawQuadOnBitmap(destination: Bitmap; clr: Color; const q: Quad); @@ -3184,6 +3194,16 @@ function __sklib__triangles_from__quad_ref(const q: __sklib_quad): __sklib_vecto function __sklib__rnd__int__int(min: Integer; max: Integer): Integer; cdecl; external; function __sklib__rnd(): Single; cdecl; external; function __sklib__rnd__int(ubound: Integer): Integer; cdecl; external; +procedure __sklib__raspi_cleanup(); cdecl; external; +function __sklib__raspi_get_mode__pins(pin: LongInt): LongInt; cdecl; external; +procedure __sklib__raspi_init(); cdecl; external; +function __sklib__raspi_read__pins(pin: LongInt): LongInt; cdecl; external; +procedure __sklib__raspi_set_mode__pins__pin_modes(pin: LongInt; mode: LongInt); cdecl; external; +procedure __sklib__raspi_set_pull_up_down__pins__pull_up_down(pin: LongInt; pud: LongInt); cdecl; external; +procedure __sklib__raspi_set_pwm_dutycycle__pins__int(pin: LongInt; dutycycle: Integer); cdecl; external; +procedure __sklib__raspi_set_pwm_frequency__pins__int(pin: LongInt; frequency: Integer); cdecl; external; +procedure __sklib__raspi_set_pwm_range__pins__int(pin: LongInt; range: Integer); cdecl; external; +procedure __sklib__raspi_write__pins__pin_values(pin: LongInt; value: LongInt); cdecl; external; procedure __sklib__draw_quad__color__quad_ref(clr: __sklib_color; const q: __sklib_quad); cdecl; external; procedure __sklib__draw_quad__color__quad_ref__drawing_options_ref(clr: __sklib_color; const q: __sklib_quad; const opts: __sklib_drawing_options); cdecl; external; procedure __sklib__draw_quad_on_bitmap__bitmap__color__quad_ref(destination: __sklib_ptr; clr: __sklib_color; const q: __sklib_quad); cdecl; external; @@ -10339,6 +10359,86 @@ function Rnd(ubound: Integer): Integer; __skreturn := __sklib__rnd__int(__skparam__ubound); result := __skadapter__to_int(__skreturn); end; +procedure RaspiCleanup(); +begin + __sklib__raspi_cleanup(); +end; +function RaspiGetMode(pin: Pins): PinModes; +var + __skparam__pin: LongInt; + __skreturn: LongInt; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skreturn := __sklib__raspi_get_mode__pins(__skparam__pin); + result := __skadapter__to_pin_modes(__skreturn); +end; +procedure RaspiInit(); +begin + __sklib__raspi_init(); +end; +function RaspiRead(pin: Pins): PinValues; +var + __skparam__pin: LongInt; + __skreturn: LongInt; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skreturn := __sklib__raspi_read__pins(__skparam__pin); + result := __skadapter__to_pin_values(__skreturn); +end; +procedure RaspiSetMode(pin: Pins; mode: PinModes); +var + __skparam__pin: LongInt; + __skparam__mode: LongInt; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__mode := __skadapter__to_sklib_pin_modes(mode); + __sklib__raspi_set_mode__pins__pin_modes(__skparam__pin, __skparam__mode); +end; +procedure RaspiSetPullUpDown(pin: Pins; pud: PullUpDown); +var + __skparam__pin: LongInt; + __skparam__pud: LongInt; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__pud := __skadapter__to_sklib_pull_up_down(pud); + __sklib__raspi_set_pull_up_down__pins__pull_up_down(__skparam__pin, __skparam__pud); +end; +procedure RaspiSetPwmDutycycle(pin: Pins; dutycycle: Integer); +var + __skparam__pin: LongInt; + __skparam__dutycycle: Integer; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__dutycycle := __skadapter__to_sklib_int(dutycycle); + __sklib__raspi_set_pwm_dutycycle__pins__int(__skparam__pin, __skparam__dutycycle); +end; +procedure RaspiSetPwmFrequency(pin: Pins; frequency: Integer); +var + __skparam__pin: LongInt; + __skparam__frequency: Integer; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__frequency := __skadapter__to_sklib_int(frequency); + __sklib__raspi_set_pwm_frequency__pins__int(__skparam__pin, __skparam__frequency); +end; +procedure RaspiSetPwmRange(pin: Pins; range: Integer); +var + __skparam__pin: LongInt; + __skparam__range: Integer; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__range := __skadapter__to_sklib_int(range); + __sklib__raspi_set_pwm_range__pins__int(__skparam__pin, __skparam__range); +end; +procedure RaspiWrite(pin: Pins; value: PinValues); +var + __skparam__pin: LongInt; + __skparam__value: LongInt; +begin + __skparam__pin := __skadapter__to_sklib_pins(pin); + __skparam__value := __skadapter__to_sklib_pin_values(value); + __sklib__raspi_write__pins__pin_values(__skparam__pin, __skparam__value); +end; procedure DrawQuad(clr: Color; const q: Quad); var __skparam__clr: __sklib_color; diff --git a/generated/python/splashkit.py b/generated/python/splashkit.py index b4ea5e71..6feb1776 100644 --- a/generated/python/splashkit.py +++ b/generated/python/splashkit.py @@ -2763,6 +2763,26 @@ def __skadapter__to_sklib_window(v): sklib.__sklib__rnd.restype = c_float sklib.__sklib__rnd__int.argtypes = [ c_int ] sklib.__sklib__rnd__int.restype = c_int +sklib.__sklib__raspi_cleanup.argtypes = [ ] +sklib.__sklib__raspi_cleanup.restype = None +sklib.__sklib__raspi_get_mode__pins.argtypes = [ c_int ] +sklib.__sklib__raspi_get_mode__pins.restype = c_int +sklib.__sklib__raspi_init.argtypes = [ ] +sklib.__sklib__raspi_init.restype = None +sklib.__sklib__raspi_read__pins.argtypes = [ c_int ] +sklib.__sklib__raspi_read__pins.restype = c_int +sklib.__sklib__raspi_set_mode__pins__pin_modes.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_set_mode__pins__pin_modes.restype = None +sklib.__sklib__raspi_set_pull_up_down__pins__pull_up_down.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_set_pull_up_down__pins__pull_up_down.restype = None +sklib.__sklib__raspi_set_pwm_dutycycle__pins__int.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_set_pwm_dutycycle__pins__int.restype = None +sklib.__sklib__raspi_set_pwm_frequency__pins__int.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_set_pwm_frequency__pins__int.restype = None +sklib.__sklib__raspi_set_pwm_range__pins__int.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_set_pwm_range__pins__int.restype = None +sklib.__sklib__raspi_write__pins__pin_values.argtypes = [ c_int, c_int ] +sklib.__sklib__raspi_write__pins__pin_values.restype = None sklib.__sklib__draw_quad__color__quad_ref.argtypes = [ _sklib_color, _sklib_quad ] sklib.__sklib__draw_quad__color__quad_ref.restype = None sklib.__sklib__draw_quad__color__quad_ref__drawing_options_ref.argtypes = [ _sklib_color, _sklib_quad, _sklib_drawing_options ] @@ -6693,6 +6713,42 @@ def rnd_int ( ubound ): __skparam__ubound = __skadapter__to_sklib_int(ubound) __skreturn = sklib.__sklib__rnd__int(__skparam__ubound) return __skadapter__to_int(__skreturn) +def raspi_cleanup ( ): + sklib.__sklib__raspi_cleanup() +def raspi_get_mode ( pin ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skreturn = sklib.__sklib__raspi_get_mode__pins(__skparam__pin) + return __skadapter__to_pin_modes(__skreturn) +def raspi_init ( ): + sklib.__sklib__raspi_init() +def raspi_read ( pin ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skreturn = sklib.__sklib__raspi_read__pins(__skparam__pin) + return __skadapter__to_pin_values(__skreturn) +def raspi_set_mode ( pin, mode ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__mode = __skadapter__to_sklib_pin_modes(mode) + sklib.__sklib__raspi_set_mode__pins__pin_modes(__skparam__pin, __skparam__mode) +def raspi_set_pull_up_down ( pin, pud ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__pud = __skadapter__to_sklib_pull_up_down(pud) + sklib.__sklib__raspi_set_pull_up_down__pins__pull_up_down(__skparam__pin, __skparam__pud) +def raspi_set_pwm_dutycycle ( pin, dutycycle ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__dutycycle = __skadapter__to_sklib_int(dutycycle) + sklib.__sklib__raspi_set_pwm_dutycycle__pins__int(__skparam__pin, __skparam__dutycycle) +def raspi_set_pwm_frequency ( pin, frequency ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__frequency = __skadapter__to_sklib_int(frequency) + sklib.__sklib__raspi_set_pwm_frequency__pins__int(__skparam__pin, __skparam__frequency) +def raspi_set_pwm_range ( pin, range ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__range = __skadapter__to_sklib_int(range) + sklib.__sklib__raspi_set_pwm_range__pins__int(__skparam__pin, __skparam__range) +def raspi_write ( pin, value ): + __skparam__pin = __skadapter__to_sklib_pins(pin) + __skparam__value = __skadapter__to_sklib_pin_values(value) + sklib.__sklib__raspi_write__pins__pin_values(__skparam__pin, __skparam__value) def draw_quad ( clr, q ): __skparam__clr = __skadapter__to_sklib_color(clr) __skparam__q = __skadapter__to_sklib_quad(q) diff --git a/generated/translator_cache.json b/generated/translator_cache.json index 325a1cb7..b96f6138 100644 --- a/generated/translator_cache.json +++ b/generated/translator_cache.json @@ -3,7 +3,7 @@ "group": "animations", "brief": "Animations in SplashKit can be used to move between cells in\nbitmaps and sprites. Each animation generates a number sequence\nthat can then be used when drawing bitmaps.", "description": null, - "parsed_at": 1705981404, + "parsed_at": 1706062545, "path": "coresdk/src/coresdk/animations.h", "functions": [ { @@ -1951,7 +1951,7 @@ "group": "audio", "brief": "SplashKit Audio allows you to load and play music and sound effects.", "description": "SplashKit's audio library allows you to easily load and play music and\nsound effects within your programs. To get started with audio the first\nthing you need to do is load a sound effect or music file. You can do this\nby calling the `load_sound_effect(string name)` function to the\n`load_music(string name)` function.", - "parsed_at": 1705981405, + "parsed_at": 1706062546, "path": "coresdk/src/coresdk/audio.h", "functions": [ { @@ -2045,7 +2045,7 @@ "group": "utilities", "brief": "SplashKit provides some basic data manipulation functions to\nhelp make it easy to get some basic tasks performed.", "description": null, - "parsed_at": 1705981405, + "parsed_at": 1706062546, "path": "coresdk/src/coresdk/basics.h", "functions": [ { @@ -2362,7 +2362,7 @@ "group": "resource_bundles", "brief": "SplashKit resource bundles allow you to quickly and easily load a\nnumber of resources in the `Resources` folder.", "description": "Supports the loading and freeing of game resource bundles. Resource types\ninclude images, sounds, music and animation files to name a few. Resource\nfiles must be saved in specific locations of a `Resources` folder for\nyour game.", - "parsed_at": 1705981405, + "parsed_at": 1706062546, "path": "coresdk/src/coresdk/bundles.h", "functions": [ { @@ -2507,7 +2507,7 @@ "group": "camera", "brief": "SplashKit camera functionality allows you to move a virtual camera\naround in your world.", "description": "Splashkit camera functionality allows you to move a virtual camera around in\nyour world. This camera projects to the users window, allowing you to\ndraw things to the screen in your world coordinates.", - "parsed_at": 1705981406, + "parsed_at": 1706062547, "path": "coresdk/src/coresdk/camera.h", "functions": [ { @@ -3574,7 +3574,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981407, + "parsed_at": 1706062548, "path": "coresdk/src/coresdk/circle_drawing.h", "functions": [ { @@ -4945,7 +4945,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981408, + "parsed_at": 1706062549, "path": "coresdk/src/coresdk/circle_geometry.h", "functions": [ { @@ -5872,7 +5872,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981408, + "parsed_at": 1706062549, "path": "coresdk/src/coresdk/clipping.h", "functions": [ { @@ -6456,7 +6456,7 @@ "group": "physics", "brief": "SplashKit Collisions library allow you to perform tests between\nbitmaps, sprites and shapes to determin if a collision has occured.", "description": null, - "parsed_at": 1705981410, + "parsed_at": 1706062551, "path": "coresdk/src/coresdk/collisions.h", "functions": [ { @@ -8707,7 +8707,7 @@ "group": "color", "brief": "SplashKit simplifies color manipulation in graphical applications for developers, ensuring ease of use and efficiency.", "description": null, - "parsed_at": 1705981414, + "parsed_at": 1706062556, "path": "coresdk/src/coresdk/color.h", "functions": [ { @@ -13907,7 +13907,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981416, + "parsed_at": 1706062557, "path": "coresdk/src/coresdk/drawing_options.h", "functions": [ { @@ -15271,7 +15271,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981417, + "parsed_at": 1706062558, "path": "coresdk/src/coresdk/ellipse_drawing.h", "functions": [ { @@ -17366,7 +17366,7 @@ "group": "geometry", "brief": "SplashKit's geometry functions assist with geometry-related computations.", "description": null, - "parsed_at": 1705981417, + "parsed_at": 1706062558, "path": "coresdk/src/coresdk/geometry.h", "functions": [ { @@ -17498,7 +17498,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981418, + "parsed_at": 1706062559, "path": "coresdk/src/coresdk/graphics.h", "functions": [ { @@ -18074,7 +18074,7 @@ "group": "graphics", "brief": "SplashKit Images allow drawing of bitmaps and sprites to graphic windows.", "description": null, - "parsed_at": 1705981419, + "parsed_at": 1706062560, "path": "coresdk/src/coresdk/images.h", "functions": [ { @@ -20562,7 +20562,7 @@ "group": "input", "brief": "Input handles user interaction and events such as keypresses.", "description": null, - "parsed_at": 1705981419, + "parsed_at": 1706062561, "path": "coresdk/src/coresdk/input.h", "functions": [ { @@ -20655,7 +20655,7 @@ "group": "json", "brief": "SplashKit Json allows you to create and read JSON objects.", "description": "Splashkit's JSON library allows you to easily create or read JSON objects and\nmanipulate them to/from a JSON string or from a file containing a JSON\nstring. Create a new JSON object with a call to `create_json()` and\nread or write data to it by calling methods like\n`json_add_string(json j, string key, string value)` and\n`json_read_string(json j, string key)`.", - "parsed_at": 1705981421, + "parsed_at": 1706062562, "path": "coresdk/src/coresdk/json.h", "functions": [ { @@ -22407,7 +22407,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1705981422, + "parsed_at": 1706062564, "path": "coresdk/src/coresdk/keyboard_input.h", "functions": [ { @@ -23405,7 +23405,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981423, + "parsed_at": 1706062565, "path": "coresdk/src/coresdk/line_drawing.h", "functions": [ { @@ -24944,7 +24944,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981424, + "parsed_at": 1706062565, "path": "coresdk/src/coresdk/line_geometry.h", "functions": [ { @@ -25818,7 +25818,7 @@ "group": "logging", "brief": "SplashKit Logging facilitates streamlined logging with customizable severity levels and modes.", "description": "SplashKit Logging module, allows users to initialize a custom logger with specified log levels and modes (console, file, or both). \nThe module provides functions to log messages at different severity levels (INFO, DEBUG, WARNING, ERROR, FATAL) with timestamped entries. \nUsers can close the logging process as needed, and the module handles customization for console and file output.", - "parsed_at": 1705981425, + "parsed_at": 1706062566, "path": "coresdk/src/coresdk/logging.h", "functions": [ { @@ -26067,7 +26067,7 @@ "group": "physics", "brief": "Provides matrix functions to work on 2d coordinates.", "description": null, - "parsed_at": 1705981425, + "parsed_at": 1706062566, "path": "coresdk/src/coresdk/matrix_2d.h", "functions": [ { @@ -26805,7 +26805,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1705981426, + "parsed_at": 1706062567, "path": "coresdk/src/coresdk/mouse_input.h", "functions": [ { @@ -27292,7 +27292,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1705981427, + "parsed_at": 1706062568, "path": "coresdk/src/coresdk/music.h", "functions": [ { @@ -28285,7 +28285,7 @@ "group": "networking", "brief": "SplashKit's network-related functions allow you to communicate data\nacross networks.", "description": null, - "parsed_at": 1705981430, + "parsed_at": 1706062570, "path": "coresdk/src/coresdk/networking.h", "functions": [ { @@ -31429,7 +31429,7 @@ "group": "physics", "brief": null, "description": null, - "parsed_at": 1705981430, + "parsed_at": 1706062570, "path": "coresdk/src/coresdk/physics.h", "functions": [ @@ -31451,7 +31451,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981431, + "parsed_at": 1706062571, "path": "coresdk/src/coresdk/point_drawing.h", "functions": [ { @@ -32771,7 +32771,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981432, + "parsed_at": 1706062572, "path": "coresdk/src/coresdk/point_geometry.h", "functions": [ { @@ -33795,7 +33795,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981433, + "parsed_at": 1706062572, "path": "coresdk/src/coresdk/quad_geometry.h", "functions": [ { @@ -34260,7 +34260,7 @@ "group": "utilities", "brief": "SplashKit random provides a simple implementation of random.", "description": "The SplashKit`s random library provides two rnd methods, a `rnd()` which generates\na random number between 0 and 1, and `rnd(int ubound)` which\ngenerates a random number between 0 and the value scpeficied in `ubound`.", - "parsed_at": 1705981434, + "parsed_at": 1706062572, "path": "coresdk/src/coresdk/random.h", "functions": [ { @@ -34390,11 +34390,454 @@ ] }, + "raspi_gpio": { + "group": "raspberry", + "brief": "Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi.", + "description": null, + "parsed_at": 1706062573, + "path": "coresdk/src/coresdk/raspi_gpio.h", + "functions": [ + { + "signature": "void raspi_cleanup();", + "name": "raspi_cleanup", + "method_name": null, + "unique_global_name": "raspi_cleanup", + "unique_method_name": null, + "suffix_name": null, + "description": "This function should be called when you are finished using the GPIO library. It sets all pin modes to INPUT and values to LOW.", + "brief": "Cleans up and releases any resources used by the GPIO library.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "pin_modes raspi_get_mode(pins pin);", + "name": "raspi_get_mode", + "method_name": null, + "unique_global_name": "raspi_get_mode", + "unique_method_name": null, + "suffix_name": null, + "description": "This function retrieves the mode of the specified pin.", + "brief": "Gets the mode of the specified pin.", + "return": { + "type": "pin_modes", + "description": "The mode of the pin.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to get the mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_init();", + "name": "raspi_init", + "method_name": null, + "unique_global_name": "raspi_init", + "unique_method_name": null, + "suffix_name": null, + "description": "This function initializes the GPIO library for use. It should be called before any other GPIO functions.", + "brief": "Initializes the GPIO library.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "pin_values raspi_read(pins pin);", + "name": "raspi_read", + "method_name": null, + "unique_global_name": "raspi_read", + "unique_method_name": null, + "suffix_name": null, + "description": "This function reads the value from the specified pin.", + "brief": "Reads the value from the specified pin.", + "return": { + "type": "pin_values", + "description": "The value read from the pin.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to read the value from.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_set_mode(pins pin,pin_modes mode);", + "name": "raspi_set_mode", + "method_name": null, + "unique_global_name": "raspi_set_mode", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the mode of the specified pin to the specified mode.", + "brief": "Sets the mode of the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "mode": { + "type": "pin_modes", + "description": "The mode to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_set_pull_up_down(pins pin,pull_up_down pud);", + "name": "raspi_set_pull_up_down", + "method_name": null, + "unique_global_name": "raspi_set_pull_up_down", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the pull-up/down mode for the specified pin.", + "brief": "Sets the pull up/down mode for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the pull up/down mode for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "pud": { + "type": "pull_up_down", + "description": "The pull up/down mode to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_set_pwm_dutycycle(pins pin,int dutycycle);", + "name": "raspi_set_pwm_dutycycle", + "method_name": null, + "unique_global_name": "raspi_set_pwm_dutycycle", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM duty cycle for the specified pin.", + "brief": "Sets the PWM duty cycle for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM duty cycle for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "dutycycle": { + "type": "int", + "description": "The PWM duty cycle to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_set_pwm_frequency(pins pin,int frequency);", + "name": "raspi_set_pwm_frequency", + "method_name": null, + "unique_global_name": "raspi_set_pwm_frequency", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM frequency for the specified pin.", + "brief": "Sets the PWM frequency for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM frequency for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "frequency": { + "type": "int", + "description": "The PWM frequency to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_set_pwm_range(pins pin,int range);", + "name": "raspi_set_pwm_range", + "method_name": null, + "unique_global_name": "raspi_set_pwm_range", + "unique_method_name": null, + "suffix_name": null, + "description": "This function sets the PWM range for the specified pin.", + "brief": "Sets the PWM range for the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to set the PWM range for.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "range": { + "type": "int", + "description": "The PWM range to set for the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, + { + "signature": "void raspi_write(pins pin,pin_values value);", + "name": "raspi_write", + "method_name": null, + "unique_global_name": "raspi_write", + "unique_method_name": null, + "suffix_name": null, + "description": "This function writes the specified value to the specified pin.", + "brief": "Writes a value to the specified pin.", + "return": { + "type": "void", + "description": null, + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + "pin": { + "type": "pins", + "description": "The pin to write the value to.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + }, + "value": { + "type": "pin_values", + "description": "The value to write to the pin.", + "is_pointer": false, + "is_const": false, + "is_reference": false, + "is_array": false, + "array_dimension_sizes": [ + + ], + "is_vector": false, + "type_parameter": null + } + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + } + ], + "typedefs": [ + + ], + "structs": [ + + ], + "enums": [ + + ], + "defines": [ + + ] + }, "rectangle_drawing": { "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981436, + "parsed_at": 1706062575, "path": "coresdk/src/coresdk/rectangle_drawing.h", "functions": [ { @@ -37287,7 +37730,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981437, + "parsed_at": 1706062576, "path": "coresdk/src/coresdk/rectangle_geometry.h", "functions": [ { @@ -38073,7 +38516,7 @@ "group": "resources", "brief": "SplashKit resource functions allow you to locate resources in a\nproject's `Resources` folder.", "description": null, - "parsed_at": 1705981438, + "parsed_at": 1706062576, "path": "coresdk/src/coresdk/resources.h", "functions": [ { @@ -38391,7 +38834,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1705981440, + "parsed_at": 1706062577, "path": "coresdk/src/coresdk/sound.h", "functions": [ { @@ -39363,7 +39806,7 @@ "group": "sprites", "brief": "SplashKit Sprites allows you to create images you can easily\nmove and animate.", "description": "SplashKit sprites are game elements that can be moved, and animated. Sprites\nare located at a position in the game, have a velocity, and an animation.\nThe sprite can also have arbitary data associated with it for game specific\npurposes.", - "parsed_at": 1705981445, + "parsed_at": 1706062581, "path": "coresdk/src/coresdk/sprites.h", "functions": [ { @@ -46239,7 +46682,7 @@ "group": "terminal", "brief": "SplashKit Terminal allows you to read and write values to the\nterminal in a consistent manner.", "description": null, - "parsed_at": 1705981446, + "parsed_at": 1706062581, "path": "coresdk/src/coresdk/terminal.h", "functions": [ { @@ -46635,7 +47078,7 @@ "group": "graphics", "brief": "SplashKit Text allows for drawing text in a variety of ways to\ngraphic windows.", "description": null, - "parsed_at": 1705981448, + "parsed_at": 1706062583, "path": "coresdk/src/coresdk/text.h", "functions": [ { @@ -49538,7 +49981,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1705981449, + "parsed_at": 1706062584, "path": "coresdk/src/coresdk/text_input.h", "functions": [ { @@ -50073,7 +50516,7 @@ "group": "timers", "brief": "Timers in SplashKit can be used to track the passing of time.", "description": null, - "parsed_at": 1705981450, + "parsed_at": 1706062584, "path": "coresdk/src/coresdk/timers.h", "functions": [ { @@ -50911,7 +51354,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1705981452, + "parsed_at": 1706062586, "path": "coresdk/src/coresdk/triangle_drawing.h", "functions": [ { @@ -53318,7 +53761,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1705981453, + "parsed_at": 1706062586, "path": "coresdk/src/coresdk/triangle_geometry.h", "functions": [ { @@ -53679,7 +54122,7 @@ "group": "types", "brief": "SplashKit Types simplifies data type creation and management for streamlined programming.", "description": null, - "parsed_at": 1705981455, + "parsed_at": 1706062588, "path": "coresdk/src/coresdk/types.h", "functions": [ @@ -54409,35 +54852,35 @@ "brief": null, "constants": { "GPIO_INPUT": { - "description": "- Input mode.", + "description": "Input mode.", "number": 0 }, "GPIO_OUTPUT": { - "description": "- Output mode.", + "description": "Output mode.", "number": 1 }, "GPIO_ALT0": { - "description": "- Alternate function mode 0.", + "description": "Alternate function mode 0.", "number": 4 }, "GPIO_ALT1": { - "description": "- Alternate function mode 1.", + "description": "Alternate function mode 1.", "number": 5 }, "GPIO_ALT2": { - "description": "- Alternate function mode 2.", + "description": "Alternate function mode 2.", "number": 6 }, "GPIO_ALT3": { - "description": "- Alternate function mode 3.", + "description": "Alternate function mode 3.", "number": 7 }, "GPIO_ALT4": { - "description": "- Alternate function mode 4.", + "description": "Alternate function mode 4.", "number": 3 }, "GPIO_ALT5": { - "description": "- Alternate function mode 5.", + "description": "Alternate function mode 5.", "number": 2 } }, @@ -54452,11 +54895,11 @@ "brief": null, "constants": { "GPIO_LOW": { - "description": "- Logic low (0).", + "description": "Logic low (0).", "number": 0 }, "GPIO_HIGH": { - "description": "- Logic high (1).", + "description": "Logic high (1).", "number": 1 } }, @@ -54471,163 +54914,163 @@ "brief": null, "constants": { "PIN_1": { - "description": "- 3.3V Power Supply", + "description": "3.3V Power Supply", "number": 1 }, "PIN_2": { - "description": "- 5V Power Supply", + "description": "5V Power Supply", "number": 2 }, "PIN_3": { - "description": "- GPIO2 / SDA (I2C)", + "description": "GPIO2 / SDA (I2C)", "number": 3 }, "PIN_4": { - "description": "- 5V Power Supply", + "description": "5V Power Supply", "number": 4 }, "PIN_5": { - "description": "- GPIO3 / SCL (I2C)", + "description": "GPIO3 / SCL (I2C)", "number": 5 }, "PIN_6": { - "description": "- Ground", + "description": "Ground", "number": 6 }, "PIN_7": { - "description": "- GPIO4", + "description": "GPIO4", "number": 7 }, "PIN_8": { - "description": "- GPIO14 / TXD (UART)", + "description": "GPIO14 / TXD (UART)", "number": 8 }, "PIN_9": { - "description": "- Ground", + "description": "Ground", "number": 9 }, "PIN_10": { - "description": "- GPIO15 / RXD (UART)", + "description": "GPIO15 / RXD (UART)", "number": 10 }, "PIN_11": { - "description": "- GPIO17", + "description": "GPIO17", "number": 11 }, "PIN_12": { - "description": "- GPIO18 / PCM_CLK", + "description": "GPIO18 / PCM_CLK", "number": 12 }, "PIN_13": { - "description": "- GPIO27", + "description": "GPIO27", "number": 13 }, "PIN_14": { - "description": "- Ground", + "description": "Ground", "number": 14 }, "PIN_15": { - "description": "- GPIO22", + "description": "GPIO22", "number": 15 }, "PIN_16": { - "description": "- GPIO23", + "description": "GPIO23", "number": 16 }, "PIN_17": { - "description": "- 3.3V Power Supply", + "description": "3.3V Power Supply", "number": 17 }, "PIN_18": { - "description": "- GPIO24", + "description": "GPIO24", "number": 18 }, "PIN_19": { - "description": "- GPIO10 / MOSI (SPI)", + "description": "GPIO10 / MOSI (SPI)", "number": 19 }, "PIN_20": { - "description": "- Ground", + "description": "Ground", "number": 20 }, "PIN_21": { - "description": "- GPIO9 / MISO (SPI)", + "description": "GPIO9 / MISO (SPI)", "number": 21 }, "PIN_22": { - "description": "- GPIO25", + "description": "GPIO25", "number": 22 }, "PIN_23": { - "description": "- GPIO11 / SCLK (SPI)", + "description": "GPIO11 / SCLK (SPI)", "number": 23 }, "PIN_24": { - "description": "- GPIO8 / CE0 (SPI)", + "description": "GPIO8 / CE0 (SPI)", "number": 24 }, "PIN_25": { - "description": "- Ground", + "description": "Ground", "number": 25 }, "PIN_26": { - "description": "- GPIO7 / CE1 (SPI)", + "description": "GPIO7 / CE1 (SPI)", "number": 26 }, "PIN_27": { - "description": "- ID_SD (I2C ID EEPROM)", + "description": "ID_SD (I2C ID EEPROM)", "number": 27 }, "PIN_28": { - "description": "- ID_SC (I2C ID EEPROM)", + "description": "ID_SC (I2C ID EEPROM)", "number": 28 }, "PIN_29": { - "description": "- GPIO5", + "description": "GPIO5", "number": 29 }, "PIN_30": { - "description": "- Ground", + "description": "Ground", "number": 30 }, "PIN_31": { - "description": "- GPIO6", + "description": "GPIO6", "number": 31 }, "PIN_32": { - "description": "- GPIO12", + "description": "GPIO12", "number": 32 }, "PIN_33": { - "description": "- GPIO13", + "description": "GPIO13", "number": 33 }, "PIN_34": { - "description": "- Ground", + "description": "Ground", "number": 34 }, "PIN_35": { - "description": "- GPIO19 / MISO (PCM)", + "description": "GPIO19 / MISO (PCM)", "number": 35 }, "PIN_36": { - "description": "- GPIO16 / CE0 (PCM)", + "description": "GPIO16 / CE0 (PCM)", "number": 36 }, "PIN_37": { - "description": "- GPIO26", + "description": "GPIO26", "number": 37 }, "PIN_38": { - "description": "- GPIO20 / MOSI (PCM)", + "description": "GPIO20 / MOSI (PCM)", "number": 38 }, "PIN_39": { - "description": "- Ground", + "description": "Ground", "number": 39 }, "PIN_40": { - "description": "- GPIO21 / SCLK (PCM)", + "description": "GPIO21 / SCLK (PCM)", "number": 40 } }, @@ -54642,15 +55085,15 @@ "brief": null, "constants": { "PUD_OFF": { - "description": "- No pull-up or pull-down resistor.", + "description": "No pull-up or pull-down resistor.", "number": 0 }, "PUD_DOWN": { - "description": "- Enable pull-down resistor.", + "description": "Enable pull-down resistor.", "number": 1 }, "PUD_UP": { - "description": "- Enable pull-up resistor.", + "description": "Enable pull-up resistor.", "number": 2 } }, @@ -54667,7 +55110,7 @@ "group": "utilities", "brief": "SplashKit provides miscellaneous utilities for unclassified functionality.", "description": null, - "parsed_at": 1705981455, + "parsed_at": 1706062588, "path": "coresdk/src/coresdk/utils.h", "functions": [ { @@ -54875,7 +55318,7 @@ "group": "physics", "brief": "Provides vector functions to work on vectors.", "description": null, - "parsed_at": 1705981456, + "parsed_at": 1706062589, "path": "coresdk/src/coresdk/vector_2d.h", "functions": [ { @@ -56308,7 +56751,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1705981457, + "parsed_at": 1706062590, "path": "coresdk/src/coresdk/web_client.h", "functions": [ { @@ -56903,7 +57346,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1705981458, + "parsed_at": 1706062591, "path": "coresdk/src/coresdk/web_server.h", "functions": [ { @@ -58622,7 +59065,7 @@ "group": "windows", "brief": "Window Manager in SplashKit can be used create, and manipulate\ngraphics windows", "description": null, - "parsed_at": 1705981460, + "parsed_at": 1706062593, "path": "coresdk/src/coresdk/window_manager.h", "functions": [ { From c586b8fe8697b3c9c786365124eab8a52ba0bb8e Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Thu, 25 Jan 2024 00:32:54 +1100 Subject: [PATCH 5/6] Update GPIO functionality and fix formatting issues --- coresdk/src/backend/gpio_driver.cpp | 214 ++++++++++------------- coresdk/src/backend/gpio_driver.h | 12 +- coresdk/src/coresdk/raspi_gpio.cpp | 52 +++++- coresdk/src/coresdk/raspi_gpio.h | 7 + coresdk/src/coresdk/rectangle_geometry.h | 2 +- coresdk/src/coresdk/terminal.cpp | 3 +- coresdk/src/coresdk/types.h | 8 +- generated/clib/sk_clib.cpp | 4 + generated/clib/sk_clib.h | 1 + generated/cpp/raspi_gpio.h | 1 + generated/cpp/splashkit.cpp | 4 + generated/cpp/types.h | 6 +- generated/csharp/SplashKit.cs | 15 +- generated/docs/api.json | 51 +++++- generated/pascal/splashkit.pas | 15 +- generated/python/splashkit.py | 7 + generated/translator_cache.json | 132 ++++++++------ 17 files changed, 342 insertions(+), 192 deletions(-) diff --git a/coresdk/src/backend/gpio_driver.cpp b/coresdk/src/backend/gpio_driver.cpp index b53d7d75..6e0ebc49 100644 --- a/coresdk/src/backend/gpio_driver.cpp +++ b/coresdk/src/backend/gpio_driver.cpp @@ -1,9 +1,6 @@ -/*********************************************** - * XQuestCode || Aditya Parmar - * © 2024 Aditya Parmar. All Rights Reserved. - * This file is part of the SplashKit Core Library. - * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference - ***********************************************/ +// gpio_driver.cpp +// This file is part of the SplashKit Core Library. +// Copyright (©) 2024 Aditya Parmar. All Rights Reserved. #include "gpio_driver.h" @@ -13,128 +10,99 @@ #ifdef RASPBERRY_PI #include "pigpiod_if2.h" -#endif -using namespace std; +using namespace std; +// Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference namespace splashkit_lib { - int pi; + int pi; - // Check if pigpio_init() has been called before any other GPIO functions - void check_pi() - { -#ifdef RASPBERRY_PI - if (pi < 0) + // Check if pigpio_init() has been called before any other GPIO functions + bool check_pi() { - cout << "pigpio_init() must be called before any other GPIO functions" << endl; - exit(1); + + if (pi < 0) + { + cout << "gpio_init() must be called before any other GPIO functions" << endl; + return true; + } + else + return false; } -#endif - } - // Initialize the GPIO library - int sk_gpio_init() - { -#ifdef RASPBERRY_PI - pi = pigpio_start(0, 0); - return pi; -#else - return -1; -#endif - } - - // Read the value of a GPIO pin - int sk_gpio_read(int pin) - { -#ifdef RASPBERRY_PI - check_pi(); - return gpio_read(pi, pin); -#else - cout << "gpio_read() called, but not on a Raspberry Pi" << endl; - return -1; -#endif - } - - // Write a value to a GPIO pin - void sk_gpio_write(int pin, int value) - { -#ifdef RASPBERRY_PI - check_pi(); - gpio_write(pi, pin, value); -#else - cout << "gpio_write() called, but not on a Raspberry Pi" << endl; -#endif - } - - // Set the mode of a GPIO pin - void sk_gpio_set_mode(int pin, int mode) - { -#ifdef RASPBERRY_PI - check_pi(); - set_mode(pi, pin, mode); -#else - cout << "gpio_set_mode() called, but not on a Raspberry Pi" << endl; -#endif - } - int sk_gpio_get_mode(int pin) - { -#ifdef RASPBERRY_PI - check_pi(); - return get_mode(pi, pin); -#else - cout << "gpio_get_mode() called, but not on a Raspberry Pi" << endl; - return -1; -#endif - } - void sk_gpio_set_pull_up_down(int pin, int pud) - { -#ifdef RASPBERRY_PI - check_pi(); - set_pull_up_down(pi, pin, pud); -#else - - cout << "gpio_set_pull_up_down() called, but not on a Raspberry Pi" << endl; -#endif - } - void sk_set_pwm_range(int pin, int range) - { -#ifdef RASPBERRY_PI - check_pi(); - set_PWM_range(pi, pin, range); -#else - cout << "set_PWM_range() called, but not on a Raspberry Pi" << endl; -#endif - } - void sk_set_pwm_frequency(int pin, int frequency) - { -#ifdef RASPBERRY_PI - check_pi(); - set_PWM_frequency(pi, pin, frequency); -#else - cout << "set_PWM_frequency() called, but not on a Raspberry Pi" << endl; -#endif - } - void sk_set_pwm_dutycycle(int pin, int dutycycle) - { -#ifdef RASPBERRY_PI - check_pi(); - set_PWM_dutycycle(pi, pin, dutycycle); -#else - cout << "set_PWM_dutycycle() called, but not on a Raspberry Pi" << endl; -#endif - } - - - // Cleanup the GPIO library - void sk_gpio_cleanup() - { -#ifdef RASPBERRY_PI - check_pi(); - - pigpio_stop(pi); -#else - cout << "pigpio_cleanup() called, but not on a Raspberry Pi" << endl; -#endif - } -} \ No newline at end of file + // Initialize the GPIO library + int sk_gpio_init() + { + + pi = pigpio_start(0, 0); + return pi; + } + + // Read the value of a GPIO pin + int sk_gpio_read(int pin) + { + + if (check_pi()) + { + return gpio_read(pi, pin); + } + } + + // Write a value to a GPIO pin + void sk_gpio_write(int pin, int value) + { + + check_pi(); + gpio_write(pi, pin, value); + } + + // Set the mode of a GPIO pin + void sk_gpio_set_mode(int pin, int mode) + { + + check_pi(); + set_mode(pi, pin, mode); + } + + int sk_gpio_get_mode(int pin) + { + + check_pi(); + return get_mode(pi, pin); + } + void sk_gpio_set_pull_up_down(int pin, int pud) + { + + check_pi(); + set_pull_up_down(pi, pin, pud); + } + void sk_set_pwm_range(int pin, int range) + { + + check_pi(); + set_PWM_range(pi, pin, range); + } + void sk_set_pwm_frequency(int pin, int frequency) + { + + check_pi(); + set_PWM_frequency(pi, pin, frequency); + } + void sk_set_pwm_dutycycle(int pin, int dutycycle) + { + + check_pi(); + set_PWM_dutycycle(pi, pin, dutycycle); + } + + // Cleanup the GPIO library + void sk_gpio_cleanup() + { + + check_pi(); + + pigpio_stop(pi); + } +} +#endif \ No newline at end of file diff --git a/coresdk/src/backend/gpio_driver.h b/coresdk/src/backend/gpio_driver.h index 8bd317c4..c022d105 100644 --- a/coresdk/src/backend/gpio_driver.h +++ b/coresdk/src/backend/gpio_driver.h @@ -1,13 +1,12 @@ -/*********************************************** - * XQuestCode || Aditya Parmar - * © 2024 Aditya Parmar. All Rights Reserved. - * This file is part of the SplashKit Core Library. - * Use https://abyz.me.uk/rpi/pigpio/pdif2.html for reference - ***********************************************/ +// gpio_driver.h +// This file is part of the SplashKit Core Library. +// Copyright (©) 2024 Aditya Parmar. All Rights Reserved. + #ifndef SPLASHKIT_GPIO_H #define SPLASHKIT_GPIO_H #include // Include the appropriate header file for stdint.h +#ifdef RASPBERRY_PI namespace splashkit_lib { int sk_gpio_init(); @@ -21,4 +20,5 @@ namespace splashkit_lib void sk_set_pwm_dutycycle(int pin, int dutycycle); void sk_gpio_cleanup(); } +#endif #endif /* defined(gpio_driver) */ \ No newline at end of file diff --git a/coresdk/src/coresdk/raspi_gpio.cpp b/coresdk/src/coresdk/raspi_gpio.cpp index 215221c7..ef54d5eb 100644 --- a/coresdk/src/coresdk/raspi_gpio.cpp +++ b/coresdk/src/coresdk/raspi_gpio.cpp @@ -22,16 +22,29 @@ namespace splashkit_lib cout << "Invalid board pin" << endl; return -1; } + bool has_gpio() + { +#ifdef RASPBERRY_PI + return true; +#else + return false; +#endif + } // Initialize GPIO resources void raspi_init() { +#ifdef RASPBERRY_PI sk_gpio_init(); +#else + cout << "GPIO not supported on this platform" << endl; +#endif } // Set the mode of the given pin void raspi_set_mode(pins pin, pin_modes mode) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -45,9 +58,13 @@ namespace splashkit_lib { sk_gpio_set_mode(bcmPin, static_cast(mode)); } +#else + cout << "Unable to set mode - GPIO not supported on this platform" << endl; +#endif } pin_modes raspi_get_mode(pins pin) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -61,12 +78,17 @@ namespace splashkit_lib { return static_cast(sk_gpio_get_mode(bcmPin)); } - return GPIO_INPUT; + return GPIO_DEFAULT_MODE; +#else + return GPIO_DEFAULT_MODE; + cout << "Unable to get mode - GPIO not supported on this platform" << endl; +#endif } // Write a value to the given pin void raspi_write(pins pin, pin_values value) { +#ifdef RASPBERRY_PIv int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -80,11 +102,15 @@ namespace splashkit_lib { sk_gpio_write(bcmPin, static_cast(value)); } +#else + cout << "Unable to write pin - GPIO not supported on this platform" << endl; +#endif } // Read the value of the given pin pin_values raspi_read(pins pin) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -98,9 +124,14 @@ namespace splashkit_lib return GPIO_LOW; } return static_cast(sk_gpio_read(bcmPin)); +#else + cout << "Unable to read pin - GPIO not supported on this platform" << endl; + return GPIO_DEFAULT_VALUE; +#endif } void raspi_set_pull_up_down(pins pin, pull_up_down pud) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -114,9 +145,13 @@ namespace splashkit_lib { sk_gpio_set_pull_up_down(bcmPin, static_cast(pud)); } +#else + cout << "Unable to set pull up/down - GPIO not supported on this platform" << endl; +#endif } void raspi_set_pwm_range(pins pin, int range) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -130,9 +165,13 @@ namespace splashkit_lib { sk_set_pwm_range(bcmPin, range); } +#else + cout << "Unable to set pwm range - GPIO not supported on this platform" << endl; +#endif } void raspi_set_pwm_frequency(pins pin, int frequency) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -146,9 +185,13 @@ namespace splashkit_lib { sk_set_pwm_frequency(bcmPin, frequency); } +#else + cout << "Unable to set pwm frequency - GPIO not supported on this platform" << endl; +#endif } void raspi_set_pwm_dutycycle(pins pin, int dutycycle) { +#ifdef RASPBERRY_PI int bcmPin = boardToBCM(pin); if (bcmPin == -1) { @@ -162,11 +205,15 @@ namespace splashkit_lib { sk_set_pwm_dutycycle(bcmPin, dutycycle); } +#else + cout << "Unable to set pwm dutycycle - GPIO not supported on this platform" << endl; +#endif } // Cleanup GPIO resources void raspi_cleanup() { +#ifdef RASPBERRY_PI cout << "Cleaning GPIO pins" << endl; for (int i = 1; i <= 40; i++) { @@ -178,5 +225,8 @@ namespace splashkit_lib } } sk_gpio_cleanup(); +#else + cout << "Unable to set cleanup - GPIO not supported on this platform" << endl; +#endif } } diff --git a/coresdk/src/coresdk/raspi_gpio.h b/coresdk/src/coresdk/raspi_gpio.h index b4277c87..d1986d1b 100644 --- a/coresdk/src/coresdk/raspi_gpio.h +++ b/coresdk/src/coresdk/raspi_gpio.h @@ -22,6 +22,13 @@ namespace splashkit_lib */ void raspi_init(); + /** + * Checks if the system has GPIO capabilities. + * + * @return true if the system has GPIO capabilities, false otherwise. + */ + bool has_gpio(); + /** * @brief Sets the mode of the specified pin. * diff --git a/coresdk/src/coresdk/rectangle_geometry.h b/coresdk/src/coresdk/rectangle_geometry.h index d29eca14..50cd23f0 100644 --- a/coresdk/src/coresdk/rectangle_geometry.h +++ b/coresdk/src/coresdk/rectangle_geometry.h @@ -1,4 +1,4 @@ - /** +/** * @header rectangle_geometry * @author Jacob Milligan * @attribute group geometry diff --git a/coresdk/src/coresdk/terminal.cpp b/coresdk/src/coresdk/terminal.cpp index f222c37f..24029c9f 100644 --- a/coresdk/src/coresdk/terminal.cpp +++ b/coresdk/src/coresdk/terminal.cpp @@ -9,6 +9,7 @@ #include #include "types.h" #include +# #include using std::map; @@ -62,7 +63,7 @@ namespace splashkit_lib void write_line(char data) { - write_line(string("") + data); + write_line(std::to_string(data)); } string read_line() diff --git a/coresdk/src/coresdk/types.h b/coresdk/src/coresdk/types.h index c6b3faa7..911a2a73 100644 --- a/coresdk/src/coresdk/types.h +++ b/coresdk/src/coresdk/types.h @@ -416,6 +416,7 @@ enum pins * @constant GPIO_ALT3 Alternate function mode 3. * @constant GPIO_ALT4 Alternate function mode 4. * @constant GPIO_ALT5 Alternate function mode 5. + * @constant GPIO_DEFAULT_MODE Default mode. */ enum pin_modes { @@ -426,7 +427,8 @@ enum pin_modes GPIO_ALT2 = 6, GPIO_ALT3 = 7, GPIO_ALT4 = 3, - GPIO_ALT5 = 2 + GPIO_ALT5 = 2, + GPIO_DEFAULT_MODE = -1, }; /** @@ -434,11 +436,13 @@ enum pin_modes * * @constant GPIO_LOW Logic low (0). * @constant GPIO_HIGH Logic high (1). + * @constant GPIO_DEFAULT_VALUE Default value. */ enum pin_values { GPIO_LOW = 0, - GPIO_HIGH = 1 + GPIO_HIGH = 1, + GPIO_DEFAULT_VALUE = -1 }; /** * GPIO Pull-up/Pull-down Configurations: diff --git a/generated/clib/sk_clib.cpp b/generated/clib/sk_clib.cpp index d177aa18..2fc9eb71 100644 --- a/generated/clib/sk_clib.cpp +++ b/generated/clib/sk_clib.cpp @@ -3723,6 +3723,10 @@ int __sklib__rnd__int(int ubound) { int __skreturn = rnd(__skparam__ubound); return __sklib__to_int(__skreturn); } +int __sklib__has_gpio() { + bool __skreturn = has_gpio(); + return __sklib__to_int(__skreturn); +} void __sklib__raspi_cleanup() { raspi_cleanup(); } diff --git a/generated/clib/sk_clib.h b/generated/clib/sk_clib.h index 8f223cc0..e2a8df74 100644 --- a/generated/clib/sk_clib.h +++ b/generated/clib/sk_clib.h @@ -868,6 +868,7 @@ __sklib_vector_triangle __sklib__triangles_from__quad_ref(const __sklib_quad q); int __sklib__rnd__int__int(int min, int max); float __sklib__rnd(); int __sklib__rnd__int(int ubound); +int __sklib__has_gpio(); void __sklib__raspi_cleanup(); int __sklib__raspi_get_mode__pins(int pin); void __sklib__raspi_init(); diff --git a/generated/cpp/raspi_gpio.h b/generated/cpp/raspi_gpio.h index 460743ee..bea531b9 100644 --- a/generated/cpp/raspi_gpio.h +++ b/generated/cpp/raspi_gpio.h @@ -13,6 +13,7 @@ using std::string; using std::vector; +bool has_gpio(); void raspi_cleanup(); pin_modes raspi_get_mode(pins pin); void raspi_init(); diff --git a/generated/cpp/splashkit.cpp b/generated/cpp/splashkit.cpp index fd75b11c..619d2f68 100644 --- a/generated/cpp/splashkit.cpp +++ b/generated/cpp/splashkit.cpp @@ -3854,6 +3854,10 @@ int rnd(int ubound) { int __skreturn = __sklib__rnd__int(__skparam__ubound); return __skadapter__to_int(__skreturn); } +bool has_gpio() { + int __skreturn = __sklib__has_gpio(); + return __skadapter__to_bool(__skreturn); +} void raspi_cleanup() { __sklib__raspi_cleanup(); } diff --git a/generated/cpp/types.h b/generated/cpp/types.h index fd6dce76..a3ad7464 100644 --- a/generated/cpp/types.h +++ b/generated/cpp/types.h @@ -59,11 +59,13 @@ typedef enum { GPIO_ALT2 = 6, GPIO_ALT3 = 7, GPIO_ALT4 = 3, - GPIO_ALT5 = 2 + GPIO_ALT5 = 2, + GPIO_DEFAULT_MODE = 1 } pin_modes; typedef enum { GPIO_LOW = 0, - GPIO_HIGH = 1 + GPIO_HIGH = 1, + GPIO_DEFAULT_VALUE = 1 } pin_values; typedef enum { PIN_1 = 1, diff --git a/generated/csharp/SplashKit.cs b/generated/csharp/SplashKit.cs index 3b5039b0..3edc6ba3 100644 --- a/generated/csharp/SplashKit.cs +++ b/generated/csharp/SplashKit.cs @@ -3121,6 +3121,9 @@ private static void __skadapter__update_from_vector_bool(ref __sklib_vector_bool [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__rnd__int", CharSet=CharSet.Ansi)] private static extern int __sklib__rnd__int(int ubound); + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__has_gpio", CharSet=CharSet.Ansi)] + private static extern int __sklib__has_gpio(); + [DllImport("splashkit.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint="__sklib__raspi_cleanup", CharSet=CharSet.Ansi)] private static extern void __sklib__raspi_cleanup(); @@ -10670,6 +10673,12 @@ public static int Rnd(int ubound) __skreturn = __sklib__rnd__int(__skparam__ubound); return __skadapter__to_int(__skreturn); } + public static bool HasGpio() + { + int __skreturn; + __skreturn = __sklib__has_gpio(); + return __skadapter__to_bool(__skreturn); + } public static void RaspiCleanup() { __sklib__raspi_cleanup(); @@ -15363,12 +15372,14 @@ public enum PinModes GpioAlt2 = 6, GpioAlt3 = 7, GpioAlt4 = 3, - GpioAlt5 = 2 + GpioAlt5 = 2, + GpioDefaultMode = 1 } public enum PinValues { GpioLow = 0, - GpioHigh = 1 + GpioHigh = 1, + GpioDefaultValue = 1 } public enum Pins { diff --git a/generated/docs/api.json b/generated/docs/api.json index d50cdfc6..3810c586 100644 --- a/generated/docs/api.json +++ b/generated/docs/api.json @@ -61436,6 +61436,45 @@ "brief": "Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi.", "description": "", "functions": [ + { + "signature": "bool has_gpio();", + "name": "has_gpio", + "method_name": null, + "unique_global_name": "has_gpio", + "unique_method_name": null, + "suffix_name": null, + "description": "Checks if the system has GPIO capabilities.", + "brief": null, + "return": { + "type": "bool", + "description": "true if the system has GPIO capabilities, false otherwise.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + }, + "signatures": { + "python": [ + "def has_gpio():" + ], + "pascal": [ + "function HasGpio(): Boolean" + ], + "csharp": [ + "public static bool Raspberry.HasGpio();", + "public static bool SplashKit.HasGpio();" + ], + "cpp": [ + "bool has_gpio()" + ] + } + }, { "signature": "void raspi_cleanup();", "name": "raspi_cleanup", @@ -81169,7 +81208,7 @@ } }, { - "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2};", + "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2,GPIO_DEFAULT_MODE = -1,};", "name": "pin_modes", "description": "GPIO Pin Modes:", "brief": null, @@ -81205,6 +81244,10 @@ "GPIO_ALT5": { "description": "Alternate function mode 5.", "number": 2 + }, + "GPIO_DEFAULT_MODE": { + "description": "Default mode.", + "number": 1 } }, "attributes": { @@ -81212,7 +81255,7 @@ } }, { - "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1};", + "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1,GPIO_DEFAULT_VALUE = -1};", "name": "pin_values", "description": "GPIO Pin Values:", "brief": null, @@ -81224,6 +81267,10 @@ "GPIO_HIGH": { "description": "Logic high (1).", "number": 1 + }, + "GPIO_DEFAULT_VALUE": { + "description": "Default value.", + "number": 1 } }, "attributes": { diff --git a/generated/pascal/splashkit.pas b/generated/pascal/splashkit.pas index 6a835f13..4d7210a4 100644 --- a/generated/pascal/splashkit.pas +++ b/generated/pascal/splashkit.pas @@ -253,11 +253,13 @@ type __sklib_window__record_type = record end; GPIO_ALT2 = 6, GPIO_ALT3 = 7, GPIO_ALT4 = 3, - GPIO_ALT5 = 2 + GPIO_ALT5 = 2, + GPIO_DEFAULT_MODE = 1 ); type PinValues = ( GPIO_LOW = 0, - GPIO_HIGH = 1 + GPIO_HIGH = 1, + GPIO_DEFAULT_VALUE = 1 ); type Pins = ( PIN_1 = 1, @@ -1078,6 +1080,7 @@ function TrianglesFrom(const q: Quad): ArrayOfTriangle; function Rnd(min: Integer; max: Integer): Integer; function Rnd(): Single; function Rnd(ubound: Integer): Integer; +function HasGpio(): Boolean; procedure RaspiCleanup(); function RaspiGetMode(pin: Pins): PinModes; procedure RaspiInit(); @@ -3194,6 +3197,7 @@ function __sklib__triangles_from__quad_ref(const q: __sklib_quad): __sklib_vecto function __sklib__rnd__int__int(min: Integer; max: Integer): Integer; cdecl; external; function __sklib__rnd(): Single; cdecl; external; function __sklib__rnd__int(ubound: Integer): Integer; cdecl; external; +function __sklib__has_gpio(): LongInt; cdecl; external; procedure __sklib__raspi_cleanup(); cdecl; external; function __sklib__raspi_get_mode__pins(pin: LongInt): LongInt; cdecl; external; procedure __sklib__raspi_init(); cdecl; external; @@ -10359,6 +10363,13 @@ function Rnd(ubound: Integer): Integer; __skreturn := __sklib__rnd__int(__skparam__ubound); result := __skadapter__to_int(__skreturn); end; +function HasGpio(): Boolean; +var + __skreturn: LongInt; +begin + __skreturn := __sklib__has_gpio(); + result := __skadapter__to_bool(__skreturn); +end; procedure RaspiCleanup(); begin __sklib__raspi_cleanup(); diff --git a/generated/python/splashkit.py b/generated/python/splashkit.py index 6feb1776..fa52c48e 100644 --- a/generated/python/splashkit.py +++ b/generated/python/splashkit.py @@ -234,9 +234,11 @@ class PinModes(Enum): gpio_alt3 = 7 gpio_alt4 = 3 gpio_alt5 = 2 + gpio_default_mode = 1 class PinValues(Enum): gpio_low = 0 gpio_high = 1 + gpio_default_value = 1 class Pins(Enum): pin_1 = 1 pin_2 = 2 @@ -2763,6 +2765,8 @@ def __skadapter__to_sklib_window(v): sklib.__sklib__rnd.restype = c_float sklib.__sklib__rnd__int.argtypes = [ c_int ] sklib.__sklib__rnd__int.restype = c_int +sklib.__sklib__has_gpio.argtypes = [ ] +sklib.__sklib__has_gpio.restype = c_bool sklib.__sklib__raspi_cleanup.argtypes = [ ] sklib.__sklib__raspi_cleanup.restype = None sklib.__sklib__raspi_get_mode__pins.argtypes = [ c_int ] @@ -6713,6 +6717,9 @@ def rnd_int ( ubound ): __skparam__ubound = __skadapter__to_sklib_int(ubound) __skreturn = sklib.__sklib__rnd__int(__skparam__ubound) return __skadapter__to_int(__skreturn) +def has_gpio ( ): + __skreturn = sklib.__sklib__has_gpio() + return __skadapter__to_bool(__skreturn) def raspi_cleanup ( ): sklib.__sklib__raspi_cleanup() def raspi_get_mode ( pin ): diff --git a/generated/translator_cache.json b/generated/translator_cache.json index b96f6138..afde75f5 100644 --- a/generated/translator_cache.json +++ b/generated/translator_cache.json @@ -3,7 +3,7 @@ "group": "animations", "brief": "Animations in SplashKit can be used to move between cells in\nbitmaps and sprites. Each animation generates a number sequence\nthat can then be used when drawing bitmaps.", "description": null, - "parsed_at": 1706062545, + "parsed_at": 1706101739, "path": "coresdk/src/coresdk/animations.h", "functions": [ { @@ -1951,7 +1951,7 @@ "group": "audio", "brief": "SplashKit Audio allows you to load and play music and sound effects.", "description": "SplashKit's audio library allows you to easily load and play music and\nsound effects within your programs. To get started with audio the first\nthing you need to do is load a sound effect or music file. You can do this\nby calling the `load_sound_effect(string name)` function to the\n`load_music(string name)` function.", - "parsed_at": 1706062546, + "parsed_at": 1706101739, "path": "coresdk/src/coresdk/audio.h", "functions": [ { @@ -2045,7 +2045,7 @@ "group": "utilities", "brief": "SplashKit provides some basic data manipulation functions to\nhelp make it easy to get some basic tasks performed.", "description": null, - "parsed_at": 1706062546, + "parsed_at": 1706101739, "path": "coresdk/src/coresdk/basics.h", "functions": [ { @@ -2362,7 +2362,7 @@ "group": "resource_bundles", "brief": "SplashKit resource bundles allow you to quickly and easily load a\nnumber of resources in the `Resources` folder.", "description": "Supports the loading and freeing of game resource bundles. Resource types\ninclude images, sounds, music and animation files to name a few. Resource\nfiles must be saved in specific locations of a `Resources` folder for\nyour game.", - "parsed_at": 1706062546, + "parsed_at": 1706101740, "path": "coresdk/src/coresdk/bundles.h", "functions": [ { @@ -2507,7 +2507,7 @@ "group": "camera", "brief": "SplashKit camera functionality allows you to move a virtual camera\naround in your world.", "description": "Splashkit camera functionality allows you to move a virtual camera around in\nyour world. This camera projects to the users window, allowing you to\ndraw things to the screen in your world coordinates.", - "parsed_at": 1706062547, + "parsed_at": 1706101741, "path": "coresdk/src/coresdk/camera.h", "functions": [ { @@ -3574,7 +3574,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062548, + "parsed_at": 1706101742, "path": "coresdk/src/coresdk/circle_drawing.h", "functions": [ { @@ -4945,7 +4945,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062549, + "parsed_at": 1706101742, "path": "coresdk/src/coresdk/circle_geometry.h", "functions": [ { @@ -5872,7 +5872,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062549, + "parsed_at": 1706101743, "path": "coresdk/src/coresdk/clipping.h", "functions": [ { @@ -6456,7 +6456,7 @@ "group": "physics", "brief": "SplashKit Collisions library allow you to perform tests between\nbitmaps, sprites and shapes to determin if a collision has occured.", "description": null, - "parsed_at": 1706062551, + "parsed_at": 1706101744, "path": "coresdk/src/coresdk/collisions.h", "functions": [ { @@ -8707,7 +8707,7 @@ "group": "color", "brief": "SplashKit simplifies color manipulation in graphical applications for developers, ensuring ease of use and efficiency.", "description": null, - "parsed_at": 1706062556, + "parsed_at": 1706101749, "path": "coresdk/src/coresdk/color.h", "functions": [ { @@ -13907,7 +13907,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062557, + "parsed_at": 1706101750, "path": "coresdk/src/coresdk/drawing_options.h", "functions": [ { @@ -15271,7 +15271,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062558, + "parsed_at": 1706101752, "path": "coresdk/src/coresdk/ellipse_drawing.h", "functions": [ { @@ -17366,7 +17366,7 @@ "group": "geometry", "brief": "SplashKit's geometry functions assist with geometry-related computations.", "description": null, - "parsed_at": 1706062558, + "parsed_at": 1706101752, "path": "coresdk/src/coresdk/geometry.h", "functions": [ { @@ -17498,7 +17498,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062559, + "parsed_at": 1706101752, "path": "coresdk/src/coresdk/graphics.h", "functions": [ { @@ -18074,7 +18074,7 @@ "group": "graphics", "brief": "SplashKit Images allow drawing of bitmaps and sprites to graphic windows.", "description": null, - "parsed_at": 1706062560, + "parsed_at": 1706101754, "path": "coresdk/src/coresdk/images.h", "functions": [ { @@ -20562,7 +20562,7 @@ "group": "input", "brief": "Input handles user interaction and events such as keypresses.", "description": null, - "parsed_at": 1706062561, + "parsed_at": 1706101754, "path": "coresdk/src/coresdk/input.h", "functions": [ { @@ -20655,7 +20655,7 @@ "group": "json", "brief": "SplashKit Json allows you to create and read JSON objects.", "description": "Splashkit's JSON library allows you to easily create or read JSON objects and\nmanipulate them to/from a JSON string or from a file containing a JSON\nstring. Create a new JSON object with a call to `create_json()` and\nread or write data to it by calling methods like\n`json_add_string(json j, string key, string value)` and\n`json_read_string(json j, string key)`.", - "parsed_at": 1706062562, + "parsed_at": 1706101755, "path": "coresdk/src/coresdk/json.h", "functions": [ { @@ -22407,7 +22407,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1706062564, + "parsed_at": 1706101757, "path": "coresdk/src/coresdk/keyboard_input.h", "functions": [ { @@ -23405,7 +23405,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062565, + "parsed_at": 1706101758, "path": "coresdk/src/coresdk/line_drawing.h", "functions": [ { @@ -24944,7 +24944,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062565, + "parsed_at": 1706101759, "path": "coresdk/src/coresdk/line_geometry.h", "functions": [ { @@ -25818,7 +25818,7 @@ "group": "logging", "brief": "SplashKit Logging facilitates streamlined logging with customizable severity levels and modes.", "description": "SplashKit Logging module, allows users to initialize a custom logger with specified log levels and modes (console, file, or both). \nThe module provides functions to log messages at different severity levels (INFO, DEBUG, WARNING, ERROR, FATAL) with timestamped entries. \nUsers can close the logging process as needed, and the module handles customization for console and file output.", - "parsed_at": 1706062566, + "parsed_at": 1706101759, "path": "coresdk/src/coresdk/logging.h", "functions": [ { @@ -26067,7 +26067,7 @@ "group": "physics", "brief": "Provides matrix functions to work on 2d coordinates.", "description": null, - "parsed_at": 1706062566, + "parsed_at": 1706101760, "path": "coresdk/src/coresdk/matrix_2d.h", "functions": [ { @@ -26805,7 +26805,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1706062567, + "parsed_at": 1706101761, "path": "coresdk/src/coresdk/mouse_input.h", "functions": [ { @@ -27292,7 +27292,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1706062568, + "parsed_at": 1706101762, "path": "coresdk/src/coresdk/music.h", "functions": [ { @@ -28285,7 +28285,7 @@ "group": "networking", "brief": "SplashKit's network-related functions allow you to communicate data\nacross networks.", "description": null, - "parsed_at": 1706062570, + "parsed_at": 1706101764, "path": "coresdk/src/coresdk/networking.h", "functions": [ { @@ -31429,7 +31429,7 @@ "group": "physics", "brief": null, "description": null, - "parsed_at": 1706062570, + "parsed_at": 1706101764, "path": "coresdk/src/coresdk/physics.h", "functions": [ @@ -31451,7 +31451,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062571, + "parsed_at": 1706101765, "path": "coresdk/src/coresdk/point_drawing.h", "functions": [ { @@ -32771,7 +32771,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062572, + "parsed_at": 1706101766, "path": "coresdk/src/coresdk/point_geometry.h", "functions": [ { @@ -33795,7 +33795,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062572, + "parsed_at": 1706101766, "path": "coresdk/src/coresdk/quad_geometry.h", "functions": [ { @@ -34260,7 +34260,7 @@ "group": "utilities", "brief": "SplashKit random provides a simple implementation of random.", "description": "The SplashKit`s random library provides two rnd methods, a `rnd()` which generates\na random number between 0 and 1, and `rnd(int ubound)` which\ngenerates a random number between 0 and the value scpeficied in `ubound`.", - "parsed_at": 1706062572, + "parsed_at": 1706101766, "path": "coresdk/src/coresdk/random.h", "functions": [ { @@ -34394,9 +34394,33 @@ "group": "raspberry", "brief": "Splashkit allows you to read and write to the GPIO pins on the Raspberry Pi.", "description": null, - "parsed_at": 1706062573, + "parsed_at": 1706101767, "path": "coresdk/src/coresdk/raspi_gpio.h", "functions": [ + { + "signature": "bool has_gpio();", + "name": "has_gpio", + "method_name": null, + "unique_global_name": "has_gpio", + "unique_method_name": null, + "suffix_name": null, + "description": "Checks if the system has GPIO capabilities.", + "brief": null, + "return": { + "type": "bool", + "description": "true if the system has GPIO capabilities, false otherwise.", + "is_pointer": false, + "is_reference": false, + "is_vector": false, + "type_parameter": null + }, + "parameters": { + }, + "attributes": { + "group": "raspberry", + "static": "raspberry" + } + }, { "signature": "void raspi_cleanup();", "name": "raspi_cleanup", @@ -34837,7 +34861,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062575, + "parsed_at": 1706101769, "path": "coresdk/src/coresdk/rectangle_drawing.h", "functions": [ { @@ -37730,7 +37754,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062576, + "parsed_at": 1706101769, "path": "coresdk/src/coresdk/rectangle_geometry.h", "functions": [ { @@ -38516,7 +38540,7 @@ "group": "resources", "brief": "SplashKit resource functions allow you to locate resources in a\nproject's `Resources` folder.", "description": null, - "parsed_at": 1706062576, + "parsed_at": 1706101770, "path": "coresdk/src/coresdk/resources.h", "functions": [ { @@ -38834,7 +38858,7 @@ "group": "audio", "brief": null, "description": null, - "parsed_at": 1706062577, + "parsed_at": 1706101771, "path": "coresdk/src/coresdk/sound.h", "functions": [ { @@ -39806,7 +39830,7 @@ "group": "sprites", "brief": "SplashKit Sprites allows you to create images you can easily\nmove and animate.", "description": "SplashKit sprites are game elements that can be moved, and animated. Sprites\nare located at a position in the game, have a velocity, and an animation.\nThe sprite can also have arbitary data associated with it for game specific\npurposes.", - "parsed_at": 1706062581, + "parsed_at": 1706101775, "path": "coresdk/src/coresdk/sprites.h", "functions": [ { @@ -46682,7 +46706,7 @@ "group": "terminal", "brief": "SplashKit Terminal allows you to read and write values to the\nterminal in a consistent manner.", "description": null, - "parsed_at": 1706062581, + "parsed_at": 1706101776, "path": "coresdk/src/coresdk/terminal.h", "functions": [ { @@ -47078,7 +47102,7 @@ "group": "graphics", "brief": "SplashKit Text allows for drawing text in a variety of ways to\ngraphic windows.", "description": null, - "parsed_at": 1706062583, + "parsed_at": 1706101778, "path": "coresdk/src/coresdk/text.h", "functions": [ { @@ -49981,7 +50005,7 @@ "group": "input", "brief": null, "description": null, - "parsed_at": 1706062584, + "parsed_at": 1706101778, "path": "coresdk/src/coresdk/text_input.h", "functions": [ { @@ -50516,7 +50540,7 @@ "group": "timers", "brief": "Timers in SplashKit can be used to track the passing of time.", "description": null, - "parsed_at": 1706062584, + "parsed_at": 1706101779, "path": "coresdk/src/coresdk/timers.h", "functions": [ { @@ -51354,7 +51378,7 @@ "group": "graphics", "brief": null, "description": null, - "parsed_at": 1706062586, + "parsed_at": 1706101781, "path": "coresdk/src/coresdk/triangle_drawing.h", "functions": [ { @@ -53761,7 +53785,7 @@ "group": "geometry", "brief": null, "description": null, - "parsed_at": 1706062586, + "parsed_at": 1706101781, "path": "coresdk/src/coresdk/triangle_geometry.h", "functions": [ { @@ -54122,7 +54146,7 @@ "group": "types", "brief": "SplashKit Types simplifies data type creation and management for streamlined programming.", "description": null, - "parsed_at": 1706062588, + "parsed_at": 1706101783, "path": "coresdk/src/coresdk/types.h", "functions": [ @@ -54846,7 +54870,7 @@ } }, { - "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2};", + "signature": "enum pin_modes {GPIO_INPUT = 0,GPIO_OUTPUT = 1,GPIO_ALT0 = 4,GPIO_ALT1 = 5,GPIO_ALT2 = 6,GPIO_ALT3 = 7,GPIO_ALT4 = 3,GPIO_ALT5 = 2,GPIO_DEFAULT_MODE = -1,};", "name": "pin_modes", "description": "GPIO Pin Modes:", "brief": null, @@ -54882,6 +54906,10 @@ "GPIO_ALT5": { "description": "Alternate function mode 5.", "number": 2 + }, + "GPIO_DEFAULT_MODE": { + "description": "Default mode.", + "number": 1 } }, "attributes": { @@ -54889,7 +54917,7 @@ } }, { - "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1};", + "signature": "enum pin_values {GPIO_LOW = 0,GPIO_HIGH = 1,GPIO_DEFAULT_VALUE = -1};", "name": "pin_values", "description": "GPIO Pin Values:", "brief": null, @@ -54901,6 +54929,10 @@ "GPIO_HIGH": { "description": "Logic high (1).", "number": 1 + }, + "GPIO_DEFAULT_VALUE": { + "description": "Default value.", + "number": 1 } }, "attributes": { @@ -55110,7 +55142,7 @@ "group": "utilities", "brief": "SplashKit provides miscellaneous utilities for unclassified functionality.", "description": null, - "parsed_at": 1706062588, + "parsed_at": 1706101783, "path": "coresdk/src/coresdk/utils.h", "functions": [ { @@ -55318,7 +55350,7 @@ "group": "physics", "brief": "Provides vector functions to work on vectors.", "description": null, - "parsed_at": 1706062589, + "parsed_at": 1706101784, "path": "coresdk/src/coresdk/vector_2d.h", "functions": [ { @@ -56751,7 +56783,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1706062590, + "parsed_at": 1706101785, "path": "coresdk/src/coresdk/web_client.h", "functions": [ { @@ -57346,7 +57378,7 @@ "group": "networking", "brief": null, "description": null, - "parsed_at": 1706062591, + "parsed_at": 1706101786, "path": "coresdk/src/coresdk/web_server.h", "functions": [ { @@ -59065,7 +59097,7 @@ "group": "windows", "brief": "Window Manager in SplashKit can be used create, and manipulate\ngraphics windows", "description": null, - "parsed_at": 1706062593, + "parsed_at": 1706101788, "path": "coresdk/src/coresdk/window_manager.h", "functions": [ { From ab17bc8cfaf0711243bc77bf78c159aa3b2cab84 Mon Sep 17 00:00:00 2001 From: Aditya Parmar <9934145215aditya@gmail.com> Date: Thu, 25 Jan 2024 12:00:42 +1100 Subject: [PATCH 6/6] Update pin descriptions and modes --- coresdk/src/coresdk/types.h | 279 ++++++++++++++++++------------------ 1 file changed, 140 insertions(+), 139 deletions(-) diff --git a/coresdk/src/coresdk/types.h b/coresdk/src/coresdk/types.h index 911a2a73..2ea0c3ef 100644 --- a/coresdk/src/coresdk/types.h +++ b/coresdk/src/coresdk/types.h @@ -315,147 +315,148 @@ namespace splashkit_lib HTTP_STATUS_NOT_IMPLEMENTED = 501, HTTP_STATUS_SERVICE_UNAVAILABLE = 503 }; -} -/** - * Raspberry Pi GPIO Board Pin Descriptions: - * - * @constant PIN_1 3.3V Power Supply - * @constant PIN_2 5V Power Supply - * @constant PIN_3 GPIO2 / SDA (I2C) - * @constant PIN_4 5V Power Supply - * @constant PIN_5 GPIO3 / SCL (I2C) - * @constant PIN_6 Ground - * @constant PIN_7 GPIO4 - * @constant PIN_8 GPIO14 / TXD (UART) - * @constant PIN_9 Ground - * @constant PIN_10 GPIO15 / RXD (UART) - * @constant PIN_11 GPIO17 - * @constant PIN_12 GPIO18 / PCM_CLK - * @constant PIN_13 GPIO27 - * @constant PIN_14 Ground - * @constant PIN_15 GPIO22 - * @constant PIN_16 GPIO23 - * @constant PIN_17 3.3V Power Supply - * @constant PIN_18 GPIO24 - * @constant PIN_19 GPIO10 / MOSI (SPI) - * @constant PIN_20 Ground - * @constant PIN_21 GPIO9 / MISO (SPI) - * @constant PIN_22 GPIO25 - * @constant PIN_23 GPIO11 / SCLK (SPI) - * @constant PIN_24 GPIO8 / CE0 (SPI) - * @constant PIN_25 Ground - * @constant PIN_26 GPIO7 / CE1 (SPI) - * @constant PIN_27 ID_SD (I2C ID EEPROM) - * @constant PIN_28 ID_SC (I2C ID EEPROM) - * @constant PIN_29 GPIO5 - * @constant PIN_30 Ground - * @constant PIN_31 GPIO6 - * @constant PIN_32 GPIO12 - * @constant PIN_33 GPIO13 - * @constant PIN_34 Ground - * @constant PIN_35 GPIO19 / MISO (PCM) - * @constant PIN_36 GPIO16 / CE0 (PCM) - * @constant PIN_37 GPIO26 - * @constant PIN_38 GPIO20 / MOSI (PCM) - * @constant PIN_39 Ground - * @constant PIN_40 GPIO21 / SCLK (PCM) - */ -enum pins -{ - PIN_1 = 1, - PIN_2 = 2, - PIN_3 = 3, - PIN_4 = 4, - PIN_5 = 5, - PIN_6 = 6, - PIN_7 = 7, - PIN_8 = 8, - PIN_9 = 9, - PIN_10 = 10, - PIN_11 = 11, - PIN_12 = 12, - PIN_13 = 13, - PIN_14 = 14, - PIN_15 = 15, - PIN_16 = 16, - PIN_17 = 17, - PIN_18 = 18, - PIN_19 = 19, - PIN_20 = 20, - PIN_21 = 21, - PIN_22 = 22, - PIN_23 = 23, - PIN_24 = 24, - PIN_25 = 25, - PIN_26 = 26, - PIN_27 = 27, - PIN_28 = 28, - PIN_29 = 29, - PIN_30 = 30, - PIN_31 = 31, - PIN_32 = 32, - PIN_33 = 33, - PIN_34 = 34, - PIN_35 = 35, - PIN_36 = 36, - PIN_37 = 37, - PIN_38 = 38, - PIN_39 = 39, - PIN_40 = 40, -}; + + /** + * Raspberry Pi GPIO Board Pin Descriptions: + * + * @constant PIN_1 3.3V Power Supply + * @constant PIN_2 5V Power Supply + * @constant PIN_3 GPIO2 / SDA (I2C) + * @constant PIN_4 5V Power Supply + * @constant PIN_5 GPIO3 / SCL (I2C) + * @constant PIN_6 Ground + * @constant PIN_7 GPIO4 + * @constant PIN_8 GPIO14 / TXD (UART) + * @constant PIN_9 Ground + * @constant PIN_10 GPIO15 / RXD (UART) + * @constant PIN_11 GPIO17 + * @constant PIN_12 GPIO18 / PCM_CLK + * @constant PIN_13 GPIO27 + * @constant PIN_14 Ground + * @constant PIN_15 GPIO22 + * @constant PIN_16 GPIO23 + * @constant PIN_17 3.3V Power Supply + * @constant PIN_18 GPIO24 + * @constant PIN_19 GPIO10 / MOSI (SPI) + * @constant PIN_20 Ground + * @constant PIN_21 GPIO9 / MISO (SPI) + * @constant PIN_22 GPIO25 + * @constant PIN_23 GPIO11 / SCLK (SPI) + * @constant PIN_24 GPIO8 / CE0 (SPI) + * @constant PIN_25 Ground + * @constant PIN_26 GPIO7 / CE1 (SPI) + * @constant PIN_27 ID_SD (I2C ID EEPROM) + * @constant PIN_28 ID_SC (I2C ID EEPROM) + * @constant PIN_29 GPIO5 + * @constant PIN_30 Ground + * @constant PIN_31 GPIO6 + * @constant PIN_32 GPIO12 + * @constant PIN_33 GPIO13 + * @constant PIN_34 Ground + * @constant PIN_35 GPIO19 / MISO (PCM) + * @constant PIN_36 GPIO16 / CE0 (PCM) + * @constant PIN_37 GPIO26 + * @constant PIN_38 GPIO20 / MOSI (PCM) + * @constant PIN_39 Ground + * @constant PIN_40 GPIO21 / SCLK (PCM) + */ + enum pins + { + PIN_1 = 1, + PIN_2 = 2, + PIN_3 = 3, + PIN_4 = 4, + PIN_5 = 5, + PIN_6 = 6, + PIN_7 = 7, + PIN_8 = 8, + PIN_9 = 9, + PIN_10 = 10, + PIN_11 = 11, + PIN_12 = 12, + PIN_13 = 13, + PIN_14 = 14, + PIN_15 = 15, + PIN_16 = 16, + PIN_17 = 17, + PIN_18 = 18, + PIN_19 = 19, + PIN_20 = 20, + PIN_21 = 21, + PIN_22 = 22, + PIN_23 = 23, + PIN_24 = 24, + PIN_25 = 25, + PIN_26 = 26, + PIN_27 = 27, + PIN_28 = 28, + PIN_29 = 29, + PIN_30 = 30, + PIN_31 = 31, + PIN_32 = 32, + PIN_33 = 33, + PIN_34 = 34, + PIN_35 = 35, + PIN_36 = 36, + PIN_37 = 37, + PIN_38 = 38, + PIN_39 = 39, + PIN_40 = 40, + }; #include -/** - * GPIO Pin Modes: - * - * @constant GPIO_INPUT Input mode. - * @constant GPIO_OUTPUT Output mode. - * @constant GPIO_ALT0 Alternate function mode 0. - * @constant GPIO_ALT1 Alternate function mode 1. - * @constant GPIO_ALT2 Alternate function mode 2. - * @constant GPIO_ALT3 Alternate function mode 3. - * @constant GPIO_ALT4 Alternate function mode 4. - * @constant GPIO_ALT5 Alternate function mode 5. - * @constant GPIO_DEFAULT_MODE Default mode. - */ -enum pin_modes -{ - GPIO_INPUT = 0, - GPIO_OUTPUT = 1, - GPIO_ALT0 = 4, - GPIO_ALT1 = 5, - GPIO_ALT2 = 6, - GPIO_ALT3 = 7, - GPIO_ALT4 = 3, - GPIO_ALT5 = 2, - GPIO_DEFAULT_MODE = -1, -}; + /** + * GPIO Pin Modes: + * + * @constant GPIO_INPUT Input mode. + * @constant GPIO_OUTPUT Output mode. + * @constant GPIO_ALT0 Alternate function mode 0. + * @constant GPIO_ALT1 Alternate function mode 1. + * @constant GPIO_ALT2 Alternate function mode 2. + * @constant GPIO_ALT3 Alternate function mode 3. + * @constant GPIO_ALT4 Alternate function mode 4. + * @constant GPIO_ALT5 Alternate function mode 5. + * @constant GPIO_DEFAULT_MODE Default mode. + */ + enum pin_modes + { + GPIO_INPUT = 0, + GPIO_OUTPUT = 1, + GPIO_ALT0 = 4, + GPIO_ALT1 = 5, + GPIO_ALT2 = 6, + GPIO_ALT3 = 7, + GPIO_ALT4 = 3, + GPIO_ALT5 = 2, + GPIO_DEFAULT_MODE = -1, + }; -/** - * GPIO Pin Values: - * - * @constant GPIO_LOW Logic low (0). - * @constant GPIO_HIGH Logic high (1). - * @constant GPIO_DEFAULT_VALUE Default value. - */ -enum pin_values -{ - GPIO_LOW = 0, - GPIO_HIGH = 1, - GPIO_DEFAULT_VALUE = -1 -}; -/** - * GPIO Pull-up/Pull-down Configurations: - * - * @constant PUD_OFF No pull-up or pull-down resistor. - * @constant PUD_DOWN Enable pull-down resistor. - * @constant PUD_UP Enable pull-up resistor. - */ -enum pull_up_down -{ - PUD_OFF = 0, - PUD_DOWN = 1, - PUD_UP = 2 -}; + /** + * GPIO Pin Values: + * + * @constant GPIO_LOW Logic low (0). + * @constant GPIO_HIGH Logic high (1). + * @constant GPIO_DEFAULT_VALUE Default value. + */ + enum pin_values + { + GPIO_LOW = 0, + GPIO_HIGH = 1, + GPIO_DEFAULT_VALUE = -1 + }; + /** + * GPIO Pull-up/Pull-down Configurations: + * + * @constant PUD_OFF No pull-up or pull-down resistor. + * @constant PUD_DOWN Enable pull-down resistor. + * @constant PUD_UP Enable pull-up resistor. + */ + enum pull_up_down + { + PUD_OFF = 0, + PUD_DOWN = 1, + PUD_UP = 2 + }; +} #endif /* types_hpp */