mirror of
https://github.com/mon/PocketVoltex.git
synced 2026-09-29 02:08:01 +03:00
Fix inline ASM for GCC 4.9
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#define G 1
|
||||
#define B 0
|
||||
|
||||
uint8_t leds[LED_PHYSICAL_COUNT];
|
||||
static volatile uint8_t leds_frontbuffer[LED_PHYSICAL_COUNT];
|
||||
|
||||
void led_init() {
|
||||
@@ -128,15 +129,15 @@ void led_set_indiv(uint8_t num, uint8_t val) {
|
||||
if(*led++ > brightness)
|
||||
out |= _BV(outPin)
|
||||
*/
|
||||
#define LED_PIN_SET(led, outPin) \
|
||||
__asm__ volatile( \
|
||||
"ld __tmp_reg__, %a["#led"]+ \n\t\
|
||||
cp %[bright], __tmp_reg__ \n\t\
|
||||
brcc skip%= \n\t\
|
||||
ori %[out], (1 << "#outPin") \n\t\
|
||||
skip%=:" \
|
||||
: [out] "=r" (out), "=z" (led) /* outputs */ \
|
||||
: "r" (out), [led] "z" (led), [bright] "r" (brightness) /* inputs */ )
|
||||
#define LED_PIN_SET(led, outPin) \
|
||||
__asm__ volatile( \
|
||||
"ld __tmp_reg__, %a["#led"]+ \n\t\
|
||||
cp %[bright], __tmp_reg__ \n\t\
|
||||
brcc skip%= \n\t\
|
||||
ori %[out], (1 << "#outPin") \n\t\
|
||||
skip%=:" \
|
||||
: [out] "+a" (out), [led] "+z" (led) /* outputs */ \
|
||||
: [bright] "r" (brightness) /* inputs */ )
|
||||
|
||||
// This function once took about 279 clock cycles.
|
||||
// Optimised GND accesses got it to 157
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef struct {
|
||||
|
||||
// Arranged left to right, top to bottom
|
||||
// LED order is BGR...BGR
|
||||
uint8_t leds[LED_PHYSICAL_COUNT];
|
||||
extern uint8_t leds[LED_PHYSICAL_COUNT];
|
||||
|
||||
// Maps BT/FX keys to their associated LED
|
||||
// Order is BT-1-4, FX-L, FX-R
|
||||
|
||||
Reference in New Issue
Block a user