This file contains hidden or 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
static void gpio_setup(void) | |
{ | |
rcc_periph_clock_enable(RCC_GPIOC); | |
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, | |
GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); | |
} |
This file contains hidden or 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
uint32_t baud = (uint32_t)(SystemCoreClock / baudrate); | |
USART1->BRR = baud; |
This file contains hidden or 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
void led_init() | |
{ | |
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; | |
GPIOC->CRH = 0x02 << ((13 - 8) << 2); | |
} | |
void led_on() | |
{ | |
GPIOC->BSRR = 1 << 13; | |
} |
This file contains hidden or 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
#define MY_STACK_SIZE 512 | |
static void thread1_handler(void *, void *, void *); | |
static void thread2_handler(void *, void *, void *); | |
K_THREAD_STACK_DEFINE(stack1, MY_STACK_SIZE); | |
struct k_thread thread1_data; | |
K_THREAD_STACK_DEFINE(stack2, MY_STACK_SIZE); | |
struct k_thread thread2_data; |
This file contains hidden or 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
if (!device_is_ready(spec.port)) | |
{ | |
return; | |
} |
This file contains hidden or 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
var dbRef = firebase.database().ref(); | |
const userRef = dbRef.child('Users'); | |
var container = document.getElementById('container'); | |
userRef.on("child_added", snap => { | |
let user = snap.val(); | |
let li = document.createElement('li'); | |
li.innerHTML = `<i class="fa fa-user-circle" aria-hidden="true"></i>${user.name}` | |
container.appendChild(li); | |
li.addEventListener('click', launchChatWindow); |
This file contains hidden or 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
var dbRef = firebase.database().ref(); | |
const usrRef = dbRef.child('Messages/XuqOxUbSWAPIC763Sxtc6WepFfd2') | |
const container = document.getElementById('chat-container'); | |
let messages = new Object; | |
usrRef.on("child_added", snap => { | |
//* sender is sending as well as receiving messages | |
let sender = snap.val(); | |
// create a heading with name of the sender in it | |
const div = document.createElement('div'); | |
// fetch information of the sender |
This file contains hidden or 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
#include <Arduino.h> | |
#include <U8x8lib.h> | |
#include <lmic.h> | |
#include <hal/hal.h> | |
#include <SPI.h> | |
// Credentials | |
static const PROGMEM u1_t NWKSKEY[16] ={ 0xD9, 0x87, 0x45, 0xEC, 0xD6, 0x69, 0x1B, 0x2F, 0x1A, 0x32, 0x34, 0xEB, 0xFE, 0x74, 0x03, 0x91 }; | |
static const PROGMEM u1_t APPSKEY[16] ={ 0x1E, 0x2C, 0x65, 0xCD, 0x5D, 0xE9, 0x1E, 0xE3, 0xC7, 0x3A, 0x1A, 0x6C, 0x3C, 0x10, 0xB4, 0xCA } ; |
NewerOlder