blink65 1.0
Write Arduino-style sketches for VIC-20 and Commodore 64.
Loading...
Searching...
No Matches
blink65.h
Go to the documentation of this file.
1/*- blink65 - Copyright 2026 Fabio Carignano -------------------------------*/
2
3#ifndef BLINK65_H
4#define BLINK65_H
5
6#include <stdint.h>
7
8#if defined(__C64__)
9#include <c64/pins.h>
10#elif defined(__PET__)
11#include <pet/pins.h>
12#elif defined(__VIC20__)
13#include <vic20/pins.h>
14#endif
15
16#ifdef DEBUG
17#include <stdio.h>
18#endif
19
20
21/*- CONSTANTS --------------------------------------------------------------*/
22
23#define INPUT 0
24#define OUTPUT 1
26#define LOW 0
27#define HIGH 1
30/*- MACROS -----------------------------------------------------------------*/
31
35#ifndef DEBUG
36#define DBG(...)
37#else
38#define DBG(...) printf("!" __VA_ARGS__)
39#endif
40
44#define interrupts() __asm__("cli")
45
49#define noInterrupts() __asm__("sei")
50
51
52/*- EXPORTED LIBRARY FUNCTIONS ---------------------------------------------*/
53
57void delay(
58 uint32_t milliseconds
59);
60
67 uint8_t pin,
68 uint8_t level
69);
70
75 uint8_t pin
76);
77
82 uint8_t pin,
83 uint8_t state
84);
85
89void noTone(
90 uint8_t pin
91);
92
97 uint8_t pin,
98 uint8_t mode
99);
100
104void tone(
105 uint8_t pin,
106 uint16_t frequency
107);
108
109
110/*- IMPORTED USER FUNCTIONS ------------------------------------------------*/
111
115void setup(void);
116
120void loop(void);
121
122#endif /* BLINK65_H */
123/*--------------------------------------------------------------------------*/
void loop(void)
Called repeatedly after setup().
void delay(uint32_t milliseconds)
Stops execution for the given amount of milliseconds.
void analogWrite(uint8_t pin, uint8_t level)
Sets the output level for an analog pin using Pulse Width Modulation (PWM).
void noTone(uint8_t pin)
Stops tone output.
void setup(void)
Called once before loop().
void tone(uint8_t pin, uint16_t frequency)
Outputs a square wave with the given frequency in the range 10Hz..65kHz.
void pinMode(uint8_t pin, uint8_t mode)
Sets mode of a pin.
uint8_t digitalRead(uint8_t pin)
Reads state of an input pin.
void digitalWrite(uint8_t pin, uint8_t state)
Sets state of an output pin.