Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PsiSwarm-flockingAddedBluetooth by
PsiSwarm/eprom.h@0:8a5497a2e366, 2015-10-03 (annotated)
- Committer:
- jah128
- Date:
- Sat Oct 03 22:48:50 2015 +0000
- Revision:
- 0:8a5497a2e366
- Child:
- 6:ff3c66f7372b
Initial commit of PsiSwarm API and example code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 0:8a5497a2e366 | 1 | /** University of York Robotics Laboratory PsiSwarm Library: Eprom Functions Header File |
jah128 | 0:8a5497a2e366 | 2 | * |
jah128 | 0:8a5497a2e366 | 3 | * File: eprom.h |
jah128 | 0:8a5497a2e366 | 4 | * |
jah128 | 0:8a5497a2e366 | 5 | * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York |
jah128 | 0:8a5497a2e366 | 6 | * |
jah128 | 0:8a5497a2e366 | 7 | * PsiSwarm Library Version: 0.2, October 2015 |
jah128 | 0:8a5497a2e366 | 8 | * |
jah128 | 0:8a5497a2e366 | 9 | * Functions for accessing the 64Kb EPROM chip and reading the reserved firmware block |
jah128 | 0:8a5497a2e366 | 10 | * |
jah128 | 0:8a5497a2e366 | 11 | * Example: |
jah128 | 0:8a5497a2e366 | 12 | * @code |
jah128 | 0:8a5497a2e366 | 13 | * #include "psiswarm.h" |
jah128 | 0:8a5497a2e366 | 14 | * |
jah128 | 0:8a5497a2e366 | 15 | * int main() { |
jah128 | 0:8a5497a2e366 | 16 | * init(); |
jah128 | 0:8a5497a2e366 | 17 | * write_eeprom_byte(0,0xDD); //Writes byte 0xDD in EPROM address 0 |
jah128 | 0:8a5497a2e366 | 18 | * char c = read_eeprom_byte(0); //c will hold 0xDD |
jah128 | 0:8a5497a2e366 | 19 | * //Valid address range is from 0 to 65279 |
jah128 | 0:8a5497a2e366 | 20 | * } |
jah128 | 0:8a5497a2e366 | 21 | * @endcode |
jah128 | 0:8a5497a2e366 | 22 | */ |
jah128 | 0:8a5497a2e366 | 23 | |
jah128 | 0:8a5497a2e366 | 24 | #ifndef EPROM_H |
jah128 | 0:8a5497a2e366 | 25 | #define EPROM_H |
jah128 | 0:8a5497a2e366 | 26 | |
jah128 | 0:8a5497a2e366 | 27 | /** Write a single byte to the EPROM |
jah128 | 0:8a5497a2e366 | 28 | * |
jah128 | 0:8a5497a2e366 | 29 | * @param address The address to store the data, range 0-65279 |
jah128 | 0:8a5497a2e366 | 30 | * @param data The character to store |
jah128 | 0:8a5497a2e366 | 31 | */ |
jah128 | 0:8a5497a2e366 | 32 | void write_eeprom_byte ( int address, char data ); |
jah128 | 0:8a5497a2e366 | 33 | |
jah128 | 0:8a5497a2e366 | 34 | /** Read a single byte from the EPROM |
jah128 | 0:8a5497a2e366 | 35 | * |
jah128 | 0:8a5497a2e366 | 36 | * @param address The address to read from, range 0-65279 |
jah128 | 0:8a5497a2e366 | 37 | * @return The character stored at address |
jah128 | 0:8a5497a2e366 | 38 | */ |
jah128 | 0:8a5497a2e366 | 39 | char read_eeprom_byte ( int address ); |
jah128 | 0:8a5497a2e366 | 40 | |
jah128 | 0:8a5497a2e366 | 41 | /** Read the next byte from the EPROM, to be called after read_eeprom_byte |
jah128 | 0:8a5497a2e366 | 42 | * |
jah128 | 0:8a5497a2e366 | 43 | * @return The character stored at address after the previous one read from |
jah128 | 0:8a5497a2e366 | 44 | */ |
jah128 | 0:8a5497a2e366 | 45 | char read_next_eeprom_byte ( void ); |
jah128 | 0:8a5497a2e366 | 46 | |
jah128 | 0:8a5497a2e366 | 47 | /** Read the data stored in the reserved firmware area of the EPROM |
jah128 | 0:8a5497a2e366 | 48 | * |
jah128 | 0:8a5497a2e366 | 49 | * @return 1 if a valid firmware is read, 0 otherwise |
jah128 | 0:8a5497a2e366 | 50 | */ |
jah128 | 0:8a5497a2e366 | 51 | char read_firmware ( void ); |
jah128 | 0:8a5497a2e366 | 52 | |
jah128 | 0:8a5497a2e366 | 53 | #endif |