Created
May 26, 2014 13:54
-
-
Save houmei/5def00298417a19cb5f3 to your computer and use it in GitHub Desktop.
86Duino digitalpin test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Blink | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
This example code is in the public domain. | |
*/ | |
// Pin 13 has an LED connected on most Arduino boards. | |
// give it a name: | |
int led = 13; | |
// for 86Duino | |
int enc0_a = 42; | |
int enc0_z = 44; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(led, OUTPUT); | |
pinMode(enc0_a, OUTPUT); | |
pinMode(enc0_z, OUTPUT); | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { | |
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(enc0_a, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(enc0_z, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second | |
digitalWrite(enc0_a, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second | |
digitalWrite(enc0_z, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef Pins_Arduino_h | |
#define Pins_Arduino_h | |
#include "stdint.h" | |
#include "mcm.h" | |
static const uint8_t SS = 10; | |
static const uint8_t MOSI = 11; | |
static const uint8_t MISO = 12; | |
static const uint8_t SCK = 13; | |
static const uint8_t LED_BUILTIN = 13; | |
static const uint8_t A0 = 45; | |
static const uint8_t A1 = 46; | |
static const uint8_t A2 = 47; | |
static const uint8_t A3 = 48; | |
static const uint8_t A4 = 49; | |
static const uint8_t A5 = 50; | |
static const uint8_t A6 = 51; | |
static const uint8_t SDA = 52; | |
static const uint8_t SCL = 53; | |
#define PINS (45) | |
static int pinMap[PINS] = {11, 10, 39, 23, 37, 20, 19, 35, 33, 17, | |
28, 27, 32, 25, 12, 13, 14, 15, 24, 26, | |
29, 47, 46, 45, 44, 43, 42, 41, 40, 1, | |
3, 4, 31, 0, 2, 5, 22, 30, 6, 38, | |
36, 34, 16, 18, 21}; | |
#define NOPWM (-1) | |
static int MC_list[] = { MC_MODULE0, MC_MODULE1, MC_MODULE2, MC_MODULE3 }; | |
static int MD_list[] = { MCPWM_MODULEA, MCPWM_MODULEB, MCPWM_MODULEC }; | |
static int arduino_to_mc_md[2][PINS] = { | |
// MC | |
{NOPWM, NOPWM, NOPWM, MC_list[3], NOPWM, MC_list[0], MC_list[0], NOPWM, NOPWM, MC_list[0], | |
MC_list[1], MC_list[1], NOPWM, MC_list[1], NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, | |
NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, MC_list[2], | |
MC_list[2], MC_list[2], MC_list[3], NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, | |
NOPWM, NOPWM, NOPWM, NOPWM, NOPWM}, | |
// MD | |
{NOPWM, NOPWM, NOPWM, MD_list[0], NOPWM, MD_list[2], MD_list[1], NOPWM, NOPWM, MD_list[0], | |
MD_list[2], MD_list[1], NOPWM, MD_list[0], NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, | |
NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, MD_list[0], | |
MD_list[1], MD_list[2], MD_list[1], NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, NOPWM, | |
NOPWM, NOPWM, NOPWM, NOPWM, NOPWM} | |
}; | |
#define EXTERNAL_NUM_INTERRUPTS (12) | |
static void (*_userfunc[EXTERNAL_NUM_INTERRUPTS])(void) = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; | |
static int pin_offset[EXTERNAL_NUM_INTERRUPTS] = {16, 18, 21, 24, 26, 29, 0, 2, 5, 22, 30, 6}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment