Main firmware minor code cleanup
This commit is contained in:
parent
03376cc654
commit
df00440ce4
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* pirate.h: half-assed piracy-enabling features for drunken, brazen pirates
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: pirate.h 505 2021-09-05 19:07:51Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_PIRATE_H
|
||||
|
@ -81,18 +76,19 @@ extern uint32_t pirate_prng_val;
|
|||
|
||||
|
||||
/* pirate functions */
|
||||
void pirate_shutdown(uint16_t type);
|
||||
void pirate_shutdown(uint16_t type);
|
||||
|
||||
uint8_t pirate_prng();
|
||||
void pirate_delay(uint16_t ms);
|
||||
int16_t pirate_scale(int16_t value, int16_t src_min, int16_t src_max, int16_t dest_min, int16_t dest_max);
|
||||
char * pirate_itoa(uint32_t val, uint8_t base, uint8_t leftpad);
|
||||
char * pirate_sitoa(int32_t val, uint8_t base, uint8_t leftpad);
|
||||
uint8_t pirate_prng();
|
||||
void pirate_delay(uint16_t ms);
|
||||
int16_t pirate_scale(int16_t value, int16_t src_min, int16_t src_max, int16_t dest_min, int16_t dest_max);
|
||||
char * pirate_itoa(uint32_t val, uint8_t base, uint8_t leftpad);
|
||||
char * pirate_sitoa(int32_t val, uint8_t base, uint8_t leftpad);
|
||||
|
||||
uint16_t pirate_batt_voltage();
|
||||
void pirate_batt_log(uint16_t rawvalue);
|
||||
void pirate_batt_log(uint16_t rawvalue);
|
||||
|
||||
uint16_t pirate_thermometer(uint8_t deg_f);
|
||||
void pirate_thermometer_log(uint8_t temp);
|
||||
void pirate_thermometer_log(uint8_t temp);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __PIRATE_PIRATE_H */
|
|
@ -4,12 +4,7 @@
|
|||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: attiny.c 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* attiny88's I2C address is 0x73 - see led_eyes.h for define
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h> // for settings
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* attiny.h: interface to attiny88's RGBLED eyes prototypes
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: attiny.h 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DEV_ATTINY_H
|
||||
#define __PIRATE_DEV_ATTINY_H
|
||||
#ifndef __DEVICE_ATTINY_H
|
||||
#define __DEVICE_ATTINY_H
|
||||
|
||||
|
||||
|
||||
|
@ -17,26 +12,26 @@
|
|||
#define ATTINY_I2C_DEV I2C1
|
||||
#define ATTINY_I2C_ADDR 0x73
|
||||
|
||||
// write register commands, last 4 bits = data, >1 packet
|
||||
// write register commands, last 4 bits = data, >1 packet
|
||||
#define ATTINY_CMD_EXT_CMD 0x10 // pkt = ext command (bit[7:4] must NOT == 0)
|
||||
#define ATTINY_CMD_LED_LEVEL 0x20 // cmd[3:0] = led, pkt = level (0-250)
|
||||
#define ATTINY_CMD_TEMP_CAL 0x30 // pkt = current temperature
|
||||
#define ATTINY_CMD_EEPROM_READ 0x40 // pkt = address, read 1 byte after this command
|
||||
#define ATTINY_CMD_EEPROM_READ 0x40 // pkt = address, read 1 byte after this command
|
||||
#define ATTINY_CMD_EEPROM_WRITE 0x50 // pkt[0] = address, pkt[1] = data
|
||||
// write register commands, last 4 bits = data, immediate processing 1 packet
|
||||
|
||||
// write register commands, last 4 bits = data, immediate processing 1 packet
|
||||
#define ATTINY_CMD_READ_TEMP 0x80 // read 1 byte after this command
|
||||
#define ATTINY_CMD_READ_LIGHT 0x90 // cmd[3:0] = led (from 0-3), read 1 byte after this command
|
||||
#define ATTINY_CMD_SLEEP 0xF0 // no data
|
||||
// write register commands, extended
|
||||
|
||||
// write register commands, extended
|
||||
#define ATTINY_CMD_LIGHTSENSOR_SENS 0x1019 // 2 bytes data - led, new sensitivity value
|
||||
|
||||
|
||||
/* leds */
|
||||
// leds
|
||||
#define LED_EYES_LEFT 0
|
||||
#define LED_EYES_RIGHT 1
|
||||
|
||||
|
||||
/* programs */
|
||||
// programs
|
||||
#define LED_EYES_MODE_OFF 0
|
||||
#define LED_EYES_MODE_PROGRAM 2
|
||||
|
||||
|
@ -62,4 +57,4 @@ void attiny_sleep();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __DEVICE_ATTINY_H */
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: beep.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* TODO: remove freq lookup table, replace with freq defines by note (A4 = 440 for example)
|
||||
* TODO: let you know that the device we chose cannot play music; it is a buzzer.
|
||||
* TODO: do what you want 'cause a pirate is free
|
||||
|
|
|
@ -3,16 +3,14 @@
|
|||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: beep.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
*
|
||||
* do what you want 'cause a pirate is free
|
||||
* you are a pirate
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DEV_BEEP_H
|
||||
#define __PIRATE_DEV_BEEP_H
|
||||
#ifndef __DEVICE_BEEP_H
|
||||
#define __DEVICE_BEEP_H
|
||||
|
||||
|
||||
|
||||
|
@ -29,4 +27,4 @@ uint16_t beep(uint16_t tone_id, uint16_t duration);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __DEVICE_BEEP_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* beep_music.h: musical scores for pirates
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: beep_song.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
static MusicSong you_are_a_pirate[] = {
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* lcd.c: lcd menuing and support functions
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lcd.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* lcd.c: lcd menuing and support function prototypes
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lcd.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DEV_LCD_H
|
||||
#define __PIRATE_DEV_LCD_H
|
||||
#ifndef __DEVICE_LCD_H
|
||||
#define __DEVICE_LCD_H
|
||||
|
||||
|
||||
|
||||
|
@ -69,4 +64,4 @@ void lcd_led_update();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __DEVICE_LCD_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* lightsensor.c: control of the attiny's light sensor output plus helper functions
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lightsensor.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
/**
|
||||
* lightsensor.h: control of the attiny's light sensor output plus helper functions
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lightsensor.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __PIRATE_DEV_LIGHTSENSOR_H
|
||||
#define __PIRATE_DEV_LIGHTSENSOR_H
|
||||
#ifndef __DEVICE_LIGHTSENSOR_H
|
||||
#define __DEVICE_LIGHTSENSOR_H
|
||||
|
||||
|
||||
|
||||
|
@ -45,4 +39,4 @@ uint8_t lightsensor_get_scalerval(uint8_t which);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __DEVICE_LIGHTSENSOR_H */
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* radio/address.c: address buffers and lookups
|
||||
* address.c: address buffers and lookups
|
||||
* 2015 by true
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**/
|
||||
|
||||
/*
|
||||
static char dc22_name[32][8];
|
||||
static char dc23_name[300][3];
|
||||
*/
|
|
@ -1,7 +1,4 @@
|
|||
/**
|
||||
* radio/address.h: address buffers and lookups
|
||||
* address.h: address buffers and lookups
|
||||
* 2015 by true
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**/
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* radio/irq.c: nrf irq handler
|
||||
* irq.c: nrf irq handler
|
||||
* 2015 by true
|
||||
|
||||
* ----
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -7,11 +7,6 @@
|
|||
* This is a nasty hack implementation of the NRF24L01+.
|
||||
* Modify as necessary if using on another STM32; see nrf.h
|
||||
* and the NRF24L01 library.
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: nrf.c 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DEV_NRF24L01_H
|
||||
#define __PIRATE_DEV_NRF24L01_H
|
||||
#ifndef __DEVICE_NRF_H
|
||||
#define __DEVICE_NRF_H
|
||||
|
||||
|
||||
/* libraries */
|
||||
|
@ -51,4 +51,5 @@ void nrf_init();
|
|||
uint8_t nrf_checksum(uint8_t *data, uint8_t len, int32_t offset);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __DEVICE_NRF_H */
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _NRF24L01_H
|
||||
#define _NRF24L01_H
|
||||
#ifndef __NRF24L01_H
|
||||
#define __NRF24L01_H
|
||||
|
||||
|
||||
#define NRF_BIT0 1 << 0
|
||||
|
@ -183,4 +183,4 @@
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __NRF24L01_H */
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
* true's NRF24L01+ C library
|
||||
* shamelessly stolen and modified heavily from some other shit
|
||||
* basically: it's better than nothing
|
||||
*
|
||||
* $Id: true_nRF24L01.c 505 2021-09-05 19:07:51Z true $
|
||||
*
|
||||
* ====
|
||||
*
|
||||
* general instructions to set up:
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* true's NRF24L01+ C library
|
||||
* shamelessly stolen and modified heavily from some other shit
|
||||
* basically: it's better than nothing
|
||||
*
|
||||
* $Id: true_nRF24L01.h 505 2021-09-05 19:07:51Z true $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -75,6 +73,7 @@ typedef struct nrfConfig {
|
|||
} nrfConfig;
|
||||
|
||||
|
||||
|
||||
/* data handling */
|
||||
void (*nRF24_rx_cb)(uint8_t pipe, uint8_t *pBuf, uint8_t len);
|
||||
void (*nRF24_tx_done_cb)();
|
||||
|
@ -82,7 +81,7 @@ void (*nRF24_tx_max_rt_cb)();
|
|||
|
||||
|
||||
/* function prototypes */
|
||||
void nRF24_init(uint32_t cpu_freq);
|
||||
void nRF24_init(uint32_t cpu_freq);
|
||||
uint8_t nRF24_interrupt();
|
||||
|
||||
uint8_t nRF24_reg_rw(uint8_t reg, uint8_t value);
|
||||
|
@ -93,36 +92,37 @@ uint8_t nRF24_buf_read(uint8_t reg, void *pBuf, uint8_t bytes);
|
|||
|
||||
uint8_t nRF24_is_present(void);
|
||||
|
||||
void nRF24_set_txaddr(const uint8_t *addr);
|
||||
void nRF24_set_rxaddr(uint8_t pipe, const uint8_t *addr);
|
||||
void nRF24_set_txaddr(const uint8_t *addr);
|
||||
void nRF24_set_rxaddr(uint8_t pipe, const uint8_t *addr);
|
||||
|
||||
void nRF24_set_channel(uint8_t chan);
|
||||
void nRF24_set_rate(uint8_t rate);
|
||||
void nRF24_set_power(uint8_t power);
|
||||
void nRF24_set_addr_width(uint8_t width);
|
||||
void nRF24_set_payload_size(uint8_t pipe, uint8_t size);
|
||||
void nRF24_set_crc(uint8_t crc);
|
||||
void nRF24_set_pipe(uint8_t pipe, uint8_t onoff);
|
||||
void nRF24_set_autoack(uint8_t pipe, uint8_t onoff);
|
||||
void nRF24_set_dynack(uint8_t onoff);
|
||||
void nRF24_set_channel(uint8_t chan);
|
||||
void nRF24_set_rate(uint8_t rate);
|
||||
void nRF24_set_power(uint8_t power);
|
||||
void nRF24_set_addr_width(uint8_t width);
|
||||
void nRF24_set_payload_size(uint8_t pipe, uint8_t size);
|
||||
void nRF24_set_crc(uint8_t crc);
|
||||
void nRF24_set_pipe(uint8_t pipe, uint8_t onoff);
|
||||
void nRF24_set_autoack(uint8_t pipe, uint8_t onoff);
|
||||
void nRF24_set_dynack(uint8_t onoff);
|
||||
|
||||
void nRF24_update_config(uint8_t mask);
|
||||
void nRF24_update_config(uint8_t mask);
|
||||
|
||||
void nRF24_set_tx_config(uint8_t max_rt_flush, uint8_t new_done_state);
|
||||
void nRF24_set_tx_config(uint8_t max_rt_flush, uint8_t new_done_state);
|
||||
|
||||
void nRF24_mode_rx();
|
||||
void nRF24_mode_tx();
|
||||
void nRF24_mode_standby();
|
||||
void nRF24_mode_off();
|
||||
void nRF24_mode_rx();
|
||||
void nRF24_mode_tx();
|
||||
void nRF24_mode_standby();
|
||||
void nRF24_mode_off();
|
||||
uint8_t nRF24_mode_get();
|
||||
|
||||
uint8_t nRF24_data_is_ready(void);
|
||||
|
||||
int8_t nRF24_packet_rx(uint8_t status, void *pBuf);
|
||||
void nRF24_packet_tx(void *pBuf, uint8_t bytes, uint8_t noack);
|
||||
int8_t nRF24_packet_rx(uint8_t status, void *pBuf);
|
||||
void nRF24_packet_tx(void *pBuf, uint8_t bytes, uint8_t noack);
|
||||
uint8_t nRF24_rx_received_pipe();
|
||||
|
||||
void nRF24_clear_irq_flags(void);
|
||||
void nRF24_clear_irq_flags(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __TRUE_NRF24L01_LIB_H */
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* true's NRF24L01 C library
|
||||
* STM32L1xx interface driver
|
||||
* basically: it's better than nothing
|
||||
*
|
||||
* $Id: true_nRF24L01_stm32l1xx.c 375 2015-07-06 02:52:40Z true $
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* true's NRF24L01 C library
|
||||
* STM32L1xx interface driver header
|
||||
* basically: it's better than nothing
|
||||
*
|
||||
* $Id: true_nRF24L01_stm32l1xx.h 375 2015-07-06 02:52:40Z true $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -88,4 +86,4 @@ uint8_t nRF24_spi_rw(uint8_t data);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __TRUE_NRF24L01_STM32L1XX_H */
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
* cgram.c: lcd cgram graphics constants
|
||||
* 2014 by true
|
||||
*
|
||||
* icons.c: lcd cgram graphics constants
|
||||
* 2023 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: cgram.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
* TODO: add resources for how to generate new icons and graphics
|
||||
**/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
const uint8_t cgram_crown[6][8] = {
|
||||
{0x00, 0x00, 0x1C, 0x14, 0x1C, 0x0C, 0x0A, 0x09},
|
||||
{0x0E, 0x0A, 0x0E, 0x04, 0x04, 0x0A, 0x11, 0x00},
|
|
@ -1,20 +1,16 @@
|
|||
/**
|
||||
* cgram.h: lcd cgram graphics constants
|
||||
* icons.h: lcd cgram graphics constants
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: cgram.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DISPLAY_CGRAM_H
|
||||
#define __PIRATE_DISPLAY_CGRAM_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
extern const uint8_t cgram_crown[6][8];
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* infopirate.c: namebadge and other information animated 8x2 display
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: infopirate.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
@ -17,8 +12,6 @@
|
|||
#include "infopirate.h"
|
||||
#include "infopirate_prog.h"
|
||||
|
||||
#include "cgram/cgram.h"
|
||||
|
||||
|
||||
uint8_t prog_idx; // currently selected program
|
||||
uint8_t prog_loop; // current loop thru program
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* infopirate.h: namebadge and other information animated 8x2 display
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: infopirate.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_DISPLAY_INFOPIRATE_H
|
||||
#define __PIRATE_DISPLAY_INFOPIRATE_H
|
||||
#ifndef __DISPLAY_INFOPIRATE_H
|
||||
#define __DISPLAY_INFOPIRATE_H
|
||||
|
||||
|
||||
|
||||
|
@ -30,4 +25,4 @@ void menu_infopirate_btn_ok();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __DISPLAY_INFOPIRATE_H */
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
/**
|
||||
* infopirate_prog.h: program functions for badge related bullshit
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: infopirate_prog.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include "../menu/lcd_menu.h"
|
||||
#include "cgram/cgram.h" // for CGRAM graphics tables
|
||||
#include "cgram/icons.h" // for CGRAM graphics tables
|
||||
|
||||
|
||||
uint16_t prog_wait; // used by function to keep track of iteration time
|
||||
uint32_t prog_state[4]; // used by the function to keep track of state
|
||||
uint32_t prog_work[2]; // used for misc shit
|
||||
uint16_t prog_wait; // used by function to keep track of iteration time
|
||||
uint32_t prog_state[4]; // used by the function to keep track of state
|
||||
uint32_t prog_work[2]; // used for misc shit
|
||||
|
||||
|
||||
/* functions */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* adc.h: manager for anything adc-related
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: adc.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* adc.h: prototypes for adc functions
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: adc.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_IF_ADC_H
|
||||
#define __PIRATE_IF_ADC_H
|
||||
#ifndef __INTERFACE_ADC_H
|
||||
#define __INTERFACE_ADC_H
|
||||
|
||||
|
||||
|
||||
|
@ -35,4 +30,4 @@ void adc_start();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __INTERFACE_ADC_H */
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/**
|
||||
* pirate gpio interface
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: gpio.c 327 2015-02-18 04:43:42Z true $
|
||||
**/
|
|
@ -1,19 +1,14 @@
|
|||
/**
|
||||
* gpio.h: pirate gpio interface
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: gpio.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_IF_GPIO_H
|
||||
#define __PIRATE_IF_GPIO_H
|
||||
#ifndef __INTERFACE_GPIO_H
|
||||
#define __INTERFACE_GPIO_H
|
||||
|
||||
|
||||
|
||||
#define BIT_0 1
|
||||
#define BIT_0 (1 << 0)
|
||||
#define BIT_1 (1 << 1)
|
||||
#define BIT_2 (1 << 2)
|
||||
#define BIT_3 (1 << 3)
|
||||
|
@ -24,6 +19,8 @@
|
|||
|
||||
#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
|
||||
|
||||
typedef struct tGPIO {
|
||||
GPIO_TypeDef *port;
|
||||
uint16_t pin;
|
||||
|
@ -32,4 +29,4 @@ typedef struct tGPIO {
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __INTERFACE_GPIO_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* i2c.h: pirate i2c interface, command and data buffering, and data receive callbacks
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: i2c.c 368 2015-06-16 06:49:48Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* i2c.h: pirate i2c interface, command and data buffering, and data receive callbacks
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: i2c.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_I2C_H
|
||||
#define __PIRATE_I2C_H
|
||||
#ifndef __INTERFACE_I2C_H
|
||||
#define __INTERFACE_I2C_H
|
||||
|
||||
|
||||
|
||||
|
@ -28,4 +23,4 @@ void i2c_init(I2C_TypeDef *i2c, uint32_t speed);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __INTERFACE_I2C_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* led_pwm.c: led pwm configuration functions
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_pwm.c 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
* led_pwm.h: led pwm configuration prototypes
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_pwm.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_LED_PWM_H
|
||||
#define __PIRATE_LED_PWM_H
|
||||
#ifndef __INTERFACE_LED_PWM_H
|
||||
#define __INTERFACE_LED_PWM_H
|
||||
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "stm32l1xx_tim.h" // for TIM_TypeDef
|
||||
|
||||
|
||||
|
||||
|
@ -19,10 +19,11 @@
|
|||
#define LED_PWM_CH4 0x08
|
||||
|
||||
|
||||
|
||||
/* prototypes */
|
||||
void led_pwm_init_all();
|
||||
void led_pwm_set_oc(TIM_TypeDef *timer, uint32_t *oc);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __INTERFACE_LED_PWM_H */
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_bone.c 373 2015-06-25 06:21:27Z true $
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* Resources:
|
||||
* - Uses TIM11 OC1 and TIM9 OC1 and OC2 for PWM output; for frequency, see led_pwm.c
|
||||
*
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* led_bone.h: skull crossbones led matrix handling prototypes
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_bone.h 364 2015-06-12 04:44:55Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_LED_BONE_H
|
||||
#define __PIRATE_LED_BONE_H
|
||||
#ifndef __LED_LED_BONE_H
|
||||
#define __LED_LED_BONE_H
|
||||
|
||||
|
||||
|
||||
|
@ -51,4 +46,4 @@ void led_bone_set_program(uint8_t program_idx, uint8_t init,
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __LED_LED_BONE_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* led_bone.c: skull crossbones led matrix fixed patterns
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_bone_pattern.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
// LEDs are in this arrangement:
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* led_bone.c: skull crossbones led matrix fixed patterns
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_bone_prog.h 364 2015-06-12 04:44:55Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
static uint16_t led_prog_wait; // used by function to keep track of iteration time
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/*
|
||||
* led_eyes_prog.h: programs for the RGBLED eyes
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_eyes_prog.h 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
uint16_t led_prog_wait; // used by function to keep track of iteration time
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_matrix.c 373 2015-06-25 06:21:27Z true $
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* Resources:
|
||||
* - Uses TIM2 and TIM3 as PWM output; for frequency, see led_pwm.c
|
||||
**/
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/*
|
||||
* led_matrix.h: main skull led matrix handling prototypes
|
||||
* 2014 true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_matrix.h 364 2015-06-12 04:44:55Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_LED_MATRIX_H
|
||||
#define __PIRATE_LED_MATRIX_H
|
||||
#ifndef __LED_LED_MATRIX_H
|
||||
#define __LED_LED_MATRIX_H
|
||||
|
||||
|
||||
|
||||
|
@ -49,4 +44,4 @@ void led_matrix_set_program(uint8_t program_idx, uint8_t init,
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __LED_LED_MATRIX_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* led_matrix_pattern.h: fixed patterns for the RGBLED eyes
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_matrix_pattern.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
// all LEDs on 100%
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* led_matrix_prog.h: programs for the main LED matrix
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: led_matrix_prog.h 364 2015-06-12 04:44:55Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
// program variables
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* lcd_menu.c: lcd menuing functions, in particular editing functions
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lcd_menu.c 368 2015-06-16 06:49:48Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* lcd_menu.c: lcd menuing prototypes
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: lcd_menu.h 374 2015-06-29 02:06:22Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_LCD_MENU_H
|
||||
#define __PIRATE_LCD_MENU_H
|
||||
#ifndef __MENU_LCD_MENU_H
|
||||
#define __MENU_LCD_MENU_H
|
||||
|
||||
|
||||
|
||||
|
@ -103,4 +98,4 @@ void menu_btntype_editing();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_LCD_MENU_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_credits.c: we are legit
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_credits.c 350 2015-05-28 02:23:03Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_credits.h: we are a pirates
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_credits.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_CREDITS_H
|
||||
#define __PIRATE_MENU_CREDITS_H
|
||||
#ifndef __MENU_MENU_CREDITS_H
|
||||
#define __MENU_MENU_CREDITS_H
|
||||
|
||||
|
||||
|
||||
|
@ -18,4 +13,4 @@ extern const MenuItem menu_cred_ritem[];
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_CREDITS_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_program.c: led and lcd program selection and configuration
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_program.c 368 2015-06-16 06:49:48Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_program.h: led and lcd program selection and configuration
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_program.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_PROGRAM_H
|
||||
#define __PIRATE_MENU_PROGRAM_H
|
||||
#ifndef __MENU_MENU_PROGRAM_H
|
||||
#define __MENU_MENU_PROGRAM_H
|
||||
|
||||
|
||||
|
||||
|
@ -54,4 +49,4 @@ void menu_btntype_program();
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_PROGRAM_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_radio.c: cool radio tricks
|
||||
* 2015 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_radio.h: cool radio tricks
|
||||
* 2015 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_RADIO_H
|
||||
#define __PIRATE_MENU_RADIO_H
|
||||
#ifndef __MENU_MENU_RADIO_H
|
||||
#define __MENU_MENU_RADIO_H
|
||||
|
||||
|
||||
|
||||
|
@ -26,4 +21,4 @@ extern const MenuItem menu_comm_ritem[];
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_RADIO_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_sensors.c: sensors menu
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_sensors.c 350 2015-05-28 02:23:03Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_sensors.h: sensors menu
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_sensors.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_SENSORS_H
|
||||
#define __PIRATE_MENU_SENSORS_H
|
||||
#ifndef __MENU_MENU_SENSORS_H
|
||||
#define __MENU_MENU_SENSORS_H
|
||||
|
||||
|
||||
|
||||
|
@ -30,4 +25,4 @@ extern const MenuItem menu_sens_ritem[];
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_SENSORS_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_settings.c: setting shit up for pirates since
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_settings.c 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_settings.h: setting shit up for pirates since
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_settings.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_SETTINGS_H
|
||||
#define __PIRATE_MENU_SETTINGS_H
|
||||
#ifndef __MENU_MENU_SETTINGS_H
|
||||
#define __MENU_MENU_SETTINGS_H
|
||||
|
||||
|
||||
|
||||
|
@ -54,4 +49,4 @@ void settings_restore(uint8_t load_defaults);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_SETTINGS_H */
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/**
|
||||
* menu_settings_defprog.h: firmware default LED programs
|
||||
* 2014 by true
|
||||
*
|
||||
* $Id: menu_settings_defprog.h 375 2015-07-06 02:52:40Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
/* SKULL */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* menu_testing.c: test menu and testing functions
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_testing.c 350 2015-05-28 02:23:03Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#include <pirate.h>
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* menu_testing.h: test menu and testing functions
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: menu_testing.h 327 2015-02-18 04:43:42Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __PIRATE_MENU_TESTING_H
|
||||
#define __PIRATE_MENU_TESTING_H
|
||||
#ifndef __MENU_MENU_TESTING_H
|
||||
#define __MENU_MENU_TESTING_H
|
||||
|
||||
|
||||
|
||||
|
@ -18,4 +13,4 @@ extern const MenuItem menu_test_ritem[];
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MENU_MENU_TESTING_H */
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/**
|
||||
* pirate.c: yarrrgh mateys miscellaneous shit and system-wide common crap
|
||||
* 2014 by true
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* $Id: pirate.c 505 2021-09-05 19:07:51Z true $
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
@ -13,16 +8,15 @@
|
|||
|
||||
#include "device/attiny.h"
|
||||
#include "device/lcd.h"
|
||||
#include "display/cgram/cgram.h"
|
||||
|
||||
|
||||
uint8_t temperature; // pirate.h
|
||||
int8_t temperature_cal; // pirate.h
|
||||
uint8_t light_level; // pirate.h
|
||||
uint8_t light_gain; // pirate.h
|
||||
uint8_t temperature; // pirate.h
|
||||
int8_t temperature_cal; // pirate.h
|
||||
uint8_t light_level; // pirate.h
|
||||
uint8_t light_gain; // pirate.h
|
||||
uint16_t mic_peak; // pirate.h
|
||||
|
||||
uint8_t dc23_nametx;
|
||||
uint8_t dc23_nametx;
|
||||
|
||||
|
||||
PirateSettings settings;
|
||||
|
@ -32,6 +26,7 @@ PirateSettings settings;
|
|||
* CEASE ALL OPERATIONS
|
||||
* note: we still consume ~7mA like this, probably because of circuit design fuckup
|
||||
********/
|
||||
#include "display/cgram/icons.h"
|
||||
void pirate_shutdown(uint16_t type)
|
||||
{
|
||||
int i;
|
||||
|
|
Loading…
Reference in New Issue