Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some includes #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Apps/System/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Author: Barry Carter <[email protected]>.
*/

#include "rebbleos.h"
#include "menu.h"

static list_head _res_list_head = LIST_HEAD(_res_list_head);
Expand Down
2 changes: 1 addition & 1 deletion Apps/System/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Author: Barry Carter <[email protected]>.
*/

#include "librebble.h"
#include <stdint.h>
#include "menu_layer.h"

struct Menu;
Expand Down
25 changes: 13 additions & 12 deletions Apps/System/systemapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
*/

#include "rebbleos.h"
#include "systemapp.h"
#include "menu.h"
#include "status_bar_layer.h"
#include "platform_config.h"
#include "platform_res.h"
#include "node_list.h"
#include "protocol.h"
#include "protocol_music.h"
#include "event_service.h"
#include "graphics/system_font.h"
#include "menu.h"
#include "systemapp.h"

/* Configure Logging */
#define MODULE_NAME "sysapp"
Expand Down Expand Up @@ -145,7 +146,7 @@ static void _music_info(EventServiceProc command, void *data)
LOG_INFO("Title: %s", amusic->title);
LOG_INFO("Artist: %s", amusic->artist);
LOG_INFO("Album: %s", amusic->album);

items->items[2].sub_text = amusic->title;
}

Expand Down Expand Up @@ -182,7 +183,7 @@ static void systemapp_window_load(Window *window)
#endif

//tick_timer_service_subscribe(MINUTE_UNIT, prv_tick_handler);

/* Music. Request the music track from the remote device */
protocol_music_get_current_track();
event_service_subscribe(EventServiceCommandMusic, _music_info);
Expand All @@ -195,7 +196,7 @@ static void systemapp_window_unload(Window *window)

static void window_exit_handler(ClickRecognizerRef recognizer, void *context)
{
window_stack_pop(true);
window_stack_pop(true);
}

static void about_window_load(Window *window)
Expand All @@ -215,7 +216,7 @@ static void about_window_load(Window *window)

s_aboutCanvas_layer = layer_create(bounds);
layer_set_update_proc(s_aboutCanvas_layer, about_update_proc);
scroll_layer_add_child(s_about_scroll, s_aboutCanvas_layer);
scroll_layer_add_child(s_about_scroll, s_aboutCanvas_layer);
layer_mark_dirty(s_aboutCanvas_layer);

layer_add_child(window_layer, scroll_layer_get_layer(s_about_scroll));
Expand All @@ -224,19 +225,19 @@ static void about_window_load(Window *window)
#ifdef PBL_BW
//TODO: Get black and white rocket bitmap for Classic
logo_bitmap = gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_BW);
rocket_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TO_MOON_BW);
rocket_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TO_MOON_BW);
#else
logo_bitmap = gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_DARK);
rocket_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TO_MOON);
#endif

about_did_set_size = 0;

/* XXX: Some day it would be cool to automatically scroll the credits after a short delay. */
}

static void about_update_proc(Layer *layer, GContext *nGContext)
{
{
GRect bounds = layer_get_unobstructed_bounds(layer);
graphics_context_set_text_color(nGContext, GColorBlack);
graphics_context_set_compositing_mode(nGContext, GCompOpSet);
Expand All @@ -257,10 +258,10 @@ static void about_update_proc(Layer *layer, GContext *nGContext)

graphics_draw_bitmap_in_rect(nGContext, logo_bitmap, GRect((bounds.size.w/2)-17, (bounds.size.h/2)-63, 34, 53));
graphics_draw_bitmap_in_rect(nGContext, rocket_bitmap, GRect((bounds.size.w/2)-8, (bounds.size.h/2)+60, 19, 19));

graphics_draw_text(nGContext, "Credits", fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), GRect(10, bounds.size.h, bounds.size.w - 20, 20),
n_GTextOverflowModeWordWrap, GTextAlignmentCenter, 0);

const char **authorp = git_authors;
int y = bounds.size.h + 30;
for (authorp = git_authors; *authorp; authorp++) {
Expand All @@ -269,7 +270,7 @@ static void about_update_proc(Layer *layer, GContext *nGContext)
n_GTextOverflowModeWordWrap, GTextAlignmentCenter, 0);
y += 16;
}

/* Set the size on the first render only, lest we interfere with actual scrolling. */
if (!about_did_set_size) {
about_did_set_size = 1;
Expand Down
2 changes: 1 addition & 1 deletion Apps/System/testapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Barry Carter <[email protected]>
*/

#include "rebbleos.h"
#include "librebble.h"
#include "menu.h"
#include "status_bar_layer.h"
#include "test_defs.h"
Expand Down
2 changes: 1 addition & 1 deletion Apps/System/tests/vibes_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: Author: Elliot Hawkins <[email protected]>.
*/

#include "rebbleos.h"
#include "librebble.h"
#include "systemapp.h"
#include "menu.h"
#include "status_bar_layer.h"
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ $(BUILD)/$(1)/tintin_fw.elf: $(BUILD)/$(1)/res/platform_res.h $$(OBJS_$(1))
$(BUILD)/$(1)/%.o: %.c
$(call SAY,[$(1)] CC $$<)
@mkdir -p $$(dir $$@)
$(QUIET)$(CC) $$(CFLAGS_$(1)) -MMD -MP -MT $$@ -MF $$(addsuffix .d,$$(basename $$@)) -c -o $$@ $$<
$(QUIET)$(CC) $$(CFLAGS_$(1)) -MMD -MP -MT $$@ -MF $$(addsuffix .d,$$(basename $$@)) -c -o $$@ $$<

$(BUILD)/$(1)/%.o: %.s
$(call SAY,[$(1)] AS $$<)
@mkdir -p $$(dir $$@)
$(QUIET)$(CC) $$(CFLAGS_$(1)) -c -o $$@ $$<
$(QUIET)$(CC) $$(CFLAGS_$(1)) -c -o $$@ $$<

$(BUILD)/$(1)/%.o: %.S
$(call SAY,[$(1)] AS $$<)
@mkdir -p $$(dir $$@)
$(QUIET)$(CC) $$(CFLAGS_$(1)) -c -o $$@ $$<
$(QUIET)$(CC) $$(CFLAGS_$(1)) -c -o $$@ $$<

$(BUILD)/$(1)/Resources/%_fpga.o: Resources/%_fpga.bin
$(call SAY,[$(1)] FPGA $$<)
@mkdir -p $$(dir $$@)
Expand Down
1 change: 0 additions & 1 deletion hw/drivers/stm32_buttons/stm32_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "stm32_buttons.h"
#include "stm32_power.h"
#include "stm32_buttons_platform.h"
#include "buttons.h"
#include "debug.h"

static hw_button_isr_t _isr = NULL;
Expand Down
6 changes: 3 additions & 3 deletions hw/drivers/stm32_usart/stm32_usart.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* stm32_usart.h
* External-facing API for stm32 USART module
* This is a simple wrapper around common USART defaults and functions
Expand Down Expand Up @@ -45,7 +45,7 @@ typedef struct {
const stm32_dma_t *dma;
uint32_t baud;
} stm32_usart_t;

void stm32_usart_init_device(stm32_usart_t *usart);
void stm32_usart_set_baud(stm32_usart_t *usart, uint32_t baud);
size_t stm32_usart_write(stm32_usart_t *usart, const uint8_t *buf, size_t len);
Expand All @@ -69,7 +69,7 @@ void _stm32_usart_rx_start_init_isr(stm32_usart_t *usart, uint16_t irqn, uint16_
static inline void _stm32_usart_tx_isr(void) { \
stm32_usart_tx_isr(usart, callback); \
}

#define STM32_USART_MK_RX_IRQ_HANDLER(usart, dma_channel, stream, callback) \
STM32_DMA_MK_RX_IRQ_HANDLER( (usart) ->dma, dma_channel, stream, _stm32_usart_rx_isr ) \
\
Expand Down
2 changes: 2 additions & 0 deletions hw/platform/snowy/platform_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#define DISPLAY_COLS 144

//We are a square device
#ifndef PBL_RECT
#define PBL_RECT
#endif

extern unsigned char _binary_Resources_snowy_fpga_bin_size;
extern unsigned char _binary_Resources_snowy_fpga_bin_start;
Expand Down
35 changes: 17 additions & 18 deletions lib/minilib/qalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,30 @@ static void _qsplit(qarena_t *arena, qblock_t *blk, unsigned size);
qarena_t *qinit(void *start, unsigned size) {
qarena_t *arena = start;
arena->size = size;

qblock_t *blk = BLK(arena + 1); // start = &arena[1], so arena[0] is left alone.
blk->szflag = size - sizeof(*arena);
_cookie_unset(arena, blk);
#ifdef HEAP_PARANOID
memset(BLK_PAYLOAD(blk), 0xAA, BLK_SZ(blk) - sizeof(qblock_t));
#endif
BLK_FREE(blk);

return arena;
}

void *qalloc(qarena_t *arena, unsigned size) {
qblock_t *blk = BLK(arena+1);
qblock_t *end = BLK((char *)arena + arena->size);
void *n = NULL;


if (size == 0)
return NULL;

size = BLK_ALSIZE(size);

while (blk && blk < end) {
qcheck(arena, blk);

/* We need either exactly enough room for this block, or we
* need enough room for this and one more block to be
* constructed at the end. */
Expand All @@ -103,7 +102,7 @@ void *qalloc(qarena_t *arena, unsigned size) {

_cookie_set(arena, blk);
BLK_ALLOC(blk);

return BLK_PAYLOAD(blk);
}
return NULL;
Expand All @@ -121,22 +120,22 @@ static void _qsplit(qarena_t *arena, qblock_t *blk, unsigned size) {
void *qrealloc(qarena_t *arena, void *ptr, unsigned size) {
if (size == 0)
return NULL;

size = BLK_ALSIZE(size);

if (!ptr)
return qalloc(arena, size);

qblock_t *blk = BLK_FROMPAYLOAD(ptr);

/* is the new size smaller? */
if (size < BLK_SZ(blk)) {
_qsplit(arena, blk, size);
_cookie_unset(arena, blk);
qjoin(arena);
return BLK_PAYLOAD(blk);
}

/* is there room after */
qblock_t *nblk = BLK_NEXT(blk);
uint32_t reqsize = size - BLK_SZ(blk);
Expand All @@ -151,19 +150,19 @@ void *qrealloc(qarena_t *arena, void *ptr, unsigned size) {
void *newm = qalloc(arena, size);
if (!newm)
return NULL;

memcpy(newm, BLK_PAYLOAD(blk), BLK_SZ(blk));
qfree(arena, BLK_PAYLOAD(blk));
qjoin(arena);

return newm;
}

uint32_t qusedbytes(qarena_t *arena) {
qblock_t *blk = BLK(arena+1);
qblock_t *end = BLK((char *)arena + arena->size);
uint32_t cnt = 0;

while (blk && blk < end) {
if (!BLK_ISFREE(blk)) {
cnt += BLK_SZ(blk);
Expand All @@ -180,7 +179,7 @@ uint32_t qfreebytes(qarena_t *arena) {
void qfree(qarena_t *arena, void *ptr) {
if (!ptr)
return;

qblock_t *blk = BLK_FROMPAYLOAD(ptr);

#ifdef HEAP_INTEGRITY
Expand All @@ -200,7 +199,7 @@ void qfree(qarena_t *arena, void *ptr) {
static void qjoin(qarena_t *arena) {
qblock_t *blk = BLK(arena+1);
qblock_t *end = (qblock_t *)((char *)arena + arena->size);

while (blk && blk < end) {
qcheck(arena, blk);
if (BLK_NEXT(blk) < end && BLK_ISFREE(blk) && BLK_ISFREE(BLK_NEXT(blk))) {
Expand Down Expand Up @@ -233,7 +232,7 @@ static void qcheck(qarena_t *arena, qblock_t *blk) {
if (BLK_ISFREE(blk)) {
unsigned i;
uint8_t *p = BLK_PAYLOAD(blk);

for (i = 0; i < BLK_SZ(blk) - sizeof(qblock_t); i++)
if (p[i] != 0xAA) {
printf("%08x %08x %08x %02x\n", p, i, &p[i], p[i]);
Expand Down
5 changes: 2 additions & 3 deletions lib/musl/time/mktime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

time_t mktime(struct tm *tm)
{
struct tm new;
long opp;
long long t = __tm_to_secs(tm);
/*struct tm new;
long opp;

/*
__secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);

if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst)
Expand Down
18 changes: 10 additions & 8 deletions lib/png/png.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "rebble_memory.h"
#include "log.h"

#include "upng.h"
#include "png.h"


void png_to_gbitmap(GBitmap *bitmap, uint8_t *raw_buffer, size_t png_size)
void png_to_gbitmap(n_GBitmap *bitmap, uint8_t *raw_buffer, size_t png_size)
{
/* Set up the bitmap, assuming we will fail. */
bitmap->palette = NULL;
Expand All @@ -14,7 +16,7 @@ void png_to_gbitmap(GBitmap *bitmap, uint8_t *raw_buffer, size_t png_size)
bitmap->raw_bitmap_size.w = 0;
bitmap->raw_bitmap_size.h = 0;
bitmap->addr = NULL;
bitmap->format = GBitmapFormat8Bit;
bitmap->format = n_GBitmapFormat8Bit;
bitmap->free_data_on_destroy = true;
bitmap->free_palette_on_destroy = true;

Expand Down Expand Up @@ -121,12 +123,12 @@ void png_to_gbitmap(GBitmap *bitmap, uint8_t *raw_buffer, size_t png_size)
// set the resultant format
if (bpp == 1 && (bitmap->palette_size > 0 || alen > 0))
{
bitmap->format = GBitmapFormat1BitPalette;
bitmap->format = n_GBitmapFormat1BitPalette;
}
else if (bpp == 1)
{
// easier to generate the black/white palette than to reverse every byte
bitmap->format = GBitmapFormat1BitPalette;
bitmap->format = n_GBitmapFormat1BitPalette;

n_GColor* bw_palette = app_calloc(2, sizeof(n_GColor));
bw_palette[0] = n_GColorBlack;
Expand All @@ -136,15 +138,15 @@ void png_to_gbitmap(GBitmap *bitmap, uint8_t *raw_buffer, size_t png_size)
}
else if (bpp == 2)
{
bitmap->format = GBitmapFormat2BitPalette;
bitmap->format = n_GBitmapFormat2BitPalette;
}
else if (bpp == 4)
{
bitmap->format = GBitmapFormat4BitPalette;
bitmap->format = n_GBitmapFormat4BitPalette;
}
else if (bpp == 8)
{
bitmap->format = GBitmapFormat8Bit;
bitmap->format = n_GBitmapFormat8Bit;

// Convert 8bit palette to just 8bit
if (plen)
Expand Down
Loading