This file contains 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
// An AP has max 64 words | |
// Bits 3:2 (the X in 0b????XX00) of the address are sent within the command, i.e. "SWDReadAP 3" = read from 0b????1100 | |
// Bits 7:4 (the X in 0bXXXX??00) of the address are set in the SELECT register, i.e. "SWDWriteDP 2 0x??0000F?" = read from 0b1111??00 | |
// The AHB-AP is on APSEL = 0 | |
// The AAP is on APSEL = 255 | |
// APSEL is the MSB of the SELECT register, i.e. "SWDWriteDP 2 0xFF0000?0" = set APSEL to 255 | |
// Read the AP IDR |
This file contains 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
#!/bin/sh | |
xtensa-lx106-elf-objcopy -W Cache_Read_Enable_New sdk/lib/libmain.a sdk/lib/libmain2.a | |
rm sdk/lib/libmain.a | |
mv sdk/lib/libmain2.a sdk/lib/libmain.a | |
cp sdk/lib/*.a xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/lib/ | |
rm xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/libgcc.a | |
cp sdk/lib/libgcc.a xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/ |
This file contains 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 <stdio.h> | |
#include <stdint.h> | |
uint32_t blend(uint32_t base, uint32_t new, float alpha) | |
{ | |
uint8_t base_r = (base >> 16) & 0xFF; | |
uint8_t base_g = (base >> 8) & 0xFF; | |
uint8_t base_b = (base >> 0) & 0xFF; | |
uint8_t new_r = (new >> 16) & 0xFF; |
This file contains 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
#!/bin/sh | |
wget http://packs.download.atmel.com/Atmel.SAME70_DFP.2.4.166.atpack | |
wget http://packs.download.atmel.com/Atmel.SAMS70_DFP.2.4.134.atpack | |
wget http://packs.download.atmel.com/Atmel.SAMV70_DFP.2.4.130.atpack | |
wget http://packs.download.atmel.com/Atmel.SAMV71_DFP.2.4.182.atpack | |
wget https://www.silabs.com/documents/public/cmsis-packs/SiliconLabs.GeckoPlatform_EFM32JG1B_DFP.2.7.0.pack | |
wget https://www.silabs.com/documents/public/cmsis-packs/SiliconLabs.GeckoPlatform_EFM32PG1B_DFP.2.7.0.pack | |
wget https://www.silabs.com/documents/public/cmsis-packs/SiliconLabs.GeckoPlatform_EFM32GG11B_DFP.2.7.0.pack | |
wget https://www.silabs.com/documents/public/cmsis-packs/SiliconLabs.GeckoPlatform_EFM32GG12B_DFP.2.7.0.pack |
This file contains 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
const I2C = require("i2c-bus"); | |
function psu_calc_checksum(addr, buf) | |
{ | |
let cs = (addr << 1); | |
for(let i = 0; i < buf.length - 1; i++) | |
cs += buf.readUInt8(i); | |
buf.writeUInt8(((0xFF - cs) + 1) & 0xFF, buf.length - 1); |
This file contains 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
const c = 299792458; // Speed of light | |
const f = 2400e6; // Hz | |
const lambda = c / f; | |
//////// | |
const ref_dish_diameter = 1.2; // meters | |
const ref_dish_efficiency = 0.5; | |
const ref_dish_gain_db = 10 * Math.log10(ref_dish_efficiency * Math.pow((Math.PI * ref_dish_diameter) / lambda, 2)); | |
const ref_symbol_rate = 250e3; // symbols per second | |
const ref_rx_ss = 8 - 8; // dBb (dB w.r.t the beacon) as seen by the tpx (0 dBb = 8 dB MER) | |
const ref_pwr_w = 30; // watts |
This file contains 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 <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
// gcc -o hx_soc_gpio_pull_cfg hx_soc_gpio_pull_cfg.c | |
// Usage: hx_soc_gpio_pull_cfg <pin> <OFF|UP|DOWN> |
This file contains 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
const k = Math.log2(16); // bits/symbol | |
const sr = 192e3; // Symbol rate | |
const fec = 4/5; // FEC rate | |
const ff = 64800; // FEC Frame size (16200 or 64800) | |
const gse = 3/4; // GSE rate | |
const rof = 0.20; // RRC roll-off factor | |
const pilots = false; // Pilots enabled | |
//////// | |
function isclose(a, b, rel_tol=1e-02, abs_tol=0.0) | |
{ |
This file contains 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
int ncpus(void) { | |
FILE *cmd = popen("grep '^processor' /proc/cpuinfo | wc -l", "r"); | |
if (cmd == NULL) | |
return -1; | |
unsigned nprocs; | |
size_t n; | |
char buff[8]; |