Skip to content

Commit

Permalink
Fixup vibrate by enabling clocks. Also move to platform
Browse files Browse the repository at this point in the history
* Add git version
* note the new build script too
  • Loading branch information
ginge committed Feb 27, 2018
1 parent e41c87d commit 2a4b0e4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 23 deletions.
19 changes: 19 additions & 0 deletions Utilities/flash_device_adb.sh
@@ -0,0 +1,19 @@
#!/bin/bash
# Push firmware.pbz to the deviceA simple adb push script to get a RebbleOS firmware onto hardware
platform=$1

if [[ -z $1 ]]; then
echo "Defaulting to Snowy. Please use '$0 platform' if this isn't what you intended"
platform="snowy"
fi

echo "I'm going to build platform $platform's PBZ, push it to a connected "
echo "android device over ADB, and then invoke the flash prompt on the pebble app"

if [ "$platform" != "tintin" ] && [ "$platform" != "snowy" ] && [ "$platform" != "chalk" ]; then
echo "I don't know what platform $1 is!, sorry"
exit 1
fi
make $platform
adb push ./build/$platform/$platform.pbz /sdcard/Download/
adb shell am start -n com.getpebble.android.basalt/com.getpebble.android.main.activity.MainActivity -a android.intent.action.VIEW -d file:///sdcard/Download/$platform.pbz
12 changes: 0 additions & 12 deletions buildfw.sh

This file was deleted.

10 changes: 10 additions & 0 deletions hw/platform/snowy_family/snowy_common.c
Expand Up @@ -16,6 +16,7 @@
#include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
#include "snowy_vibrate.h"

// ENABLE this if you want smartstrap debugging output. For now if you do this qemu might not work
#define DEBUG_UART_SMARTSTRAP
Expand All @@ -24,6 +25,15 @@ void init_USART3(void);
void init_USART8(void);
void ss_debug_write(const unsigned char *p, size_t len);


/* Configs */
const vibrate_t hw_vibrate_config = {
.pin = GPIO_Pin_4,
.port = GPIOF,
.clock = RCC_AHB1Periph_GPIOF,
};


/*
* Begin device init
*/
Expand Down
22 changes: 14 additions & 8 deletions hw/platform/snowy_family/snowy_vibrate.c
Expand Up @@ -6,35 +6,41 @@
*/

#include "stm32f4xx.h"
#include "stm32_power.h"
#include "stdio.h"
#include "string.h"
#include "snowy_vibrate.h"
#include <stm32f4xx_spi.h>
#include <stm32f4xx_gpio.h>

vibrate_t vibrate = {
.Pin = GPIO_Pin_4,
.Port = GPIOF,
};
extern const vibrate_t hw_vibrate_config;

void hw_vibrate_init(void)
{
stm32_power_request(STM32_POWER_AHB1, hw_vibrate_config.clock);

GPIO_InitTypeDef GPIO_InitStructure_Vibr;

// init the vibrator
GPIO_InitStructure_Vibr.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure_Vibr.GPIO_Pin = vibrate.Pin;
GPIO_InitStructure_Vibr.GPIO_Pin = hw_vibrate_config.pin;
GPIO_InitStructure_Vibr.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure_Vibr.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure_Vibr.GPIO_OType = GPIO_OType_PP;
GPIO_Init(vibrate.Port, &GPIO_InitStructure_Vibr);
GPIO_Init(hw_vibrate_config.port, &GPIO_InitStructure_Vibr);

stm32_power_release(STM32_POWER_AHB1, hw_vibrate_config.clock);
}


void hw_vibrate_enable(uint8_t enabled)
{
stm32_power_request(STM32_POWER_AHB1, hw_vibrate_config.clock);

if (enabled)
GPIO_SetBits(vibrate.Port, vibrate.Pin);
GPIO_SetBits(hw_vibrate_config.port, hw_vibrate_config.pin);
else
GPIO_ResetBits(vibrate.Port, vibrate.Pin);
GPIO_ResetBits(hw_vibrate_config.port, hw_vibrate_config.pin);

stm32_power_release(STM32_POWER_AHB1, hw_vibrate_config.clock);
}
5 changes: 3 additions & 2 deletions hw/platform/snowy_family/snowy_vibrate.h
Expand Up @@ -9,8 +9,9 @@
#include "stm32f4xx.h"

typedef struct {
uint16_t Pin;
GPIO_TypeDef *Port;
uint16_t pin;
GPIO_TypeDef *port;
uint32_t clock;
} vibrate_t;


Expand Down
4 changes: 3 additions & 1 deletion rcore/main.c
Expand Up @@ -9,6 +9,8 @@
#include "watchdog.h"
#include "ambient.h"

extern const char git_version[];

int main(void)
{
SystemInit();
Expand All @@ -17,7 +19,7 @@ int main(void)

rebbleos_init();

KERN_LOG("main", APP_LOG_LEVEL_INFO, "RebbleOS", VERSION);
KERN_LOG("main", APP_LOG_LEVEL_INFO, "RebbleOS git: %s", git_version);

vTaskStartScheduler(); // should never return

Expand Down

0 comments on commit 2a4b0e4

Please sign in to comment.