TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
8
9#ifndef INCLUDE_INCLUDE_UTILS_H_
10#define INCLUDE_INCLUDE_UTILS_H_
11
12#include <avr/io.h>
13#include <util/delay.h>
14
15#include "io.h"
16
17#define UTILS_DEBUG_LED_PIN PB0
18
19#define TRASHCAN ((void *)0)
20
26#define STATUS_ASSERT(status) \
27 { \
28 DDRB |= (1 << UTILS_DEBUG_LED_PIN); \
29 \
30 if (status) { \
31 PORTB |= (1 << UTILS_DEBUG_LED_PIN); \
32 } \
33 while (status > 0) { \
34 PORTB ^= (1 << UTILS_DEBUG_LED_PIN); \
35 _delay_ms(500); \
36 } \
37 }
38
45
52
63int16_t map(uint8_t x, uint8_t in_min, uint8_t in_max, int16_t out_min,
64 int16_t out_max);
65
66#endif // INCLUDE_INCLUDE_UTILS_H_
67
uint8_t utils_joystick_print_pos(struct io_joystick_position *pos)
Prints joystick position (x/y) via UART.
Definition utils.c:21
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...
Definition utils.c:63
uint8_t utils_joystick_print_raw(struct io_joystick_device *dev)
Prints raw ADC joystick readings via UART.
Definition utils.c:42
Driver for joystick, buttons, and OLED.
struct io_joystick_position pos
Definition main.c:58
Represents a joystick input device.
Definition io.h:55
Represents the position of a joystick relative to center.
Definition io.h:70