Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/StuckAtPrototype/Racer
/ functions
Functions
91 in github.com/StuckAtPrototype/Racer
⨍
Functions
91
◇
Types & classes
11
↓ 8 callers
Function
led_set_flash_mode
* @brief Set LED flash mode * * This function sets the LED flash pattern mode. * * @param mode LED flash mode (LED_CONST, LED_FLASH_ALL, etc.)
firmware/main/led.c:277
↓ 8 callers
Function
set_motor_speed
* @brief Set motor speed and direction * * This function sets the speed and direction of a motor using PWM control. * It handles speed mapping fro
firmware/main/motor.c:58
↓ 6 callers
Function
float_to_hex
(f)
scripts/trainer.py:103
↓ 5 callers
Function
led_set_indicator_color
* @brief Set indicator LED color * * This function sets the color of the indicator LED (LED 4) in a thread-safe manner. * * @param color Color v
firmware/main/led.c:226
↓ 4 callers
Function
configure_motor_pwm
* @brief Configure PWM channel for motor control * * This function configures a LEDC (LED Controller) channel for PWM-based motor control. * Each
firmware/main/motor.c:30
↓ 4 callers
Method
forward
(self, X)
scripts/trainer.py:31
↓ 4 callers
Function
send_command
(client, speedA, speedB, directionA, directionB, duration)
scripts/controller.py:11
↓ 3 callers
Function
advertise
* @brief Start BLE advertising * * This function configures and starts BLE advertising for the Racer3 device. * It sets up advertisement fields in
firmware/main/gap.c:29
↓ 3 callers
Function
gatt_svr_chr_write
* @brief Write data from BLE message buffer to destination buffer * * This helper function extracts data from a BLE message buffer and writes it *
firmware/main/gatt_svr.c:172
↓ 3 callers
Function
rbg_read
* @brief Read RGB color data from TCS3400 sensor and store in ring buffer * * This function reads normalized RGB color values from the TCS3400 colo
firmware/main/main.c:304
↓ 2 callers
Function
classify_color_rgb
* @brief Classify RGB color values into predefined color categories * * This function analyzes normalized RGB values and classifies them into one o
firmware/main/color_predictor.c:133
↓ 2 callers
Function
led_set_flash_period
* @brief Set LED flash period * * This function sets the flash period for LED patterns. * * @param period Flash period in FreeRTOS ticks */
firmware/main/led.c:290
↓ 2 callers
Function
led_set_headlight_color
* @brief Set headlight LED color * * This function sets the color of the headlight LEDs (front LEDs) in a thread-safe manner. * * @param color C
firmware/main/led.c:260
↓ 2 callers
Function
normalize_data
(data)
scripts/trainer.py:92
↓ 2 callers
Function
relu
* @brief ReLU activation function * * Rectified Linear Unit activation function: returns the input if positive, 0 otherwise. * * @param x Input
firmware/main/neural_net_predictor.c:33
↓ 2 callers
Method
relu
(self, x)
scripts/trainer.py:21
↓ 2 callers
Method
relu_derivative
(self, x)
scripts/trainer.py:24
↓ 2 callers
Function
ring_buffer_is_empty
* @brief Check if the ring buffer is empty * * @param rb Pointer to the ring buffer structure * @return true if buffer is empty, false otherwise
firmware/main/ring_buffer_rgb.c:53
↓ 2 callers
Function
ws2812_write_leds
* @brief Write LED data to WS2812 strip * * This function takes a structure containing LED color data and transmits it * to the WS2812 LED strip u
firmware/main/ws2812_control.c:115
↓ 1 callers
Function
TCS3400_init
* @brief Initialize the TCS3400 color sensor * * This function initializes the TCS3400 color sensor by: * 1. Setting up I2C communication * 2. Po
firmware/main/tcs3400.c:69
↓ 1 callers
Function
TCS3400_read_color
* @brief Read color data from TCS3400 sensor * * This function reads raw color data from the TCS3400 sensor and returns * normalized RGB values wi
firmware/main/tcs3400.c:117
↓ 1 callers
Function
advance_pointer
* @brief Advance the head pointer of the ring buffer * * This internal function advances the head pointer and manages the full state. * When the b
firmware/main/ring_buffer_rgb.c:39
↓ 1 callers
Method
backward
(self, X, y, output, learning_rate)
scripts/trainer.py:37
↓ 1 callers
Function
battery_init
* @brief Initialize the battery monitoring system * * This function initializes the ADC for battery voltage measurement, * configures the ADC chan
firmware/main/battery.c:39
↓ 1 callers
Function
battery_read_voltage
* @brief Read battery voltage * * This function reads the raw ADC value from the battery voltage measurement. * Currently returns raw ADC counts r
firmware/main/battery.c:81
↓ 1 callers
Function
command_set_game_status
* @brief Set game status based on detected color * * This function processes color detection results and sets the appropriate game state. * Differ
firmware/main/controller.c:44
↓ 1 callers
Function
configure_gpio_interrupt
* @brief Configure GPIO interrupt for color sensor trigger * * This function sets up the GPIO interrupt system for triggering color sensor * readi
firmware/main/gpio_interrupt.c:70
↓ 1 callers
Function
controller_init
* @brief Initialize the motor controller system * * This function initializes all components of the motor controller system including: * - Command
firmware/main/controller.c:281
↓ 1 callers
Function
forward
* @brief Forward pass through the neural network * * Performs a forward pass through the multi-layer neural network, computing * the output probab
firmware/main/neural_net_predictor.c:79
↓ 1 callers
Function
gatt_svr_init
* @brief Initialize the GATT server * * This function initializes the GATT server with all defined services and characteristics. * It sets up the
firmware/main/gatt_svr.c:407
↓ 1 callers
Function
get_ble_address
()
scripts/controller.py:45
↓ 1 callers
Function
get_color_from_hue
* @brief Get RGB color from hue value * * This function converts a 16-bit hue value to a 24-bit RGB color value * in GRB format suitable for WS281
firmware/main/led_color_lib.c:54
↓ 1 callers
Function
get_color_name
* @brief Get human-readable color name from color class * * This function returns a string representation of the color class for * debugging and l
firmware/main/color_predictor.c:112
↓ 1 callers
Function
gpio_interrupt_get_evt_queue
* @brief Get the GPIO event queue handle * * This function returns the handle to the GPIO event queue, allowing other * tasks to receive GPIO inte
firmware/main/gpio_interrupt.c:34
↓ 1 callers
Function
handle_key_press
(client)
scripts/controller.py:61
↓ 1 callers
Function
hue_to_rgb
* @brief Convert hue to RGB values * * This helper function converts a hue value (0.0 to 1.0) to RGB values using * the HSL color space model. It
firmware/main/led_color_lib.c:32
↓ 1 callers
Function
i2c_master_init
* @brief Initialize I2C master for TCS3400 communication * * This function configures and installs the I2C master driver for communication * with
firmware/main/tcs3400.c:29
↓ 1 callers
Function
i2c_master_init
* @brief Initialize I2C master for OPT4060 communication * * This function configures and installs the I2C master driver for communication * with
firmware/main/opt4060.c:31
↓ 1 callers
Function
led_init
* @brief Initialize the LED control system * * This function initializes the WS2812 LED driver, creates the LED mutex * for thread-safe operations
firmware/main/led.c:200
↓ 1 callers
Function
load_config
()
scripts/controller.py:35
↓ 1 callers
Function
main
()
scripts/controller.py:79
↓ 1 callers
Function
one_hot_encode
(labels)
scripts/trainer.py:95
↓ 1 callers
Function
parse_input
(file_path)
scripts/trainer.py:80
↓ 1 callers
Function
ring_buffer_get_avg
* @brief Calculate and retrieve average RGB values from the ring buffer * * This function calculates the average of all RGB values currently stored
firmware/main/ring_buffer_rgb.c:112
↓ 1 callers
Function
ring_buffer_init
* @brief Initialize a ring buffer structure * * This function initializes a ring buffer by setting the head and tail pointers * to 0 and marking t
firmware/main/ring_buffer_rgb.c:24
↓ 1 callers
Function
ring_buffer_put
* @brief Add RGB color data to the ring buffer * * This function stores RGB color values at the current head position * and advances the head poin
firmware/main/ring_buffer_rgb.c:68
↓ 1 callers
Function
save_config
(config)
scripts/controller.py:41
↓ 1 callers
Function
select_device
()
scripts/controller.py:15
↓ 1 callers
Function
set_motor_command
* @brief Set motor command with game state modifications * * This function processes motor commands and applies game state modifications. * It als
firmware/main/controller.c:173
↓ 1 callers
Function
softmax
* @brief Softmax activation function * * Applies the softmax function to convert raw outputs into probability distributions. * This ensures all ou
firmware/main/neural_net_predictor.c:46
↓ 1 callers
Method
softmax
(self, x)
scripts/trainer.py:27
↓ 1 callers
Method
train
(self, X, y, X_val, y_val, epochs, learning_rate, batch_size=32, patience=50)
scripts/trainer.py:53
↓ 1 callers
Function
update_ota_control
* @brief Update OTA control state and send notifications * * This function processes OTA control commands and sends appropriate * acknowledgements
firmware/main/gatt_svr.c:198
↓ 1 callers
Function
ws2812_control_init
* @brief Initialize WS2812 LED control system * * This function initializes the RMT (Remote Control) peripheral for controlling * WS2812 LED strip
firmware/main/ws2812_control.c:69
Method
__init__
(self, input_size, hidden_size1, hidden_size2, output_size)
scripts/trainer.py:8
Function
app_main
* @brief Main application entry point * * Initializes all subsystems including: * - LEDC timer for motor PWM control * - LED control system * -
firmware/main/main.c:147
Function
battery_deinit
* @brief Deinitialize the battery monitoring system * * This function cleans up ADC resources and calibration handles. */
firmware/main/battery.c:102
Function
command_game_timer_callback
* @brief Callback function for game state timer expiration * * This function is called when the game state timer expires, indicating * that the cu
firmware/main/controller.c:152
Function
command_timer_callback
* @brief Callback function for motor command timer expiration * * This function is called when the motor command timer expires, indicating * that
firmware/main/controller.c:123
Function
controller_task
* @brief Controller task for processing motor commands * * This task waits for notifications from the motor command system and processes * motor c
firmware/main/controller.c:237
Function
gap_event_handler
* @brief GAP event handler for BLE connection events * * This function handles various BLE GAP events including connection establishment, * discon
firmware/main/gap.c:105
Function
gatt_svr_chr_access_device_info
* @brief Handle access to device information characteristics * * This function handles read requests for device information characteristics * incl
firmware/main/gatt_svr.c:133
Function
gatt_svr_chr_color_data_cb
* @brief Handle color data characteristic access (LED control commands) * * This function processes LED color commands received via BLE. * The dat
firmware/main/gatt_svr.c:364
Function
gatt_svr_chr_ota_control_cb
* @brief Handle OTA control characteristic access * * This function handles read and write operations on the OTA control characteristic. * It mana
firmware/main/gatt_svr.c:268
Function
gatt_svr_chr_ota_data_cb
* @brief Handle OTA data characteristic access (motor control commands) * * This function processes motor control commands received via BLE. * The
firmware/main/gatt_svr.c:313
Function
get_color_between_blue_red
* @brief Get color interpolated between blue and red * * This function creates a color that interpolates between blue and red based on * the input
firmware/main/led_color_lib.c:112
Function
get_next_color_full_spectrum
* @brief Get next color in full spectrum cycle * * This function returns the next color in a continuous spectrum cycle. * Each call advances the h
firmware/main/led_color_lib.c:79
Function
get_pulsing_color
* @brief Get pulsing color effect * * This function creates a pulsing effect by modulating the brightness of a given * color using a sine wave. Th
firmware/main/led_color_lib.c:152
Function
gpio_interrupt_task
* @brief GPIO interrupt task for handling color sensor triggers * * This task processes GPIO interrupts from the color sensor and performs * color
firmware/main/main.c:344
Function
gpio_isr_handler
* @brief GPIO interrupt service routine * * This ISR handles GPIO interrupts with debouncing to prevent spurious * triggers. It only processes fal
firmware/main/gpio_interrupt.c:47
Function
host_task
* @brief BLE host task for NimBLE stack * * This function runs the NimBLE host stack in a FreeRTOS task. It handles * all BLE operations and retur
firmware/main/gap.c:153
Function
i2c_master_init
* @brief Initialize I2C master peripheral * * This function initializes the I2C master peripheral with the configured * parameters including GPIO
firmware/main/i2c_config.c:27
Function
initialize_neural_network
* @brief Initialize neural network with pre-trained weights * * This function initializes the neural network structure with pre-trained weights *
firmware/main/neural_net_predictor.c:166
Function
led_back_on
* @brief Turn on back LEDs (constant mode) * * This function sets the LED mode to constant lighting. */
firmware/main/led.c:321
Function
led_front_off
* @brief Turn off front LEDs * * This function sets the LED mode to off (not implemented - would need LED_COLOR_OFF mode). */
firmware/main/led.c:311
Function
led_front_on
* @brief Turn on front LEDs (constant mode) * * This function sets the LED mode to constant lighting. */
firmware/main/led.c:301
Function
led_set_individual_color
* @brief Set individual LED color * * This function sets the color of a specific LED by index. * * @param led_index LED index (0-4) * @param co
firmware/main/led.c:334
Function
led_set_taillight_color
* @brief Set taillight LED color * * This function sets the color of the taillight LEDs (rear LEDs) in a thread-safe manner. * * @param color Co
firmware/main/led.c:243
Function
led_task
* @brief LED control task * * This task manages LED patterns and updates the WS2812 LEDs based on the current * flash mode and color settings. It
firmware/main/led.c:55
Function
motor_task
* @brief Motor control task * * This task processes motor control commands from the motor queues. * It runs continuously, checking both motor queu
firmware/main/motor.c:167
Function
opt4060_init
* @brief Initialize the OPT4060 color sensor * * This function initializes the OPT4060 color sensor by: * 1. Setting up I2C communication * 2. Co
firmware/main/opt4060.c:70
Function
opt4060_read_color
* @brief Read color data from OPT4060 sensor * * This function reads raw color data from the OPT4060 sensor and converts * it to 24-bit color valu
firmware/main/opt4060.c:107
Function
opt4060_to_hue
* @brief Convert RGB color values to hue value * * This function converts RGB color values from the OPT4060 color sensor to a hue value * in the r
firmware/main/main.c:97
Function
predict_color
* @brief Predict color using neural network * * This function uses the neural network to predict the color class from RGB values. * It normalizes
firmware/main/neural_net_predictor.c:128
Function
process_and_classify_color
* @brief Process and classify color values with LED feedback * * This function classifies the input RGB values and provides visual feedback * thro
firmware/main/color_predictor.c:213
Function
reset_cb
* @brief BLE reset callback function * * This function is called when the BLE stack is reset. It logs the reset reason * for debugging purposes.
firmware/main/gap.c:75
Function
ring_buffer_get
* @brief Retrieve RGB color data from the ring buffer * * This function retrieves the oldest RGB color values from the buffer * and advances the t
firmware/main/ring_buffer_rgb.c:87
Function
set_hue_increment
* @brief Set the hue increment for color cycling * * This function sets the step size for hue advancement in the full spectrum cycle. * Larger val
firmware/main/led_color_lib.c:97
Function
soft_start_motor
* @brief Soft start motor with gradual speed changes * * This function provides smooth motor control by gradually changing speed * and handling di
firmware/main/motor.c:106
Function
sync_cb
* @brief BLE synchronization callback function * * This function is called when the BLE stack is synchronized and ready to use. * It determines th
firmware/main/gap.c:86
Function
ws2812_rmt_encode
* @brief RMT encoder wrapper function * * This function wraps the bytes encoder for RMT transmission. * It's used internally by the RMT driver to
firmware/main/ws2812_control.c:51