Compare commits
3 Commits
master
...
mac_devcon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41b5ec5e35 | ||
|
|
c650ff1157 | ||
|
|
8a28799aac |
24
.devcontainer/Dockerfile
Normal file
24
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Use Ubuntu as the base image
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
# Update and install necessary dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
vim \
|
||||||
|
avr-libc gcc-avr binutils-avr \
|
||||||
|
avrdude \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set the working directory to /workspace (VSCode will mount your local folder here)
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Set the default user as root for installing packages
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Expose any necessary ports (if needed)
|
||||||
|
# EXPOSE 3000
|
||||||
|
|
||||||
|
# Run bash as the default command when the container starts
|
||||||
|
CMD ["/bin/bash"]
|
||||||
11
.devcontainer/devcontainer.json
Normal file
11
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "Ubuntu DevContainer",
|
||||||
|
"dockerFile": "Dockerfile", // Reference to your Dockerfile
|
||||||
|
"context": ".", // The context is the root of your project
|
||||||
|
"workspaceFolder": "/workspace", // Where VSCode will mount your current folder inside the container
|
||||||
|
"mounts": [
|
||||||
|
"source=${localWorkspaceFolder},target=/workspace,type=bind",
|
||||||
|
"source=/dev/tty.usbserial-310,target=/dev/ttyUSB0,type=bind"
|
||||||
|
],
|
||||||
|
"postCreateCommand": "echo 'Devcontainer setup complete!'"
|
||||||
|
}
|
||||||
35
README.md
35
README.md
@@ -79,3 +79,38 @@ avrdude: safemode: Fuses OK (E:00, H:00, L:00)
|
|||||||
|
|
||||||
avrdude done. Thank you.
|
avrdude done. Thank you.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## test macros
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
// // stringify
|
||||||
|
#define STRINGIFY_HELPER(x) #x
|
||||||
|
#define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||||
|
|
||||||
|
#define CONCAT_HELPER(x, y) x ## y
|
||||||
|
#define CONCAT(x, y) CONCAT_HELPER(x, y)
|
||||||
|
|
||||||
|
// get argument at nth position
|
||||||
|
#define ARG_1(v1, v2) v1
|
||||||
|
#define ARG_2(v1, v2) v2
|
||||||
|
#define GET_PORT(args) ARG_1 args
|
||||||
|
#define GET_BIT(args) ARG_2 args
|
||||||
|
|
||||||
|
// actions on registers
|
||||||
|
#define SET(register, bit) register |= 1 << bit
|
||||||
|
|
||||||
|
// actions on ports
|
||||||
|
#define MODE_OUTPUT(elem) SET(CONCAT(DDR, GET_PORT(elem)), GET_BIT(elem))
|
||||||
|
|
||||||
|
// elements
|
||||||
|
#define LED1 (B, 0)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
MODE_OUTPUT(LED1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user