10 volatile char *sram_adr = (
char *)0x1800;
11 volatile char *adc_adr = (
char *)0x1500;
26 char raw_x_str[5] =
"";
27 char raw_y_str[5] =
"";
28 itoa(
pos->x, raw_x_str, 10);
29 itoa(
pos->y, raw_y_str, 10);
47 char raw_x_str[5] =
"";
48 char raw_y_str[5] =
"";
63int16_t
map(uint8_t x, uint8_t in_min, uint8_t in_max, int16_t out_min,
66 int32_t num = (int32_t)(x - in_min) * (out_max - out_min);
67 int32_t den = (int32_t)(in_max - in_min);
68 int32_t result = num / den + out_min;
69 return (int16_t)result;
ADC memory-mapped interface.
void ADC_read_all(struct ADC_meas *output)
Perform a full four-channel ADC conversion and return all results.
int USART_SendString(char data[])
Send a zero-terminated string over USART0.
uint8_t utils_joystick_print_pos(struct io_joystick_position *pos)
Prints joystick position (x/y) via UART.
int16_t map(uint8_t x, uint8_t in_min, uint8_t in_max, int16_t out_min, int16_t out_max)
Maps a value from one range to another (taken from https://docs.arduino.cc/language-reference/en/func...
uint8_t utils_joystick_print_raw(struct io_joystick_device *dev)
Prints raw ADC joystick readings via UART.
Driver for joystick, buttons, and OLED.
struct io_joystick_position pos
Container for ADC measurement results.
Represents a joystick input device.
unsigned int adc_channel_x
unsigned int adc_channel_y
Represents the position of a joystick relative to center.
UART communication driver.
int utils_test_address_decode(void)
Utility and helper functions for joystick, LED debugging, and mapping.