fix assembly errors with hal

This commit is contained in:
Jack Humbert 2018-06-04 00:50:09 -04:00
parent 21665df8eb
commit a6afb16c90
4 changed files with 31 additions and 23 deletions

View file

@ -10,6 +10,7 @@
#include "action.h" #include "action.h"
#include "keycode.h" #include "keycode.h"
#include <string.h> #include <string.h>
#include "quantum.h"
/* /*
* col: { A10, B2, A15, A0, A1, A2, B0, B1, C13, A6, A7, A3 } * col: { A10, B2, A15, A0, A1, A2, B0, B1, C13, A6, A7, A3 }

View file

@ -23,8 +23,6 @@
#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */ #define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
#ifdef __AVR__ #ifdef __AVR__
#include <avr/io.h>
#define LINE_TYPE uint8_t
/* I/O pins */ /* I/O pins */
#ifndef F0 #ifndef F0
@ -78,18 +76,8 @@
#define A7 0x07 #define A7 0x07
#endif #endif
#define setPadMode(line, mode) _SFR_IO8((line >> 4) + 1) mode _BV(line & 0xF)
#define setPad(line) _SFR_IO8((line >> 4) + 2) |= _BV(line & 0xF)
#define clearPad(line) _SFR_IO8((line >> 4) + 2) &= ~_BV(line & 0xF)
#define readPad(line) (_SFR_IO8(line >> 4) & _BV(line & 0xF))
#define PAD_MODE_INPUT &= ~ #elif defined(__arm__)
#define PAD_MODE_OUTPUT |=
#else
#include "hal.h"
#define LINE_TYPE ioline_t
#define A0 PAL_LINE(GPIOA, 0) #define A0 PAL_LINE(GPIOA, 0)
#define A1 PAL_LINE(GPIOA, 1) #define A1 PAL_LINE(GPIOA, 1)
@ -188,12 +176,6 @@
#define F14 PAL_LINE(GPIOF, 14) #define F14 PAL_LINE(GPIOF, 14)
#define F15 PAL_LINE(GPIOF, 15) #define F15 PAL_LINE(GPIOF, 15)
#define setPadMode(line, mode) palSetPadMode(PAL_PORT(line), PAL_PAD(line), mode)
#define setPad(line) palSetPad(PAL_PORT(line), PAL_PAD(line))
#define clearPad(line) palClearPad(PAL_PORT(line), PAL_PAD(line))
#define readPad(line) palReadPad(PAL_PORT(line), PAL_PAD(line))
#define PAD_MODE_INPUT PAL_MODE_INPUT_PULLUP
#endif #endif

View file

@ -16,7 +16,7 @@
*/ */
#include "encoder.h" #include "encoder.h"
#include <stdbool.h> #include "quantum.h"
#ifndef ENCODER_RESOLUTION #ifndef ENCODER_RESOLUTION
#define ENCODER_RESOLUTION 4 #define ENCODER_RESOLUTION 4

View file

@ -17,10 +17,11 @@
#define QUANTUM_H #define QUANTUM_H
#if defined(__AVR__) #if defined(__AVR__)
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#endif #endif
#include "wait.h" #include "wait.h"
#include "matrix.h" #include "matrix.h"
#include "keymap.h" #include "keymap.h"
@ -130,6 +131,30 @@ extern uint32_t default_layer_state;
#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif #endif
#ifdef __AVR__
#include <avr/io.h>
#define LINE_TYPE uint8_t
#define setPadMode(line, mode) _SFR_IO8((line >> 4) + 1) mode _BV(line & 0xF)
#define setPad(line) _SFR_IO8((line >> 4) + 2) |= _BV(line & 0xF)
#define clearPad(line) _SFR_IO8((line >> 4) + 2) &= ~_BV(line & 0xF)
#define readPad(line) (_SFR_IO8(line >> 4) & _BV(line & 0xF))
#define PAD_MODE_INPUT &= ~
#define PAD_MODE_OUTPUT |=
#elif defined(__arm__)
#include "hal.h"
#define LINE_TYPE ioline_t
#define setPadMode(line, mode) palSetPadMode(PAL_PORT(line), PAL_PAD(line), mode)
#define setPad(line) palSetPad(PAL_PORT(line), PAL_PAD(line))
#define clearPad(line) palClearPad(PAL_PORT(line), PAL_PAD(line))
#define readPad(line) palReadPad(PAL_PORT(line), PAL_PAD(line))
#define PAD_MODE_INPUT PAL_MODE_INPUT_PULLUP
#endif
#define STRINGIZE(z) #z #define STRINGIZE(z) #z
#define ADD_SLASH_X(y) STRINGIZE(\x ## y) #define ADD_SLASH_X(y) STRINGIZE(\x ## y)
#define SYMBOL_STR(x) ADD_SLASH_X(x) #define SYMBOL_STR(x) ADD_SLASH_X(x)